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)Only implements those packet types normally used in a session
14 5)DCCP Ack packets show up as TCP packets containing one byte
15 6)Very little error checking of packet headers
16 ******************************************************************************/
25 #include <sys/types.h>
29 #include <sys/socket.h>
31 #include <netinet/in.h>
32 #include <netinet/in_systm.h>
33 #include <arpa/inet.h>
34 #include <netinet/if_ether.h>
35 #include <netinet/ip.h>
36 #include <netinet/tcp.h>
37 #include <netinet/tcp.h>
38 #include <netinet/udp.h>
42 #include <linux/dccp.h>
45 #define MAX_PACKET 1600 /*Maximum size of TCP packet */
46 #define TBL_SZ 40000 /*Size of Sequence Number Table*/
53 struct pcap_pkthdr *h; /*libpcap header*/
54 u_char *data; /*Packet Data*/
55 int length; /*Packet length*/
56 uint32_t src_id; /*Source ID of packet*/
57 uint32_t 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 uint32_t src_id; /*Source ID of packet*/
66 uint32_t dest_id;/*Destination ID of packet*/
76 /*Host---half of a connection*/
78 uint32_t id; /*Host ID*/
79 __be16 port; /*Host DCCP port*/
80 struct tbl *table; /*Host Sequence Number Table*/
81 int size; /*Size of Sequence Number Table*/
82 int cur; /*Current TCP Sequence Number*/
83 enum con_state state; /*Connection state*/
86 /*Connection structure*/
88 struct connection *next; /*List pointer*/
89 struct host A; /*Host A*/
90 struct host B; /*Host B*/
93 /*sequence number table structure */
95 __be32 old; /*DCCP sequence number */
96 u_int32_t new; /*TCP sequence number */
97 int size; /*packet size*/
98 enum dccp_pkt_type type; /*packet type*/
102 extern int debug; /*set to 1 to turn on debugging information*/
103 extern int yellow; /*tcptrace yellow line as currently acked packet*/
104 extern int green; /*tcptrace green line as currently acked packet*/
105 extern int sack; /*add TCP SACKS*/
107 extern struct connection *chead;/*connection list*/
112 * 0) Always print even if debug isn't specified
113 * 1) Errors and warnings... Don't overload the screen with too much output
114 * 2) Notes and per-packet processing info... as verbose as needed
116 void dbgprintf(int level, const char *fmt, ...);
118 /*Function to parse encapsulation*/
119 int do_encap(int link, struct packet *new, const struct const_packet *old);
121 /*Connection functions*/
122 int get_host(uint32_t src_id, uint32_t dest_id, int src_port, int dest_port, struct host **fwd, struct host **rev);
123 struct connection *add_connection(uint32_t src_id, uint32_t dest_id, int src_port, int dest_port);
124 int update_state(struct host* hst, enum con_state st);