1 /******************************************************************************
6 Description: Header file for program to convert a DCCP flow to a TCP flow for DCCP
10 1)Supports only a single DCCP connection per capture
11 2)Source Port!=Destination Port
12 3)DCCP MUST use 48 bit sequence numbers
13 4)Checksums are not computed (they are zeroed)
14 5)Only implements those packet types normally used in a session
15 6)DCCP Ack packets show up as TCP packets containing one byte
16 7)Very little error checking of packet headers
17 ******************************************************************************/
26 #include <sys/types.h>
30 #include <sys/socket.h>
32 #include <netinet/in.h>
33 #include <netinet/in_systm.h>
34 #include <arpa/inet.h>
35 #include <netinet/if_ether.h>
36 #include <netinet/ip.h>
37 #include <netinet/tcp.h>
38 #include <netinet/tcp.h>
39 #include <netinet/udp.h>
43 #include <linux/dccp.h>
46 #define MAX_PACKET 1600 /*Maximum size of TCP packet */
47 #define TBL_SZ 40000 /*Size of Sequence Number Table*/
51 /*sequence number structure--one per side of the connection */
53 int cur; /*current sequence number */
54 __be16 addr; /*connection half id---source port */
55 struct tbl *table; /*sequence number table */
56 int size; /*sequence number table size */
59 /*sequence number table structure */
61 __be32 old; /*DCCP sequence number */
62 u_int32_t new; /*TCP sequence number */
63 int size; /*packet size*/
64 enum dccp_pkt_type type; /*packet type*/
68 extern int debug; /*set to 1 to turn on debugging information*/
69 extern int yellow; /*tcptrace yellow line as currently acked packet*/
70 extern int green; /*tcptrace green line as currently acked packet*/
71 extern int sack; /*add TCP SACKS*/
73 /*Half Connection Structures*/
74 extern struct seq_num *s1; /*sequence number structure for side one of connection*/
75 extern struct seq_num *s2; /*sequence number structure for side two of connection*/
80 * 0) Always print even if debug isn't specified
81 * 1) Errors and warnings... Don't overload the screen with too much output
82 * 2) Notes and per-packet processing info... as verbose as needed
84 void dbgprintf(int level, const char *fmt, ...);
86 /*Function to parse encapsulation*/
87 int do_encap(int link, struct pcap_pkthdr *h, u_char **nptr, int *nlength, const u_char **optr, int *length);