blob: 4ad7431edd19252104853de91f4e353188127044 [file] [log] [blame]
Harald Welte3b6fb082016-04-25 18:46:22 +02001#include <string.h>
2
3#include <osmocom/core/logging.h>
4#include <osmocom/core/utils.h>
5#include <osmocom/core/application.h>
6#include <osmocom/gsm/gsup.h>
7
8#define VERBOSE_FPRINTF(...)
9
10/* Tests for osmo_gsup_messages.c */
11
12#define TEST_IMSI_IE 0x01, 0x08, 0x21, 0x43, 0x65, 0x87, 0x09, 0x21, 0x43, 0xf5
13#define TEST_IMSI_STR "123456789012345"
14
15static void test_gsup_messages_dec_enc(void)
16{
17 int test_idx;
18 int rc;
19 uint8_t buf[1024];
20
21 static const uint8_t send_auth_info_req[] = {
22 0x08,
23 TEST_IMSI_IE
24 };
25
26 static const uint8_t send_auth_info_err[] = {
27 0x09,
28 TEST_IMSI_IE,
29 0x02, 0x01, 0x07 /* GPRS no allowed */
30 };
31
32 static const uint8_t send_auth_info_res[] = {
33 0x0a,
34 TEST_IMSI_IE,
35 0x03, 0x22, /* Auth tuple */
36 0x20, 0x10,
37 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
38 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
39 0x21, 0x04,
40 0x21, 0x22, 0x23, 0x24,
41 0x22, 0x08,
42 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
43 0x03, 0x22, /* Auth tuple */
44 0x20, 0x10,
45 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
46 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
47 0x21, 0x04,
48 0xa1, 0xa2, 0xa3, 0xa4,
49 0x22, 0x08,
50 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
51 };
52
53 static const uint8_t update_location_req[] = {
54 0x04,
55 TEST_IMSI_IE,
56 };
57
58 static const uint8_t update_location_err[] = {
59 0x05,
60 TEST_IMSI_IE,
61 0x02, 0x01, 0x07 /* GPRS no allowed */
62 };
63
64 static const uint8_t update_location_res[] = {
65 0x06,
66 TEST_IMSI_IE,
67 0x08, 0x07, /* MSISDN of the subscriber */
68 0x91, 0x94, 0x61, 0x46, 0x32, 0x24, 0x43,
69 0x09, 0x07, /* HLR-Number of the subscriber */
70 0x91, 0x83, 0x52, 0x38, 0x48, 0x83, 0x93,
71 0x04, 0x00, /* PDP info complete */
Holger Hans Peter Freythereb55c0d2017-07-07 16:53:30 +020072 0x05, 0x19,
Harald Welte3b6fb082016-04-25 18:46:22 +020073 0x10, 0x01, 0x01,
74 0x11, 0x02, 0xf1, 0x21, /* IPv4 */
75 0x12, 0x09, 0x04, 't', 'e', 's', 't', 0x03, 'a', 'p', 'n',
76 0x13, 0x01, 0x02,
Holger Hans Peter Freythereb55c0d2017-07-07 16:53:30 +020077 0x14, 0x02, 0xFF, 0x23,
Harald Welte3b6fb082016-04-25 18:46:22 +020078 0x05, 0x11,
79 0x10, 0x01, 0x02,
80 0x11, 0x02, 0xf1, 0x21, /* IPv4 */
81 0x12, 0x08, 0x03, 'f', 'o', 'o', 0x03, 'a', 'p', 'n',
Holger Hans Peter Freythereb55c0d2017-07-07 16:53:30 +020082 0x14, 0x02,
83 0xAE, 0xFF
Harald Welte3b6fb082016-04-25 18:46:22 +020084 };
85
86 static const uint8_t location_cancellation_req[] = {
87 0x1c,
88 TEST_IMSI_IE,
89 0x06, 0x01, 0x00,
90 };
91
92 static const uint8_t location_cancellation_err[] = {
93 0x1d,
94 TEST_IMSI_IE,
95 0x02, 0x01, 0x03 /* Illegal MS */
96 };
97
98 static const uint8_t location_cancellation_res[] = {
99 0x1e,
100 TEST_IMSI_IE,
101 };
102
103 static const uint8_t purge_ms_req[] = {
104 0x0c,
105 TEST_IMSI_IE,
106 };
107
108 static const uint8_t purge_ms_err[] = {
109 0x0d,
110 TEST_IMSI_IE,
111 0x02, 0x01, 0x03, /* Illegal MS */
112 };
113
114 static const uint8_t purge_ms_res[] = {
115 0x0e,
116 TEST_IMSI_IE,
117 0x07, 0x00,
118 };
119
Neels Hofmeyrabb23692017-02-21 15:53:20 +0100120 static const uint8_t send_auth_info_res_umts[] = {
121 0x0a,
122 TEST_IMSI_IE,
123 0x03, 0x62, /* Auth tuple */
124 0x20, 0x10, /* rand */
125 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
126 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
127 0x21, 0x04, /* sres */
128 0x21, 0x22, 0x23, 0x24,
129 0x22, 0x08, /* kc */
130 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
131 0x23, 0x10, /* IK (UMTS) */
132 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
133 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
134 0x24, 0x10, /* CK (UMTS) */
135 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
136 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
137 0x25, 0x10, /* AUTN (UMTS) */
138 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
139 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
Neels Hofmeyrbd9de2f2017-02-21 20:17:35 +0100140 0x27, 0x08, /* RES (UMTS) */
Neels Hofmeyrabb23692017-02-21 15:53:20 +0100141 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
Neels Hofmeyrbd9de2f2017-02-21 20:17:35 +0100142 0x03, 0x62, /* Auth tuple */
Neels Hofmeyrabb23692017-02-21 15:53:20 +0100143 0x20, 0x10, /* rand */
144 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
145 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0x10,
146 0x21, 0x04, /* sres */
147 0xb1, 0xb2, 0xb3, 0xb4,
148 0x22, 0x08, /* kc */
149 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,
150 0x23, 0x10, /* IK (UMTS) */
151 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
152 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xd0,
153 0x24, 0x10, /* CK (UMTS) */
154 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
155 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xe0,
156 0x25, 0x10, /* AUTN (UMTS) */
157 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
158 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0xf0,
Neels Hofmeyrbd9de2f2017-02-21 20:17:35 +0100159 0x27, 0x08, /* RES (UMTS) */
Neels Hofmeyrabb23692017-02-21 15:53:20 +0100160 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
161 };
162
163 static const uint8_t send_auth_info_req_auts[] = {
164 0x08,
165 TEST_IMSI_IE,
Neels Hofmeyrbd9de2f2017-02-21 20:17:35 +0100166 0x26, 0x0e, /* AUTS (UMTS) */
Neels Hofmeyrabb23692017-02-21 15:53:20 +0100167 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
168 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
Neels Hofmeyrbd9de2f2017-02-21 20:17:35 +0100169 0x20, 0x10, /* rand */
Neels Hofmeyrabb23692017-02-21 15:53:20 +0100170 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
171 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
172 };
173
Vadim Yanitskiy72696042018-04-07 02:34:55 +0700174 static const uint8_t dummy_session_ies[] = {
175 0x2b, /* Dummy value, we only interested in IE coding */
176 TEST_IMSI_IE,
177
178 /* Session ID and state */
179 0x30, 0x04, 0xde, 0xad, 0xbe, 0xef,
180 0x31, 0x01, 0x01,
181 };
182
Vadim Yanitskiy36c7b332018-03-31 05:23:09 +0700183 static const uint8_t send_ussd_req[] = {
184 0x20, /* OSMO_GSUP_MSGT_PROC_SS_REQUEST */
185 TEST_IMSI_IE,
186
187 /* Session ID and state */
188 0x30, 0x04, 0xde, 0xad, 0xbe, 0xef,
189 0x31, 0x01, 0x01,
190
191 /* SS/USSD information IE */
192 0x35, 0x14,
193 /* ASN.1 encoded MAP payload */
194 0xa1, 0x12,
195 0x02, 0x01, /* Component: invoke */
196 0x01, /* invokeID = 1 */
197 /* opCode: processUnstructuredSS-Request */
198 0x02, 0x01, 0x3b, 0x30, 0x0a, 0x04, 0x01, 0x0f,
199 0x04, 0x05, 0xaa, 0x18, 0x0c, 0x36, 0x02,
200 };
201
202 static const uint8_t send_ussd_res[] = {
203 0x22, /* OSMO_GSUP_MSGT_PROC_SS_RESULT */
204 TEST_IMSI_IE,
205
206 /* Session ID and state */
207 0x30, 0x04, 0xde, 0xad, 0xbe, 0xef,
208 0x31, 0x01, 0x03,
209
210 /* SS/USSD information IE */
211 0x35, 0x08,
212 /* ASN.1 encoded MAP payload */
213 0xa3, 0x06,
214 0x02, 0x01, /* Component: returnError */
215 0x01, /* invokeID = 1 */
216 /* localValue: unknownAlphabet */
217 0x02, 0x01, 0x47,
218 };
219
Vadim Yanitskiyc2628312018-09-25 23:03:13 +0700220 static const uint8_t send_mo_forward_sm_req[] = {
221 0x24, /* OSMO_GSUP_MSGT_MO_FORWARD_SM_REQUEST */
222 TEST_IMSI_IE,
223
224 /* SM related IEs */
225 0x40, 0x01, /* SM-RP-MR (Message Reference) */
226 0xfa,
227 0x41, 0x08, /* SM-RP-DA (Destination Address) */
228 0x03, /* SMSC address */
229 0x91, 0x52, 0x75, 0x47, 0x99, 0x09, 0x82,
230 0x42, 0x01, /* SM-RP-OA (Originating Address) */
231 0xff, /* Special case: noSM-RP-OA */
232 0x43, 0x04, /* SM-RP-UI (TPDU) */
233 0xde, 0xad, 0xbe, 0xef,
234 };
235
236 static const uint8_t send_mt_forward_sm_req[] = {
237 0x28, /* OSMO_GSUP_MSGT_MT_FORWARD_SM_REQUEST */
238 TEST_IMSI_IE,
239
240 /* SM related IEs */
241 0x40, 0x01, /* SM-RP-MR (Message Reference) */
242 0xfa,
243 0x41, 0x09, /* SM-RP-DA (Destination Address) */
244 0x01, /* IMSI */
245 0x21, 0x43, 0x65, 0x87, 0x09, 0x21, 0x43, 0xf5,
246 0x42, 0x08, /* SM-RP-OA (Originating Address) */
247 0x03, /* SMSC address */
248 0x91, 0x52, 0x75, 0x47, 0x99, 0x09, 0x82,
249 0x43, 0x04, /* SM-RP-UI (TPDU) */
250 0xde, 0xad, 0xbe, 0xef,
251 0x45, 0x01, /* SM-RP-MMS (More Messages to Send) */
252 0x01,
253 };
254
255 static const uint8_t send_mo_mt_forward_sm_err[] = {
256 0x25, /* OSMO_GSUP_MSGT_MO_FORWARD_SM_ERROR */
257 TEST_IMSI_IE,
258
Vadim Yanitskiyc2628312018-09-25 23:03:13 +0700259 /* SM related IEs */
260 0x40, 0x01, /* SM-RP-MR (Message Reference) */
261 0xfa,
262 0x44, 0x01, /* SM-RP-Cause value */
263 0xaf,
264 };
265
266 static const uint8_t send_mo_mt_forward_sm_rsp[] = {
267 0x2a, /* OSMO_GSUP_MSGT_MT_FORWARD_SM_RESULT */
268 TEST_IMSI_IE,
269
270 /* SM related IEs */
271 0x40, 0x01, /* SM-RP-MR (Message Reference) */
272 0xfa,
273 0x43, 0x04, /* SM-RP-UI (TPDU) */
274 0xde, 0xad, 0xbe, 0xef,
275 };
276
Vadim Yanitskiyf9ee8da2018-11-13 02:06:15 +0700277 static const uint8_t send_ready_for_sm_ind[] = {
278 0x2c, /* OSMO_GSUP_MSGT_READY_FOR_SM_REQUEST */
279 TEST_IMSI_IE,
280
281 /* SM related IEs */
282 0x46, 0x01, /* Alert reason */
283 0x02, /* Memory Available (SMMA) */
284 };
285
Oliver Smith10db2812018-12-14 16:14:34 +0100286 static const uint8_t send_check_imei_req[] = {
287 0x30, /* OSMO_GSUP_MSGT_CHECK_IMEI_REQUEST */
288 TEST_IMSI_IE,
289
290 /* imei */
291 0x50, 0x09,
292 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42,
293 };
294
295 static const uint8_t send_check_imei_err[] = {
296 0x31, /* OSMO_GSUP_MSGT_CHECK_IMEI_ERROR */
297 TEST_IMSI_IE,
298
299 /* cause */
300 0x02, 0x01,
301 0x60, /* GMM_CAUSE_INV_MAND_INFO */
302 };
303
304 static const uint8_t send_check_imei_res[] = {
305 0x32, /* OSMO_GSUP_MSGT_CHECK_IMEI_RESULT */
306 TEST_IMSI_IE,
307
308 /* imei_result */
309 0x51, 0x01,
310 0x00, /* OSMO_GSUP_IMEI_RESULT_ACK */
311 };
312
Harald Welte3b6fb082016-04-25 18:46:22 +0200313 static const struct test {
314 char *name;
315 const uint8_t *data;
316 size_t data_len;
317 } test_messages[] = {
318 {"Send Authentication Info Request",
319 send_auth_info_req, sizeof(send_auth_info_req)},
320 {"Send Authentication Info Error",
321 send_auth_info_err, sizeof(send_auth_info_err)},
322 {"Send Authentication Info Result",
323 send_auth_info_res, sizeof(send_auth_info_res)},
324 {"Update Location Request",
325 update_location_req, sizeof(update_location_req)},
326 {"Update Location Error",
327 update_location_err, sizeof(update_location_err)},
328 {"Update Location Result",
329 update_location_res, sizeof(update_location_res)},
330 {"Location Cancellation Request",
331 location_cancellation_req, sizeof(location_cancellation_req)},
332 {"Location Cancellation Error",
333 location_cancellation_err, sizeof(location_cancellation_err)},
334 {"Location Cancellation Result",
335 location_cancellation_res, sizeof(location_cancellation_res)},
336 {"Purge MS Request",
337 purge_ms_req, sizeof(purge_ms_req)},
338 {"Purge MS Error",
339 purge_ms_err, sizeof(purge_ms_err)},
340 {"Purge MS Result",
341 purge_ms_res, sizeof(purge_ms_res)},
Neels Hofmeyrabb23692017-02-21 15:53:20 +0100342 {"Send Authentication Info Result with IK, CK, AUTN and RES (UMTS)",
Neels Hofmeyrbd9de2f2017-02-21 20:17:35 +0100343 send_auth_info_res_umts, sizeof(send_auth_info_res_umts)},
Neels Hofmeyrabb23692017-02-21 15:53:20 +0100344 {"Send Authentication Info Request with AUTS and RAND (UMTS)",
345 send_auth_info_req_auts, sizeof(send_auth_info_req_auts)},
Vadim Yanitskiy72696042018-04-07 02:34:55 +0700346 {"Dummy message with session IEs",
347 dummy_session_ies, sizeof(dummy_session_ies)},
Vadim Yanitskiy36c7b332018-03-31 05:23:09 +0700348 {"SS/USSD processUnstructuredSS-Request / Invoke",
349 send_ussd_req, sizeof(send_ussd_req)},
350 {"SS/USSD processUnstructuredSS-Request / ReturnResult",
351 send_ussd_res, sizeof(send_ussd_res)},
Vadim Yanitskiyc2628312018-09-25 23:03:13 +0700352 {"MO-ForwardSM (MSC -> SMSC) Request",
353 send_mo_forward_sm_req, sizeof(send_mo_forward_sm_req)},
354 {"MT-ForwardSM (MSC -> SMSC) Request",
355 send_mt_forward_sm_req, sizeof(send_mt_forward_sm_req)},
356 {"MO-/MT-ForwardSM Response",
357 send_mo_mt_forward_sm_rsp, sizeof(send_mo_mt_forward_sm_rsp)},
358 {"MO-/MT-ForwardSM Error",
359 send_mo_mt_forward_sm_err, sizeof(send_mo_mt_forward_sm_err)},
Vadim Yanitskiyf9ee8da2018-11-13 02:06:15 +0700360 {"ReadyForSM (MSC -> SMSC) Indication",
361 send_ready_for_sm_ind, sizeof(send_ready_for_sm_ind)},
Oliver Smith10db2812018-12-14 16:14:34 +0100362 {"Check IMEI Request",
363 send_check_imei_req, sizeof(send_check_imei_req)},
364 {"Check IMEI Error",
365 send_check_imei_err, sizeof(send_check_imei_err)},
366 {"Check IMEI Result",
367 send_check_imei_res, sizeof(send_check_imei_res)},
Harald Welte3b6fb082016-04-25 18:46:22 +0200368 };
369
370 printf("Test GSUP message decoding/encoding\n");
371
372 for (test_idx = 0; test_idx < ARRAY_SIZE(test_messages); test_idx++) {
373 const struct test *t = &test_messages[test_idx];
374 struct osmo_gsup_message gm = {0};
375 struct msgb *msg = msgb_alloc(4096, "gsup_test");
Max49382722018-01-22 15:15:06 +0100376 bool passed = true;
Harald Welte3b6fb082016-04-25 18:46:22 +0200377
378 printf(" Testing %s\n", t->name);
379
380 rc = osmo_gsup_decode(t->data, t->data_len, &gm);
Max49382722018-01-22 15:15:06 +0100381 if (rc < 0)
382 passed = false;
Harald Welte3b6fb082016-04-25 18:46:22 +0200383
Max80f4c4e2018-01-24 12:33:05 +0100384 rc = osmo_gsup_encode(msg, &gm);
385 if (rc < 0)
386 passed = false;
Harald Welte3b6fb082016-04-25 18:46:22 +0200387
388 fprintf(stderr, " generated message: %s\n", msgb_hexdump(msg));
389 fprintf(stderr, " original message: %s\n", osmo_hexdump(t->data, t->data_len));
390 fprintf(stderr, " IMSI: %s\n", gm.imsi);
Harald Welte3b6fb082016-04-25 18:46:22 +0200391
Max49382722018-01-22 15:15:06 +0100392 if (strcmp(gm.imsi, TEST_IMSI_STR) != 0 ||
393 msgb_length(msg) != t->data_len ||
394 memcmp(msgb_data(msg), t->data, t->data_len) != 0)
395 passed = false;
396
397 if (passed)
398 printf(" %s OK\n", t->name);
399 else
400 printf(" %s FAILED: %d<%s> [%u,%u,%zu,%u]\n",
401 t->name, rc, strerror(-rc),
402 strcmp(gm.imsi, TEST_IMSI_STR),
403 msgb_length(msg), t->data_len,
404 memcmp(msgb_data(msg), t->data, t->data_len));
Harald Welte3b6fb082016-04-25 18:46:22 +0200405 msgb_free(msg);
406 }
407
408 /* simple truncation test */
409 for (test_idx = 0; test_idx < ARRAY_SIZE(test_messages); test_idx++) {
410 int j;
411 const struct test *t = &test_messages[test_idx];
412 int ie_end = t->data_len;
413 struct osmo_gsup_message gm = {0};
414 int counter = 0;
415 int parse_err = 0;
416
417 for (j = t->data_len - 1; j >= 0; --j) {
418 rc = osmo_gsup_decode(t->data, j, &gm);
419 counter += 1;
420
421 VERBOSE_FPRINTF(stderr,
422 " partial message decoding: "
423 "orig_len = %d, trunc = %d, rc = %d, ie_end = %d\n",
424 t->data_len, j, rc, ie_end);
425 if (rc >= 0) {
426 VERBOSE_FPRINTF(stderr,
427 " remaing partial message: %s\n",
428 osmo_hexdump(t->data + j, ie_end - j));
429
430 OSMO_ASSERT(j <= ie_end - 2);
Oliver Smith19742402018-12-21 10:18:28 +0100431 OSMO_ASSERT(t->data[j+0] < _OSMO_GSUP_IEI_END_MARKER);
Harald Welte3b6fb082016-04-25 18:46:22 +0200432 OSMO_ASSERT(t->data[j+1] <= ie_end - j - 2);
433
434 ie_end = j;
435 } else {
436 parse_err += 1;
437 }
438 }
439
440 fprintf(stderr,
441 " message %d: tested %d truncations, %d parse failures\n",
442 test_idx, counter, parse_err);
443 }
444
Neels Hofmeyrbd9de2f2017-02-21 20:17:35 +0100445 /* Don't log thousands of message modification errors */
446 LOGP(DLGSUP, LOGL_NOTICE, "Stopping DLGSUP logging\n");
447 log_set_category_filter(osmo_stderr_target, DLGSUP, 0, 0);
448
Harald Welte3b6fb082016-04-25 18:46:22 +0200449 /* message modification test (relies on ASAN or valgrind being used) */
450 for (test_idx = 0; test_idx < ARRAY_SIZE(test_messages); test_idx++) {
451 int j;
452 const struct test *t = &test_messages[test_idx];
453 struct osmo_gsup_message gm = {0};
454 uint8_t val;
455 int counter = 0;
456 int parse_err = 0;
457
458 OSMO_ASSERT(sizeof(buf) >= t->data_len);
459
460 for (j = t->data_len - 1; j >= 0; --j) {
461 memcpy(buf, t->data, t->data_len);
462 val = 0;
463 do {
464 VERBOSE_FPRINTF(stderr,
465 "t = %d, len = %d, val = %d\n",
466 test_idx, j, val);
467 buf[j] = val;
468 rc = osmo_gsup_decode(buf, t->data_len, &gm);
469 counter += 1;
470 if (rc < 0)
471 parse_err += 1;
472
473 val += 1;
474 } while (val != (uint8_t)256);
475 }
476
477 fprintf(stderr,
478 " message %d: tested %d modifications, %d parse failures\n",
479 test_idx, counter, parse_err);
480 }
481}
482
483const struct log_info_cat default_categories[] = {
Harald Welte3b6fb082016-04-25 18:46:22 +0200484};
485
486static struct log_info info = {
487 .cat = default_categories,
488 .num_cat = ARRAY_SIZE(default_categories),
489};
490
491int main(int argc, char **argv)
492{
Neels Hofmeyra829b452018-04-05 03:02:35 +0200493 void *ctx = talloc_named_const(NULL, 0, "gsup_test");
494 osmo_init_logging2(ctx, &info);
Neels Hofmeyrbd9de2f2017-02-21 20:17:35 +0100495 log_set_print_filename(osmo_stderr_target, 0);
496 log_set_print_timestamp(osmo_stderr_target, 0);
497 log_set_use_color(osmo_stderr_target, 0);
498 log_set_print_category(osmo_stderr_target, 1);
Harald Welte3b6fb082016-04-25 18:46:22 +0200499
500 test_gsup_messages_dec_enc();
501
502 printf("Done.\n");
503 return EXIT_SUCCESS;
504}