2 * swift data structures
4 * swift struct sockaddr is dubbed struct sockaddr_sw.
5 * swhdr is swift packet header (as delivered on the network).
7 * 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
11 #define SWIFT_TYPES_ 1
13 #include <sys/types.h>
14 #include <sys/socket.h>
15 #include <netinet/in.h>
22 * 143 is a free IP protocol number (as shown in /etc/protocols
23 * and <netinet/in.h>).
26 #define IPPROTO_SWIFT 143
30 * - IP address (Network Layer)
31 * - file hash (or hash for part of a file)
32 * - a seeder (sender) publishes that hash
33 * - a leecher (receiver) requests that hash
34 * - stands as port number both for sender and receiver
37 #define SWIFT_HASH_SIZE 8
40 unsigned char h_array[SWIFT_HASH_SIZE];
44 __SOCKADDR_COMMON(sin_);
45 struct in_addr sin_addr;
46 struct sw_hash sw_hash;
48 /* Pad to size of `struct sockaddr'. */
49 unsigned char sw_zero[sizeof(struct sockaddr) -
50 __SOCKADDR_COMMON_SIZE -
52 sizeof(struct in_addr)];
56 * swift header (work in progress)
60 /* file hash (to be seeded or requested) */
61 u_int8_t base_hash[SWIFT_HASH_SIZE];
69 #endif /* SWIFT_TYPES_ */