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 uint32_t src_id; /*Source ID of packet*/
56 uint32_t dest_id; /*Destination ID of packet*/
59 /*Constant Packet structure*/
61 const struct pcap_pkthdr *h; /*libpcap header*/
62 const u_char *data; /*Packet Data*/
63 int length; /*Packet length*/
64 uint32_t src_id; /*Source ID of packet*/
65 uint32_t dest_id;/*Destination ID of packet*/
75 /*Host---half of a connection*/
77 uint32_t id; /*Host ID*/
78 __be16 port; /*Host DCCP port*/
79 struct tbl *table; /*Host Sequence Number Table*/
80 int size; /*Size of Sequence Number Table*/
81 int cur; /*Current TCP Sequence Number*/
82 enum con_state state; /*Connection state*/
85 /*Connection structure*/
87 struct connection *next; /*List pointer*/
88 struct host A; /*Host A*/
89 struct host B; /*Host B*/
92 /*sequence number table structure */
94 __be32 old; /*DCCP sequence number */
95 u_int32_t new; /*TCP sequence number */
96 int size; /*packet size*/
97 enum dccp_pkt_type type; /*packet type*/
101 extern int debug; /*set to 1 to turn on debugging information*/
102 extern int yellow; /*tcptrace yellow line as currently acked packet*/
103 extern int green; /*tcptrace green line as currently acked packet*/
104 extern int sack; /*add TCP SACKS*/
106 extern struct connection *chead;/*connection list*/
111 * 0) Always print even if debug isn't specified
112 * 1) Errors and warnings... Don't overload the screen with too much output
113 * 2) Notes and per-packet processing info... as verbose as needed
115 void dbgprintf(int level, const char *fmt, ...);
117 /*Function to parse encapsulation*/
118 int do_encap(int link, struct packet *new, const struct const_packet *old);
120 /*Connection functions*/
121 int get_host(uint32_t src_id, uint32_t dest_id, int src_port, int dest_port, struct host **fwd, struct host **rev);
122 struct connection *add_connection(uint32_t src_id, uint32_t dest_id, int src_port, int dest_port);
123 int update_state(struct host* hst, enum con_state st);
124 void cleanup_connections();