* of the GNU General Public License.
*/
+#define IPQUAD(x) ((byte*)&(x))[0], ((byte*)&(x))[1], ((byte*)&(x))[2], ((byte*)&(x))[3]
+
/* link.c */
extern struct pkt_stats stat_link_dwarf, stat_link_in, stat_link_unknown, stat_link_arp;
/* tcp.c */
extern struct pkt_stats stat_tcp_in, stat_tcp_invalid, stat_tcp_badsum, stat_tcp_unmatched,
- stat_tcp_on_closed;
+ stat_tcp_on_closed, stat_tcp_bad_state;
+extern uns cnt_tcp_flows, cnt_tcp_causes[], tcp_num_flows, tcp_max_flows;
+
+/* config switches */
+extern uns tcp_arrival_times;
+extern uns tcp_wait_for_ack;
struct pipe {
list queue; /* incoming packets */
u32 last_acked_seq; /* last sequence number for which I sent ACK */
u32 syn_or_fin_seq; /* sequence number of SYN/FIN I sent */
+ u32 queue_start_seq; /* sequence number expected at the start of the queue */
enum { /* very simplified TCP state machine */
FLOW_IDLE,
FLOW_SYN_SENT, /* sent SYN, waiting for SYN ACK */
FLOW_FIN_SENT, /* sent FIN, waiting for its ACK */
FLOW_FINISHED /* closed, ignoring further packets */
} state;
- struct pkt_stats stat_in;
+ struct pkt_stats stat;
};
struct flow {
struct appl_hooks *appl;
void *appl_data;
struct pipe pipe[2];
+ struct pkt_stats stat_raw;
+ uns cnt_unexpected;
};
enum close_cause {
CAUSE_CLOSE,
CAUSE_RESET,
CAUSE_TIMEOUT,
- CAUSE_DOOMSDAY
+ CAUSE_DOOMSDAY,
+ CAUSE_CORRUPT,
+ CAUSE_MAX
};
+extern byte *flow_state_names[];
+extern byte *flow_cause_names[], *flow_cause_names_short[];
+
struct appl_hooks {
void (*open)(struct flow *f, u64 when);
- void (*input)(struct flow *f, int dir, struct pkt *p); /* dir0 = sent by initiator */
+ void (*input)(struct flow *f, int dir, struct pkt *p); /* dir0 = sent by initiator, pkt_len(p)==0 for close */
void (*close)(struct flow *f, int cause, u64 when);
};
struct iphdr;
void tcp_init(void);
-void tcp_cleanup(void);
+void tcp_cleanup(u64 timestamp);
void tcp_got_packet(struct iphdr *iph, struct pkt *p);
+extern struct appl_hooks *tcp_default_appl;
+
/* save.c */
-extern struct appl_hooks appl_save, appl_asave;
+extern struct appl_hooks appl_sink, appl_save, appl_asave, appl_summary;
extern uns asave_width;
+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;
+
+/* histogram.c */
+
+void histogram_init(byte *name);
+void histogram_add_stat(byte *name, struct pkt_stats *stat);
+void histogram_add_int(byte *name, int *var);
+void histogram_step(uns time);
+void histogram_cleanup(void);