blob: 18b4b830e92cf641de8f3d85d2cdfaf2a9897b3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// parser/parser.h
// main parser file
#include "fight_results.h"
// "generic" type for parsed data
typedef struct {
enum { FIGHT_RESULTS } data_type;
union {
FightResults fight_results;
} data;
} ParsedData;
// parse a stream of TCP data
// params:
// - stream - the stream to parse
// - stream_len - length of the stream to parse
// - parsed_len - pointer to inform how much of the stream was parsed (not all if e.g. start of data is there, but the end isn't yet)
// returns:
// pointer to the array of parsed data
extern ParsedData *parse_stream(char *stream, int stream_len, int *parsed_len);
|