debugcode

This commit is contained in:
Arnout Engelen
2004-09-17 23:31:56 +00:00
parent 08f83c4435
commit efb6667488
3 changed files with 19 additions and 2 deletions

View File

@@ -42,7 +42,7 @@ connection.o: connection.cpp connection.h nethogs.h
hashtbl.o: hashtbl.cpp hashtbl.h nethogs.h hashtbl.o: hashtbl.cpp hashtbl.h nethogs.h
$(GCC) $(CFLAGS) -c hashtbl.cpp $(GCC) $(CFLAGS) -c hashtbl.cpp
decpcap.o: decpcap.c decpcap.h decpcap.o: decpcap.c decpcap.h
gcc $(CFLAGS) -c decpcap.c gcc-3.3 $(CFLAGS) -c decpcap.c
cui.o: cui.cpp cui.h nethogs.h cui.o: cui.cpp cui.h nethogs.h
$(GCC) $(CFLAGS) -c cui.cpp -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" $(GCC) $(CFLAGS) -c cui.cpp -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"

View File

@@ -30,6 +30,19 @@ struct dp_handle * dp_open_live(char * device, int snaplen, int promisc, int to_
retval->linktype = pcap_datalink(retval->pcap_handle); retval->linktype = pcap_datalink(retval->pcap_handle);
switch (retval->linktype) {
case (DLT_EN10MB):
std::cout << 'Ethernet link detected\n";
break;
case (DLT_PPP):
std::cout << 'PPP link detected\n";
break;
default:
std::cout << 'No PPP or Ethernet link: " << retval->linktype << std::endl;
// TODO maybe error? or 'other' callback?
break;
}
return retval; return retval;
} }
@@ -76,6 +89,7 @@ void dp_parse_ip (struct dp_handle * handle, const dp_header * header, const u_c
break; break;
default: default:
// TODO // TODO
break;
} }
} }
@@ -98,6 +112,7 @@ void dp_parse_ip6 (struct dp_handle * handle, const dp_header * header, const u_
break; break;
default: default:
// TODO // TODO
break;
} }
} }
@@ -128,6 +143,7 @@ void dp_parse_ethernet (struct dp_handle * handle, const dp_header * header, con
break; break;
default: default:
// TODO // TODO
break;
} }
} }
@@ -173,6 +189,7 @@ void dp_parse_ppp (struct dp_handle * handle, const dp_header * header, const u_
break; break;
default: default:
// TODO // TODO
break;
} }
} }

View File

@@ -30,7 +30,7 @@
#define NEEDROOT 1 #define NEEDROOT 1
#endif #endif
#define DEBUG 0 #define DEBUG 1
// if '0', do extra checks and // if '0', do extra checks and
// assertions. good for finding bugs // assertions. good for finding bugs