blob: 1f2c3fbdeb82adec706def826fffdc3135ee1672 [file] [log] [blame]
Holger Hans Peter Freyther9d938382013-07-31 21:59:29 +02001/* (C) 2013 by Holger Hans Peter Freyther
2 *
3 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#ifndef tests_h
21#define tests_h
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include <osmocom/core/msgb.h>
28#include <string.h>
29
30struct gprs_bssgp_pcu;
31struct tlv_parsed;
32struct msgb;
33
34struct gprs_test {
35 gprs_test(const char *name, const char *description,
36 void (*start)(struct gprs_bssgp_pcu *),
37 void (*data) (struct gprs_bssgp_pcu *, struct msgb *, struct tlv_parsed *parsed))
38 : name(name)
39 , description(description)
40 , start(start)
41 , data(data)
42 {}
43
44 const char *name;
45 const char *description;
46 void (*start)(struct gprs_bssgp_pcu *);
47 void (*data) (struct gprs_bssgp_pcu *, struct msgb *, struct tlv_parsed *);
48};
49
50void gprs_test_success(struct gprs_bssgp_pcu *);
51
52static inline struct msgb *create_msg(const uint8_t *data, size_t len)
53{
54 struct msgb *msg = msgb_alloc_headroom(4096, 128, "create msg");
55 msg->l3h = msgb_put(msg, len);
56 memcpy(msg->l3h, data, len);
57 return msg;
58}
59
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif