PEER_MESSAGE_HASH_REJECT = 23
};
+int peer_handshake(int,const uint8_t*,size_t,const uint8_t*,size_t);
+
#endif
--- /dev/null
+#include<peer.h>
+
+int peer_bitfield(int sock) {
+ return -1;
+}
--- /dev/null
+#include<peer.h>
+
+int peer_cancel() {
+ return -1;
+}
--- /dev/null
+#include<peer.h>
+
+int peer_choke(int sock) {
+ return -1;
+}
+
+int peer_unchoke(int sock) {
+ return -1;
+}
#include<peer.h>
-#define HANDSHAKE_STRING "\x13BitTorrent protocol\0\0\0\0\0\0\0\0";
+#define HANDSHAKE_STRING "\x13" "BitTorrent protocol\0\0\0\0\0\0\0\0";
#define HANDSHAKE_INFOHASH_SIZE 20
-int handshake(int sock, const uint8_t *infohash, size_t infohash_size const uint8_t peer_id, size_t peer_id_size) {
+int peer_handshake(int sock, const uint8_t *infohash, size_t infohash_size const uint8_t *peer_id, size_t peer_id_size) {
const char header[64] = HANDSHAKE_STRING;
+ assert(HANDSHAKE_INFOHASH_SIZE==infohash_size);
+ assert(PEER_ID_SIZE==peer_id_size);
+
memcpy(&(header[24]),infohash,HANDSHAKE_INFOHASH_SIZE);
memcpy(&(header[44]),peer_id,PEER_ID_SIZE);
--- /dev/null
+#include<peer.h>
+
+int peer_hash_request() {
+ return -1;
+}
+
+int peer_hash_reject() {
+ return -1;
+}
--- /dev/null
+#include<peer.h>
+
+int peer_have(int sock) {
+ return -1;
+}
--- /dev/null
+#include<peer.h>
+
+int peer_interested(int sock) {
+ return -1;
+}
+
+int peer_not_interested(int sock) {
+ return -1;
+}
--- /dev/null
+#include<peer.h>
+
+int peer_request() {
+ return -1;
+}
-DNDEBUG
endif
-check_PROGRAMS = bencode.tests block.tests feed.tests file.tests fs.concat.tests fs.filter.tests hash.tests hashmap.tests meta.tests opt.tests rss.tests session.tests torrent.tests tree.tests
+check_PROGRAMS = bencode.tests block.tests feed.tests file.tests fs.concat.tests fs.filter.tests hash.tests hashmap.tests meta.tests opt.tests peer.tests rss.tests session.tests torrent.tests tree.tests
TESTS = $(check_PROGRAMS)
if ENABLE_MEMCHECK
$(top_srcdir)/src/opt/worker.c \
$(top_srcdir)/src/session.c
+peer_tests_SOURCES = \
+ $(common_SOURCES) \
+ peer.tests.c
+
rss_tests_SOURCES = \
$(common_SOURCES) \
rss.tests.c \
--- /dev/null
+#include<test_utils.h>
+
+#include<peer.h>
+
+int main();
+
+int main() {
+ return EXIT_SUCCESS;
+}