/******************************************************************************
-Author: Samuel Jero
+Utility to convert a DCCP flow to a TCP flow for DCCP analysis via
+ tcptrace.
-Date: 7/2011
+Copyright (C) 2012 Samuel Jero <sj323707@ohio.edu>
-Description: Header file for program to convert a DCCP flow to a TCP flow for DCCP
- analysis via tcptrace.
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Author: Samuel Jero <sj323707@ohio.edu>
+Date: 11/2012
Notes:
1)CCID2 ONLY
2)DCCP MUST use 48 bit sequence numbers
- 3)Checksums are not computed (they are zeroed)
- 4)Only implements those packet types normally used in a session
- 5)DCCP Ack packets show up as TCP packets containing one byte
- 6)Very little error checking of packet headers
+ 3)DCCP DATA packets are not implemented (Linux doesn't use them)
+ 4)DCCP Ack packets show up as TCP packets containing one byte
******************************************************************************/
#ifndef _DCCP2TCP_H
#define _DCCP2TCP_H
#include <ctype.h>
#include <pcap.h>
#include <linux/dccp.h>
+#include "checksums.h"
#define MAX_PACKET 1600 /*Maximum size of TCP packet */
struct pcap_pkthdr *h; /*libpcap header*/
u_char *data; /*Packet Data*/
int length; /*Packet length*/
- uint32_t src_id; /*Source ID of packet*/
- uint32_t dest_id; /*Destination ID of packet*/
+ int id_len; /*Length of IDs*/
+ u_char *src_id; /*Source ID of packet*/
+ u_char *dest_id;/*Destination ID of packet*/
};
/*Constant Packet structure*/
const struct pcap_pkthdr *h; /*libpcap header*/
const u_char *data; /*Packet Data*/
int length; /*Packet length*/
- uint32_t src_id; /*Source ID of packet*/
- uint32_t dest_id;/*Destination ID of packet*/
+ int id_len; /*Length of IDs*/
+ u_char *src_id; /*Source ID of packet*/
+ u_char *dest_id;/*Destination ID of packet*/
};
/*Connection states*/
CLOSE,
};
+/*Connection Types (i.e. CCID)*/
+enum con_type{
+ UNKNOWN,
+ CCID2,
+ CCID3,
+};
+
/*Host---half of a connection*/
struct host{
- uint32_t id; /*Host ID*/
+ int id_len; /*Length of ID*/
+ u_char *id; /*Host ID*/
__be16 port; /*Host DCCP port*/
struct tbl *table; /*Host Sequence Number Table*/
int size; /*Size of Sequence Number Table*/
int cur; /*Current TCP Sequence Number*/
enum con_state state; /*Connection state*/
+ enum con_type type; /*Connection type*/
};
/*Connection structure*/
extern struct connection *chead;/*connection list*/
-
/*debug printf
* Levels:
* 0) Always print even if debug isn't specified
int do_encap(int link, struct packet *new, const struct const_packet *old);
/*Connection functions*/
-int get_host(uint32_t src_id, uint32_t dest_id, int src_port, int dest_port, struct host **fwd, struct host **rev);
-struct connection *add_connection(uint32_t src_id, uint32_t dest_id, int src_port, int dest_port);
+int get_host(u_char *src_id, u_char* dest_id, int id_len, int src_port, int dest_port,
+ struct host **fwd, struct host **rev);
+struct connection *add_connection(u_char *src_id, u_char* dest_id, int id_len,
+ int src_port, int dest_port);
int update_state(struct host* hst, enum con_state st);
+void cleanup_connections();
+
+/*Per-CCID convert functions*/
+int ccid2_convert_packet(struct packet *new, const struct const_packet* old);
#endif