]> sjero.net Git - strip6in4/blob - encap.h
Modify to output RAW packet capture correctly
[strip6in4] / encap.h
1 /******************************************************************************
2 Utility to create a pcap file of a 6in4 stream present in an origin pcap file
3
4 Copyright (C) 2013  Samuel Jero <sj323707@ohio.edu>
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 Author: Samuel Jero <sj323707@ohio.edu>
20 Date: 03/2013
21 ******************************************************************************/
22 #ifndef ENCAP_H_
23 #define ENCAP_H_
24
25 /*
26  * All Conversion functions use these standard arguments:
27  * struct packet *new:          The New packet. It contains the following fields.
28  *
29  *      struct pcap_pkthdr *h: This is a copy of the libpcap packet structure.
30  *                                                         You are free to modify and use the fields.
31  *
32  *      u_char *data:           This is a pointer to a buffer for the new packet.
33  *                                                      Each encapsulation has the responsibility to call
34  *                                                      When a function is called, this will point at the
35  *                                                      location for that protocol's header to start.
36  *
37  *      int length:                     The length of the new packet. Each encapsulation
38  *                                              can rely on this to contain the remaining buffer
39  *                                              space AND must return with this parameter containing
40  *                                              the length of the new packet at that layer.
41  *
42  *      struct const_packet *old:       The Old packet. It contains the following fields.
43  *
44  *      u_char* data:           This is a pointer to the buffer containing the
45  *                                              old packet. When a function is called, this will
46  *                                              point at the location of that protocol's header.
47  *
48  *      int length:                     The length of the old packet. Each encapsulation
49  *                                              layer MUST decrement this by the amount of it's
50  *                                              headers. An encapsulation layer MUST never read
51  *                                              beyond this into old->data.
52  */
53
54 /*
55  * Last Level Function
56  * Does de-encapsulation
57  */
58 int decap_packet(const struct const_packet* old);
59
60 /*Standard Encapsulation Functions*/
61 int ethernet_encap(const struct const_packet *old);
62 int ethernet_vlan_encap(const struct const_packet *old);
63 int linux_cooked_encap(const struct const_packet *old);
64 int ipv4_encap(const struct const_packet *old);
65 int ipv6_encap(const struct const_packet *old);
66
67
68 #endif /* ENCAP_H_ */