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
44 u_int8_t h_array[SWIFT_HASH_SIZE];
48 __SOCKADDR_COMMON(sin_);
49 struct in_addr sin_addr;
50 struct sw_hash sw_hash;
52 /* Pad to size of `struct sockaddr'. */
53 unsigned char sw_zero[sizeof(struct sockaddr) -
54 __SOCKADDR_COMMON_SIZE -
55 sizeof(struct sw_hash) -
56 sizeof(struct in_addr)];
60 * swift header (work in progress)
64 /* file hash (to be seeded or requested) */
65 struct sw_hash base_hash;
67 struct sw_state sock_state;
74 #endif /* SWIFT_TYPES_ */