(x[2]<<8) + \
x[3]
+#define UINT32_T_TO_BYTES(x,buf) \
+ buf[0] = (uint8_t) (x >> 24); \
+ buf[1] = (uint8_t) (x >> 16 & 0xff); \
+ buf[2] = (uint8_t) (x >> 8 & 0xff); \
+ buf[3] = (uint8_t) (x & 0xff);
+
int net_cache(void**,size_t*,void*,size_t);
ssize_t net_expected(struct peer*,enum peer_message*);
void net_handler(int,struct peer*);
#include<peer.h>
-int peer_hash_request(struct peer *info) {
+#define HASH_REQUEST_LENGTH crypto_hash_sha256_BYTES+4+4+4+4
+int peer_hash_request(struct peer *info,const struct hash_request *request) {
+ unsigned char buf[HASH_REQUEST_LENGTH];
+
+
+
return -1;
}
$(top_srcdir)/src/net/send.c \
$(top_srcdir)/src/net/wait.c \
$(top_srcdir)/src/peer/bitfield.c \
+ $(top_srcdir)/src/peer/choke.c \
$(top_srcdir)/src/peer/free.c \
$(top_srcdir)/src/peer/handshake.c \
$(top_srcdir)/src/peer/id.c \
- $(top_srcdir)/src/peer/init.c
+ $(top_srcdir)/src/peer/init.c \
+ $(top_srcdir)/src/peer/interest.c
clean-local:
-rm -rf $(TEST_DIRECTORY)
assert(1==peer_bitfield_received(info,i));
+ assert(1==peer_choke(info));
+ assert(1==peer_unchoke(info));
+
+ assert(1==peer_not_interested(info));
+ assert(1==peer_interested(info));
+
+ assert(1==peer_keepalive(info));
+
+ assert(1==peer_hash_request(info));
+
close(info->sock);
peer_free(info);
}