head 1.7; access; symbols; locks mouse:1.7; strict; comment @ * @; 1.7 date 2010.02.26.06.30.17; author mouse; state Exp; branches; next 1.6; 1.6 date 2010.02.25.15.15.28; author mouse; state Exp; branches; next 1.5; 1.5 date 2010.02.25.15.11.28; author mouse; state Exp; branches; next 1.4; 1.4 date 2010.02.25.02.44.44; author mouse; state Exp; branches; next 1.3; 1.3 date 2010.02.18.03.11.54; author mouse; state Exp; branches; next 1.2; 1.2 date 2010.02.16.16.11.33; author mouse; state Exp; branches; next 1.1; 1.1 date 2010.02.16.06.29.42; author mouse; state Exp; branches; next ; desc @structs.h @ 1.7 log @Add -stamp, to get timestamps in the output. @ text @#ifndef _STRUCTS_H_e20822ec_ #define _STRUCTS_H_e20822ec_ #include #include #include typedef enum { OBT_EOF = 1, OBT_DATA } OBTYPE; typedef enum { END_L = 1, END_B } ENDIAN; typedef struct conn CONN; typedef struct flow FLOW; typedef struct oblk OBLK; typedef struct exprep EXPREP; typedef struct extinfo EXTINFO; typedef struct extdef EXTDEF; struct extdef { const char *name; int (*match)(const char *, int); void (*request)(FLOW *, FILE *); void (*event)(FLOW *, FILE *); void (*error)(FLOW *, FILE *); } ; struct extinfo { EXTINFO *link; EXTDEF *def; unsigned char opcode; unsigned char eventbase; unsigned char errorbase; } ; struct exprep { EXPREP *link; unsigned int seq; void (*fn)(FLOW *, FILE *, void *); void *arg; } ; struct oblk { OBLK *link; OBTYPE type; union { struct { const unsigned char *b; int l; int p; unsigned char *tofree; } data; } ; } ; struct flow { CONN *conn; const char *dir; int srcbits; int dstbits; int srcfd; int dstfd; unsigned char *ibuf; int iballoc; int ibfill; int ibfull; void *getpriv; void (*readdone)(FLOW *); OBLK *oq; OBLK **oqt; struct timeval stamp_tv; } ; struct conn { CONN *flink; CONN *blink; FILE *out; unsigned int serial; unsigned int flags; #define CF_EOF_C 0x00000001 #define CF_EOF_X 0x00000002 #define CF_BIGREQ 0x00000004 #define CF_EOF_BOTH (CF_EOF_C|CF_EOF_X) #define CF_C (CF_EOF_C) #define CF_X (CF_EOF_X) #define CF_EOF (CF_EOF_C|CF_EOF_X) unsigned int maxreq; int client_fd; int client_px; int X_fd; int X_px; struct tm laststamp_tm; char *remstr; FLOW ctox; FLOW xtoc; ENDIAN endian; unsigned int reqseq; EXPREP *repq; EXPREP **repqt; void *atoms; EXTINFO *extensions; unsigned char ext_opc_tbl[128]; EXTINFO **ext_opc_vec; unsigned char ext_ev_tbl[64]; EXTINFO **ext_ev_vec; unsigned char ext_err_tbl[128]; EXTINFO **ext_err_vec; #define TBL_NONE 255 #define TBL_UNK 254 } ; #endif @ 1.6 log @User interface stuff: - remove -sync, which does nothing (inherited from xxscope) - Add -o, which puts output in a named file - Add -split, which puts each connection's output in its own file - Add -fork, which causes it to fork-and-exit once startup succeeds - Add -pid, which makes it print its PID - Add -idle, which makes it exit as soon as it has no live connections once it has ever had a live connection. -fork, -pid, and -hunt play nice together; if -hunt and -pid are both used, -hunt output appears first. -pid and -hunt are specifically designed to work well with shell backquotes; if output is going to a file (or files, with -split), stdout is closed once -pid and/or -hunt output has been printed. @ text @d1 2 a2 2 #ifndef _STRUCTS_H_9c841739_ #define _STRUCTS_H_9c841739_ d4 1 d6 1 d76 1 d97 1 @ 1.5 log @Remove unused CF_PLEASEZAP flag bit. @ text @d1 2 a2 2 #ifndef _STRUCTS_H_a67aaaa5_ #define _STRUCTS_H_a67aaaa5_ d79 1 @ 1.4 log @Add checking that all bytes in packets are accounted for and none used multiple times with inconsistent sizes. This should catch most of the worst of botched packet parsing bugs. @ text @d1 2 a2 2 #ifndef _STRUCTS_H_e8b29b59_ #define _STRUCTS_H_e8b29b59_ d81 3 a83 4 #define CF_PLEASEZAP 0x00000001 #define CF_EOF_C 0x00000002 #define CF_EOF_X 0x00000004 #define CF_BIGREQ 0x00000008 @ 1.3 log @Add BIG-REQUESTS support. Builds, but, until I find a way to deliberately do huge requests, untested. @ text @d1 2 a2 2 #ifndef _STRUCTS_H_f1e604b4_ #define _STRUCTS_H_f1e604b4_ d70 1 @ 1.2 log @New extension framework. No extensions actually implemented yet. @ text @d83 1 d88 1 @ 1.1 log @Initial revision @ text @d1 2 a2 2 #ifndef _STRUCTS_H_caf5334e_ #define _STRUCTS_H_caf5334e_ d20 18 d99 9 @