<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>ltptrace</name>
+ <name>ltp2tcp</name>
<comment></comment>
<projects>
</projects>
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
###############################################################################
#Author: Samuel Jero
#
-# Date: 12/2010
+# Date: 6/2013
#
-# Makefile for program ltptrace
+# Makefile for program ltp2tcp
###############################################################################
CFLAGS= -O2 -Wall -Werror
MANDIR = /usr/local/man
-all: ltptrace
+all: ltp2tcp
-ltptrace: main.o ltp.o encap.o udp.o dccp.o sll.o Makefile
- gcc ${CFLAGS} ${LDLIBS} --std=gnu99 main.o ltp.o encap.o udp.o dccp.o sll.o -oltptrace
+ltp2tcp: main.o ltp.o encap.o udp.o dccp.o sll.o Makefile
+ gcc ${CFLAGS} ${LDLIBS} --std=gnu99 main.o ltp.o encap.o udp.o dccp.o sll.o -oltp2tcp
main.o: ltp2tcp.c ltp2tcp.h
gcc -c ${CFLAGS} ${LDLIBS} --std=gnu99 ltp2tcp.c -omain.o
install: ltptrace
- install -m 755 -o bin -g bin ltptrace ${BINDIR}/ltptrace
-# install -m 444 -o bin -g bin ltptrace.1 ${MANDIR}/man1/ltptrace.1
+ install -m 755 -o bin -g bin ltptrace ${BINDIR}/ltp2tcp
+# install -m 444 -o bin -g bin ltptrace.1 ${MANDIR}/man1/ltp2tcp.1
uninstall:
- rm -f ${BINDIR}/ltptrace
-# rm -f ${MANDIR}/man1/ltptrace.1
+ rm -f ${BINDIR}/ltp2tcp
+# rm -f ${MANDIR}/man1/ltp2tcp.1
clean:
- rm -f *~ ltptrace core *.o
+ rm -f *~ ltp2tcp core *.o
included a ./configure script at this time. Contact me, if major problems arise.
Usage is as follows:
-ltptrace -t{encapsulation} ltp_file tcp_file [-d] [-b{block_size}] [-s{start session}-{end session}]
- -d is debug (repeat for additional verbosity)
- -t specifies what protocol LTP is encapsulated in. Right now, only udp and dccp are supported.
- -b specifies the LTP block size (NOT the bundle size) that is being used over this connection.
+ltp2tcp -t{encapsulation} [-v] [-V] [-h] [-b{block_size}] [-s{start session}-{end session}] ltp_file tcp_file
+ -v verbose (repeat for additional verbosity)
+ -V Version information
+ -h Help
+ -t The protocol LTP is encapsulated in. Right now, only udp, dccp, and sll are supported.
+ -b The LTP block size (NOT the bundle size) that is being used over this connection.
This information can't be determined from a packet capture, so if not specified
it defaults to is 500,000. If you set this value larger than your actual block size, the graph
- will contain empty spaces between each session, which is handy to separate sessions. However, in that case, tcptrace will report
- inaccurate, lost data statistics.
- -s requests a graph of only the specified range of sessions. Note that the session numbers are just the "session number"
+ will contain empty spaces between each session, which is handy to separate sessions. However, in
+ that case, tcptrace will report inaccurate, lost data statistics.
+ -s Requests a graph of only the specified range of sessions. Note that the session numbers are just the "session number"
from wireshark, not the whole session id.
To generate the graphs run:
- ltptrace -tudp ltp_file.dmp tcp_file.dmp
+ ltp2tcp -tudp ltp_file.dmp tcp_file.dmp
tcptrace -lGt tcp_file.dmp
xplot a2b_tsg.xpl
1)Only handles one LTP "connection". There isn't a good way to separate
different LTP "connections" from new sessions of the same "connection".
Use Tcpdump filters to separate connections. Libpcap filtering could also
- be added in ltptrace.
+ be added in ltp2tcp.
2)Uses some special types from Linux (u_char, u_int32_t)
-ltptrace is free software: you can redistribute it and/or modify
+ltp2tcp 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.
-ltptrace is distributed in the hope that it will be useful,
+ltp2tcp 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 ltptrace. If not, see <http://www.gnu.org/licenses/>.
+along with ltp2tcp. If not, see <http://www.gnu.org/licenses/>.
Samuel Jero
Internetworking Research Group
Ohio University
sj323707@ohio.edu
-2/23/2011
+6/28/2013
******************************************************************************/
#include "ltp2tcp.h"
-
+#define LTPTRACE_VERSION 0.3
+#define COPYRIGHT_YEAR 2013
int debug=0;
int MAX_SESSION=500000;
int claim2sack(const u_char* odata, int ses_id, struct ltp_hdr_d* ltph, struct tcphdr *tcph, u_char* tcpopt, int* dlen, int rbuf);
int seq_from_session(struct ltp_hdr_d* ltph, struct tcphdr *tcph);
int ack_from_session(struct ltp_hdr_d* ltph, struct tcphdr *tcph);
+void version();
+void usage();
/*Parse commandline options and open files*/
int tmp;
/*parse commandline options*/
- if(argc<4 || argc > 8){
- printf("Usage: ltp2tcp -t{encapsulation} ltp_file tcp_file [-d] [-b{block_size}]\n");
- exit(1);
+ if(argc < 2){
+ usage();
}
/*loop through commandline options*/
for(int i=1; i < argc; i++){
- if(argv[i][0]!='-'){
- if(lfile==NULL){ /*assign first non-dash argument to the ltp file*/
+ if(argv[i][0]!='-' || (argv[i][0]=='-' && strlen(argv[i])==1)){
+ if(lfile==NULL || argv[i][0]=='-'){
+ /*assign first non-dash (or only dash) argument to the dccp file*/
lfile=argv[i];
}else{
if(tfile==NULL){
tfile=argv[i]; /*assign second non-dash argument to the dccp file*/
}else{
- printf("Usage: ltp2tcp -t{encapsulation} ltp_file tcp_file [-d] [-b{block_size}]\n");
- exit(1);
+ usage();
}
}
}else{
- if(argv[i][1]=='d' && strlen(argv[i])==2){ /*debug option*/
+ if(argv[i][1]=='v' && strlen(argv[i])==2){ /*debug option*/
debug++;
}
+ if(argv[i][1]=='V' && strlen(argv[i])==2){ /*Version option*/
+ version();
+ }
+ if(argv[i][1]=='h'&& strlen(argv[i])==2){ /* help*/
+ usage();
+ }
if(argv[i][1]=='t'){ /*Encapsulation option*/
type=&argv[i][2];
}
if(tmp>0){
MAX_SESSION=tmp;
}else{
- printf("Usage: ltp2tcp -t{encapsulation} ltp_file tcp_file [-d] [-b{block_size}]\n");
- exit(1);
+ usage();
}
}
if(argv[i][1]=='s'){ /*Session range option*/
}
if(lfile==NULL || tfile==NULL || type==NULL){
- printf("Usage: ltp2tcp -t{encapsulation} ltp_file tcp_file [-d] [-b{block_size}]\n");
- exit(1);
+ usage();
}
if(state.ses_min<=0 || state.ses_max<=0){
/*all options validated*/
if(debug){
- dbgprintf(1,"Debug On\n");
dbgprintf(1,"Input file: %s\n", lfile);
dbgprintf(1,"Output file: %s\n", tfile);
dbgprintf(1,"Encapsulation: %s\n", type);
return 0;
}
+void version()
+{
+ dbgprintf(0, "ltp2tcp version %.1f\n",LTPTRACE_VERSION);
+ dbgprintf(0, "Copyright (C) %i Samuel Jero <sj323707@ohio.edu>\n",COPYRIGHT_YEAR);
+ dbgprintf(0, "This program comes with ABSOLUTELY NO WARRANTY.\n");
+ dbgprintf(0, "This is free software, and you are welcome to\n");
+ dbgprintf(0, "redistribute it under certain conditions.\n");
+ exit(0);
+}
+
+/*Usage information for program*/
+void usage()
+{
+ dbgprintf(0,"Usage: ltp2tcp -t{encapsulation} [-v] [-V] [-h] [-b{block_size}] [-s{start session}-{end session}] ltp_file tcp_file\n");
+ dbgprintf(0, " -v verbose. May be repeated for additional verbosity.\n");
+ dbgprintf(0, " -V Version information\n");
+ dbgprintf(0, " -h Help\n");
+ dbgprintf(0, " -t type of encapsulation (udp,dccp,sll)\n");
+ dbgprintf(0, " -b LTP block size (NOT the bundle size) that is being used over this connection\n");
+ dbgprintf(0, " -s Requests a graph of only the specified range of sessions\n");
+ exit(0);
+}
+
/*Debug Printf*/
void dbgprintf(int level, const char *fmt, ...)
{