summaryrefslogtreecommitdiffstats
path: root/src/roof-read.h
blob: 1ab846a51582de78b05ad0c2b86fa27159ea2c24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef __ROOF_READ_H
#define __ROOF_READ_H

typedef struct _RoofRead RoofRead;

#include "roof-config.h"

G_BEGIN_DECLS

typedef struct _RoofReadContext RoofReadContext;
typedef struct _RoofReadInterface RoofReadInterface;
typedef struct _RoofReadInterfaceSettings RoofReadInterfaceSettings;

typedef guint (*RoofReaderRead)(RoofReadInterface *reader, uint8_t **buf, GError **error);
typedef void (*RoofReaderClose)(RoofReadInterface *reader);

struct _RoofReadInterfaceSettings {
    guint	padding;		// Packet size + padding
};

struct _RoofReadInterface {
    RoofReaderRead		read;
    RoofReaderClose		close;

    RoofReadInterfaceSettings	settings;
};

struct _RoofReadContext {
    RoofConfig		*cfg;
    RoofReadInterface 	*rdi;

    void                *rdbuf;         // The buffer we are currently processing
    guint		n_packets;	// Number of packets in the buffer
    guint 		packet_id;	// Last processed packet in the buffer
    guint 		fragment_id;    // Last processed fragment in the packet
};

RoofReadContext *roof_read_context_new(RoofConfig *cfg, RoofReadInterface *rdi, GError **error);
void roof_read_context_free(RoofReadContext *ctx);
const RoofReadInterfaceSettings *roof_read_get_settings(UFORoofRead *ctx, GError **error);


G_END_DECLS

#endif /* __ROOF_READ_H */