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.
5 Copyright (C) 2012 Samuel Jero <sj323707@ohio.edu>
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.
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.
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/>.
20 Author: Samuel Jero <sj323707@ohio.edu>
22 ******************************************************************************/
27 * All Conversion functions use these standard arguments:
28 * struct packet *new: The New packet. It contains the following fields.
30 * struct pcap_pkthdr *h: This is a copy of the libpcap packet structure.
31 * You are free to modify and use the fields.
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.
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.
43 * int id_len: Length of the source and destination ID.
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
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
55 * char* (*print_id)(char* buf, int len, u_char* id, int id_len):
56 * This is a function to pretty-print the destination or
57 * source ID to the given buffer.
59 * struct const_packet *old: The Old packet. It contains the following fields.
61 * u_char* data: This is a pointer to the buffer containing the
62 * old packet. When a function is called, this will
63 * point at the location of that protocol's header.
65 * int length: The length of the old packet. Each encapsulation
66 * layer MUST decrement this by the amount of it's
67 * headers. An encapsulation layer MUST never read
68 * beyond this into old->data.
72 * Last Level Conversion Function
73 * Converts DCCP to TCP for analysis by TCPTRACE
75 int convert_packet(struct packet *new, const struct const_packet *old);
77 /*Standard Encapsulation Functions*/
78 int ethernet_encap(struct packet *new, const struct const_packet *old);
79 int ethernet_vlan_encap(struct packet *new, const struct const_packet *old);
80 int linux_cooked_encap(struct packet *new, const struct const_packet *old);
81 int ipv4_encap(struct packet *new, const struct const_packet *old);
82 int ipv6_encap(struct packet *new, const struct const_packet *old);
84 /*Standard Print Functions*/
85 char* print_ipv6(char* buf, int len, u_char* id, int id_len);
86 char* print_ipv4(char* buf, int len, u_char* id, int id_len);