summaryrefslogtreecommitdiff
path: root/include/gsmd/extrsp.h
blob: 1f6e6a55d81f4482cdea77ac30cd12047b26e1f4 (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 _GSMD_EXTRSP_H
#define _GSMD_EXTRSP_H

/* how many tokens (CSV items) can an extended response have, max */
#define GSM_EXTRSP_MAX_TOKENS	16

/* how many individual sub-ranges can one range contain */
#define GSM_EXTRSP_MAX_RANGES	16


struct gsm_extrsp_range_item {
	int min;
	int max;
};

enum gsm_extrsp_tok_type {
	GSMD_ECMD_RTT_NONE,
	GSMD_ECMD_RTT_EMPTY,
	GSMD_ECMD_RTT_NUMERIC,
	GSMD_ECMD_RTT_STRING,
	GSMD_ECMD_RTT_RANGE,
};

struct gsm_extrsp_tok {
	enum gsm_extrsp_tok_type type;
	union {
		struct {
			struct gsm_extrsp_range_item item[GSM_EXTRSP_MAX_RANGES];
			int num_items;
		} range;
		char string[64];
		int numeric;
	} u;
};

struct gsm_extrsp {
	unsigned int num_tokens;
	struct gsm_extrsp_tok tokens[GSM_EXTRSP_MAX_TOKENS];
};

extern int extrsp_supports(const struct gsm_extrsp *er, int index, int value);
extern struct gsm_extrsp *extrsp_parse(const void *ctx, const char *input);
extern void extrsp_dump(const struct gsm_extrsp *er);

#endif
personal git repositories of Harald Welte. Your mileage may vary