1 /******************************************************************************
6 Description: Header file for program to convert a DCCP flow to a TCP flow for DCCP
11 2)DCCP MUST use 48 bit sequence numbers
12 3)Checksums are not computed (they are zeroed)
13 4)DCCP DATA packets are not implemented (Linux doesn't use them)
14 5)DCCP Ack packets show up as TCP packets containing one byte
15 ******************************************************************************/
24 #include <sys/types.h>
28 #include <sys/socket.h>
30 #include <netinet/in.h>
31 #include <netinet/in_systm.h>
32 #include <arpa/inet.h>
33 #include <netinet/if_ether.h>
34 #include <netinet/ip.h>
35 #include <netinet/tcp.h>
36 #include <netinet/tcp.h>
37 #include <netinet/udp.h>
41 #include <linux/dccp.h>
44 #define MAX_PACKET 1600 /*Maximum size of TCP packet */
45 #define TBL_SZ 40000 /*Size of Sequence Number Table*/
52 struct pcap_pkthdr *h; /*libpcap header*/
53 u_char *data; /*Packet Data*/
54 int length; /*Packet length*/
55 int id_len; /*Length of IDs*/
56 u_char *src_id; /*Source ID of packet*/
57 u_char *dest_id;/*Destination ID of packet*/
60 /*Constant Packet structure*/
62 const struct pcap_pkthdr *h; /*libpcap header*/
63 const u_char *data; /*Packet Data*/
64 int length; /*Packet length*/
65 int id_len; /*Length of IDs*/
66 u_char *src_id; /*Source ID of packet*/
67 u_char *dest_id;/*Destination ID of packet*/
77 /*Host---half of a connection*/
79 int id_len; /*Length of ID*/
80 u_char *id; /*Host ID*/
81 __be16 port; /*Host DCCP port*/
82 struct tbl *table; /*Host Sequence Number Table*/
83 int size; /*Size of Sequence Number Table*/
84 int cur; /*Current TCP Sequence Number*/
85 enum con_state state; /*Connection state*/
88 /*Connection structure*/
90 struct connection *next; /*List pointer*/
91 struct host A; /*Host A*/
92 struct host B; /*Host B*/
95 /*sequence number table structure */
97 __be32 old; /*DCCP sequence number */
98 u_int32_t new; /*TCP sequence number */
99 int size; /*packet size*/
100 enum dccp_pkt_type type; /*packet type*/
104 extern int debug; /*set to 1 to turn on debugging information*/
105 extern int yellow; /*tcptrace yellow line as currently acked packet*/
106 extern int green; /*tcptrace green line as currently acked packet*/
107 extern int sack; /*add TCP SACKS*/
109 extern struct connection *chead;/*connection list*/
114 * 0) Always print even if debug isn't specified
115 * 1) Errors and warnings... Don't overload the screen with too much output
116 * 2) Notes and per-packet processing info... as verbose as needed
118 void dbgprintf(int level, const char *fmt, ...);
120 /*Function to parse encapsulation*/
121 int do_encap(int link, struct packet *new, const struct const_packet *old);
123 /*Connection functions*/
124 int get_host(u_char *src_id, u_char* dest_id, int id_len, int src_port, int dest_port,
125 struct host **fwd, struct host **rev);
126 struct connection *add_connection(u_char *src_id, u_char* dest_id, int id_len,
127 int src_port, int dest_port);
128 int update_state(struct host* hst, enum con_state st);
129 void cleanup_connections();