]> sjero.net Git - dccp2tcp/blob - encap.h
Modified .hgignore
[dccp2tcp] / encap.h
1 /******************************************************************************
2 Author: Samuel Jero
3
4 Date: 5/2011
5
6 Description: Header file for Encapsulation Functions for DCCP to TCP conversion
7
8 ******************************************************************************/
9 #ifndef ENCAP_H_
10 #define ENCAP_H_
11
12 /*
13  * All Conversion functions use these standard arguments:
14  *  struct pcap_pkthdr *h: This is a copy of the libpcap packet structure.
15  *                                                 You are free to modify and use the fields.
16  *
17  *  u_char **nptr:              This is a pointer to a buffer for the new packet.
18  *                                              Each encapsulation has the responsibility to call
19  *                                              When a function is called, this will point at the
20  *                                              location for that protocol's header to start.
21  *
22  *  int *nlength:               The length of the new packet. Each encapsulation
23  *                                      can rely on this to contain the remaining buffer
24  *                                      space AND must return with this parameter containing
25  *                                      the length of the new packet at that layer.
26  *
27  *  u_char** optr:              This is a pointer to the buffer containing the
28  *                                      old packet. When a functio is called, this will
29  *                                      point at the location of that protocol's header.
30  *
31  *  int* length:                The length of the old packet. Each encapsulation
32  *                                      layer MUST decrement this by the amount of it's
33  *                                      headers. An encapsulation layer MUST never read
34  *                                      beyond this into optr.
35  */
36
37 /*
38  * Last Level Conversion Function
39  * Converts DCCP to TCP for analysis by TCPTRACE
40  */
41 int convert_packet(struct pcap_pkthdr *h, u_char **nptr, int *nlength, const u_char **optr, int *length);
42
43 /*Standard Encapsulation Functions*/
44 int ethernet_encap(struct pcap_pkthdr *h, u_char **nptr, int *nlength, const u_char **optr, int *length);
45 int linux_cooked_encap(struct pcap_pkthdr *h, u_char **nptr, int *nlength, const u_char **optr, int *length);
46 int ipv4_encap(struct pcap_pkthdr *h, u_char **nptr, int *nlength, const u_char **optr, int *length);
47
48 #endif /* ENCAP_H_ */