]> sjero.net Git - dccp2tcp/blob - dccp2tcp.h
e45269191a2db9788bfda85115e03ea986f31e73
[dccp2tcp] / dccp2tcp.h
1 /******************************************************************************
2 Author: Samuel Jero
3
4 Date: 1/2011
5
6 Description: Header file for program to convert a DCCP flow to a TCP flow for DCCP
7                  analysis via tcptrace.
8
9 Notes:
10         1)Supports only a single DCCP contection 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 ******************************************************************************/
18 #ifndef _DCCP2TCP_H
19 #define _DCCP2TCP_H
20
21 #include <stdarg.h>
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <string.h>
25 #include <strings.h>
26 #include <sys/types.h>
27 #include <unistd.h>
28 #include <time.h>
29 #include <sys/time.h>
30 #include <sys/socket.h>
31 #include <net/if.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>
40 #include <netdb.h>
41 #include <ctype.h>
42 #include <pcap.h>
43 #include <linux/dccp.h>
44
45
46 #define MAX_PACKET      1600    /*Maximum size of TCP packet */
47 #define TBL_SZ          10000   /*Size of Sequence Number Table*/
48
49
50
51 /*sequence number structure--one per side of the connection */
52 struct seq_num{
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 */
57 };
58
59 /*sequence number table structure */
60 struct tbl{
61         __be32          old;    /*DCCP sequence number */
62         u_int32_t       new;    /*TCP sequence number */
63         int             size;           /*packet size*/
64 };
65
66 /*Option flags*/
67 extern int debug;               /*set to 1 to turn on debugging information*/
68 extern int yellow;      /*tcptrace yellow line as currently acked packet*/
69 extern int green;               /*tcptrace green line as currently acked packet*/
70 extern int sack;                /*add TCP SACKS*/
71
72 /*Half Connection Structures*/
73 extern struct seq_num   *s1;    /*sequence number structure for side one of connection*/
74 extern struct seq_num   *s2;    /*sequence number structure for side two of connection*/
75
76
77 /*debug printf
78  * Levels:
79  *      0) Always print even if debug isn't specified
80  *  1) Errors and warnings... Don't overload the screen with too much output
81  *  2) Notes and per-packet processing info... as verbose as needed
82  */
83 void dbgprintf(int level, const char *fmt, ...);
84
85
86 #endif