]> sjero.net Git - dccp2tcp/blob - encap.h
baf092c93dbd4a34476dce3c0358192d8c9b7580
[dccp2tcp] / encap.h
1 /******************************************************************************
2 Author: Samuel Jero
3
4 Date: 11/2012
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  *      int id_len:                     Length of the source and destination ID.
30  *
31  *      u_char *src_id:         This is an ID for the source host. If you are going to
32  *                                              demultiplex DCCP on anything but Port Numbers, you
33  *                                              need to set this field. Typically this would be an
34  *                                              IP address.
35  *
36  *      u_char *dest_id:        This is an ID for the destination host. If you are going to
37  *                                              demultiplex DCCP on anything but Port Numbers, you
38  *                                              need to set this field. Typically this would be an
39  *                                              IP address.
40  *
41  *      struct const_packet *old:       The Old packet. It contains the following fields.
42  *
43  *      u_char* data:           This is a pointer to the buffer containing the
44  *                                              old packet. When a function is called, this will
45  *                                              point at the location of that protocol's header.
46  *
47  *      int length:                     The length of the old packet. Each encapsulation
48  *                                              layer MUST decrement this by the amount of it's
49  *                                              headers. An encapsulation layer MUST never read
50  *                                              beyond this into old->data.
51  */
52
53 /*
54  * Last Level Conversion Function
55  * Converts DCCP to TCP for analysis by TCPTRACE
56  */
57 int convert_packet(struct packet *new, const struct const_packet *old);
58
59 /*Standard Encapsulation Functions*/
60 int ethernet_encap(struct packet *new, const struct const_packet *old);
61 int linux_cooked_encap(struct packet *new, const struct const_packet *old);
62 int ipv4_encap(struct packet *new, const struct const_packet *old);
63 int ipv6_encap(struct packet *new, const struct const_packet *old);
64
65 #endif /* ENCAP_H_ */