]> sjero.net Git - dccp2tcp/blobdiff - dccp2tcp.c
Add GNU GPL headers to all files
[dccp2tcp] / dccp2tcp.c
index 17563f2584a1a455eaa2c5972d709685f2eb9cdf..c7f77e14be8a4c5163c4f7e5fe6896c767494cf5 100644 (file)
@@ -1,10 +1,24 @@
 /******************************************************************************
-Author: Samuel Jero
+Utility to convert a DCCP flow to a TCP flow for DCCP analysis via
+               tcptrace.
 
-Date: 11/2011
+Copyright (C) 2012  Samuel Jero <sj323707@ohio.edu>
 
-Description: 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
@@ -27,8 +41,6 @@ struct connection *chead;     /*connection list*/
 
 
 
-void PcapSavePacket(struct pcap_pkthdr *h, u_char *data);
-void process_packets();
 void handle_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes);
 int convert_packet(struct packet *new, const struct const_packet* old);
 unsigned int interp_ack_vect(u_char* hdr);
@@ -157,8 +169,12 @@ void handle_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *byte
        old.h=h;
        old.length=h->caplen;
        old.data=bytes;
+       old.dest_id=NULL;
+       old.src_id=NULL;
        new.h=&nh;
        new.length=MAX_PACKET;
+       new.dest_id=NULL;
+       new.src_id=NULL;
 
        /*create buffer for new packet*/
        new.data=ndata=malloc(MAX_PACKET);
@@ -216,10 +232,12 @@ int convert_packet(struct packet *new, const struct const_packet* old)
        dccphex=(struct dccp_hdr_ext*)(old->data+sizeof(struct dccp_hdr));
        dccphack=(struct dccp_hdr_ack_bits*)(old->data+ sizeof(struct dccp_hdr) + sizeof(struct dccp_hdr_ext));
 
-       dbgprintf(2,"Sequence Number: %llu\n", (unsigned long long)(((unsigned long)ntohs(dccph->dccph_seq)<<32) + ntohl(dccphex->dccph_seq_low)));
+       dbgprintf(2,"Sequence Number: %llu\n", (unsigned long long)
+                       (((unsigned long)ntohs(dccph->dccph_seq)<<32) + ntohl(dccphex->dccph_seq_low)));
 
        /*Get Hosts*/
-       if(get_host(new->src_id, new->dest_id, dccph->dccph_sport, dccph->dccph_dport, &h1, &h2)){
+       if(get_host(new->src_id, new->dest_id, new->id_len,
+                       dccph->dccph_sport, dccph->dccph_dport, &h1, &h2)){
                dbgprintf(0,"Error: Can't Get Hosts!\n");
                return 0;
        }