aboutsummaryrefslogtreecommitdiffstats
path: root/tests/emu/gprs_tests.h
blob: 1f2c3fbdeb82adec706def826fffdc3135ee1672 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* (C) 2013 by Holger Hans Peter Freyther
 *
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef tests_h
#define tests_h

#ifdef __cplusplus
extern "C" {
#endif

#include <osmocom/core/msgb.h>
#include <string.h>

struct gprs_bssgp_pcu;
struct tlv_parsed;
struct msgb;

struct gprs_test {
	gprs_test(const char *name, const char *description,
			void (*start)(struct gprs_bssgp_pcu *),
			void (*data) (struct gprs_bssgp_pcu *, struct msgb *, struct tlv_parsed *parsed))
		: name(name)
		, description(description)
		, start(start)
		, data(data)
	{}

	const char *name;
	const char *description;
	void (*start)(struct gprs_bssgp_pcu *);
	void (*data) (struct gprs_bssgp_pcu *, struct msgb *, struct tlv_parsed *);
};

void gprs_test_success(struct gprs_bssgp_pcu *);

static inline struct msgb *create_msg(const uint8_t *data, size_t len)
{
	struct msgb *msg = msgb_alloc_headroom(4096, 128, "create msg");
	msg->l3h = msgb_put(msg, len);
	memcpy(msg->l3h, data, len);
	return msg;
}


#ifdef __cplusplus
}
#endif

#endif