]> mj.ucw.cz Git - netgrind.git/commitdiff
Added HTTP analyser.
authorMartin Mares <mj@ucw.cz>
Sun, 8 Jun 2003 12:31:48 +0000 (12:31 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 8 Jun 2003 12:31:48 +0000 (12:31 +0000)
netgrind/Makefile
netgrind/ip.c
netgrind/netgrind.c
netgrind/netgrind.h
netgrind/pkt.c
netgrind/pkt.h
netgrind/save.c
netgrind/tcp.c

index 5f0bd0fabb7fa91a35d606608b6913ee1c85f13d..a176ff4540606e3dde68bae38879f9c517a5ed7d 100644 (file)
@@ -1,6 +1,6 @@
 DIRS+=netgrind
 PROGS+=obj/netgrind/netgrind
-NG_OBJS=netgrind.o pkt.o link.o ip.o tcp.o save.o
+NG_OBJS=netgrind.o pkt.o link.o ip.o tcp.o save.o http.o
 
 obj/netgrind/netgrind: $(addprefix obj/netgrind/,$(NG_OBJS)) $(LIBSH)
 obj/netgrind/netgrind: LIBS+=-lpcap
index 2368eada9a7d05db2f320ee9fa115434944b08ea..b021335cfb090a8e1464bbaed3fccaec2d758cf8 100644 (file)
@@ -17,6 +17,7 @@
 
 uns tcpip_calc_checksum(void *data, uns len, uns csum)
 {
+  /* FIXME: This is awfully slow and it probably consumes most of our run time */
   byte *x = data;
 
   while (len >= 2)
index e46dd3a8f2593fc90f9139ba40a929bf0cf6a9f4..233d293f49772060dbcecab99f09ede73e47af0a 100644 (file)
@@ -43,7 +43,7 @@ static void mux_open(struct flow *f, u64 when)
 
   if (dport == 80 || dport == 8080 || dport == 8081 || dport == 3128)
     {
-      appl = &appl_asave;
+      appl = &appl_http;
       save_dir = "flows";
     }
   f->appl = appl;
index 2f53adf2a367e444846ffbefc7bba2e608356bab..db766a89e786af1b856f2bd5c28812c343e94f31 100644 (file)
@@ -93,3 +93,10 @@ extern byte *save_dir;
 void sink_open(struct flow *f, u64 when);
 void sink_close(struct flow *f, int cause, u64 when);
 void sink_input(struct flow *f, int dir, struct pkt *p);
+
+#define TIMESTAMP_LEN 32
+void format_timestamp(byte *buf, u64 time);
+
+/* http.c */
+
+extern struct appl_hooks appl_http;
index ad0c21c63920b97f887f22ee3c55072b530d90e9..1e46084e85333f56997c7dfd62c37ff847696683 100644 (file)
@@ -25,3 +25,13 @@ void pkt_free(struct pkt *p)
 {
   xfree(p);
 }
+
+void pkt_flush_queue(list *l)
+{
+  struct pkt *p;
+  while (p = list_head(l))
+    {
+      list_remove(&p->n);
+      pkt_free(p);
+    }
+}
index 0a6afd5b2ed5207cdb5071907d91672cf784347f..559836c3207d2c266b4bb0adde332a2ba767831d 100644 (file)
@@ -62,6 +62,7 @@ static inline byte *pkt_unappend(struct pkt *p, uns len)
 
 struct pkt *pkt_new(uns preroom, uns postroom);
 void pkt_free(struct pkt *pkt);
+void pkt_flush_queue(list *l);
 
 struct pkt_stats {
   u64 packets;
index 56d496ec4c4649cddac742d48bbc78ea46a5f005..4a0be0da0df6022ef7bef02c8408ddf8d36e5943 100644 (file)
@@ -19,8 +19,7 @@
 
 byte *save_dir;
 
-#define TIMESTAMP_LEN 32
-static void format_timestamp(byte *buf, u64 time)
+void format_timestamp(byte *buf, u64 time)
 {
   struct tm *tm;
   time_t t = time / 1000000;
index e78cb64c3578bd67cc05662a2d92cc1bcde17d93..b90838d513c32fbe591f6cd375963c6f0653c0bc 100644 (file)
@@ -160,14 +160,7 @@ static void tcp_time_step(uns now, uns doomsday)
          f->appl->close(f, cause, now_to_timestamp(now));
        }
       for (uns i=0; i<2; i++)
-       {
-         struct pkt *p;
-         while (p = list_head(&f->pipe[i].queue))
-           {
-             list_remove(&p->n);
-             pkt_free(p);
-           }
-       }
+       pkt_flush_queue(&f->pipe[i].queue);
       uns h = flow_calc_hash(f->saddr, f->daddr, f->sport, f->dport);
       struct flow **gg = &flow_hash[h];
       for(;;)