]> sjero.net Git - dccp2tcp/blob - encap.h
Cleanup types throughout code
[dccp2tcp] / encap.h
1 /******************************************************************************
2 Utility to convert a DCCP flow to a TCP flow for DCCP analysis via
3                 tcptrace. Header file for Encapsulation Functions for DCCP to TCP conversion.
4
5 Copyright (C) 2012  Samuel Jero <sj323707@ohio.edu>
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 Author: Samuel Jero <sj323707@ohio.edu>
21 Date: 11/2012
22 ******************************************************************************/
23 #ifndef ENCAP_H_
24 #define ENCAP_H_
25
26 /*
27  * All Conversion functions use these standard arguments:
28  * struct packet *new:          The New packet. It contains the following fields.
29  *
30  *      struct pcap_pkthdr *h: This is a copy of the libpcap packet structure.
31  *                                                         You are free to modify and use the fields.
32  *
33  *      u_char *data:           This is a pointer to a buffer for the new packet.
34  *                                                      Each encapsulation has the responsibility to call
35  *                                                      When a function is called, this will point at the
36  *                                                      location for that protocol's header to start.
37  *
38  *      int length:                     The length of the new packet. Each encapsulation
39  *                                              can rely on this to contain the remaining buffer
40  *                                              space AND must return with this parameter containing
41  *                                              the length of the new packet at that layer.
42  *
43  *      int id_len:                     Length of the source and destination ID.
44  *
45  *      u_char *src_id:         This is an ID for the source host. If you are going to
46  *                                              demultiplex DCCP on anything but Port Numbers, you
47  *                                              need to set this field. Typically this would be an
48  *                                              IP address.
49  *
50  *      u_char *dest_id:        This is an ID for the destination host. If you are going to
51  *                                              demultiplex DCCP on anything but Port Numbers, you
52  *                                              need to set this field. Typically this would be an
53  *                                              IP address.
54  *
55  *      struct const_packet *old:       The Old packet. It contains the following fields.
56  *
57  *      u_char* data:           This is a pointer to the buffer containing the
58  *                                              old packet. When a function is called, this will
59  *                                              point at the location of that protocol's header.
60  *
61  *      int length:                     The length of the old packet. Each encapsulation
62  *                                              layer MUST decrement this by the amount of it's
63  *                                              headers. An encapsulation layer MUST never read
64  *                                              beyond this into old->data.
65  */
66
67 /*
68  * Last Level Conversion Function
69  * Converts DCCP to TCP for analysis by TCPTRACE
70  */
71 int convert_packet(struct packet *new, const struct const_packet *old);
72
73 /*Standard Encapsulation Functions*/
74 int ethernet_encap(struct packet *new, const struct const_packet *old);
75 int linux_cooked_encap(struct packet *new, const struct const_packet *old);
76 int ipv4_encap(struct packet *new, const struct const_packet *old);
77 int ipv6_encap(struct packet *new, const struct const_packet *old);
78
79 #endif /* ENCAP_H_ */