]> sjero.net Git - dccp2tcp/blob - encap.h
Tag older versions in repository
[dccp2tcp] / encap.h
1 /******************************************************************************
2 Author: Samuel Jero
3
4 Date: 7/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 packet *new:          The New packet. It contains the following fields.
15  *
16  *      struct pcap_pkthdr *h: This is a copy of the libpcap packet structure.
17  *                                                         You are free to modify and use the fields.
18  *
19  *      u_char *data:           This is a pointer to a buffer for the new packet.
20  *                                                      Each encapsulation has the responsibility to call
21  *                                                      When a function is called, this will point at the
22  *                                                      location for that protocol's header to start.
23  *
24  *      int length:                     The length of the new packet. Each encapsulation
25  *                                              can rely on this to contain the remaining buffer
26  *                                              space AND must return with this parameter containing
27  *                                              the length of the new packet at that layer.
28  *
29  *      uint32_t src_id:        This is an ID for the source host. If you are going to
30  *                                              demultiplex DCCP on anything but Port Numbers, you
31  *                                              need to set this field. Typically this would be an
32  *                                              IP address.
33  *
34  *      uint32_t dest_id:       This is an ID for the destination host. If you are going to
35  *                                              demultiplex DCCP on anything but Port Numbers, you
36  *                                              need to set this field. Typically this would be an
37  *                                              IP address.
38  *
39  *      struct const_packet *old:       The Old packet. It contains the following fields.
40  *
41  *      u_char* data:           This is a pointer to the buffer containing the
42  *                                              old packet. When a function is called, this will
43  *                                              point at the location of that protocol's header.
44  *
45  *      int length:                     The length of the old packet. Each encapsulation
46  *                                              layer MUST decrement this by the amount of it's
47  *                                              headers. An encapsulation layer MUST never read
48  *                                              beyond this into old->data.
49  */
50
51 /*
52  * Last Level Conversion Function
53  * Converts DCCP to TCP for analysis by TCPTRACE
54  */
55 int convert_packet(struct packet *new, const struct const_packet *old);
56
57 /*Standard Encapsulation Functions*/
58 int ethernet_encap(struct packet *new, const struct const_packet *old);
59 int linux_cooked_encap(struct packet *new, const struct const_packet *old);
60 int ipv4_encap(struct packet *new, const struct const_packet *old);
61
62 #endif /* ENCAP_H_ */