blob: 49b7eefa3c63593ec2c25be03125a6fd62b15441 [file] [log] [blame]
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +01001/*
2 * (C) 2011 by Holger Hans Peter Freyther
3 * (C) 2011 by On-Waves
4 * All Rights Reserved
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 */
21
Holger Hans Peter Freytheraf723a42012-12-26 10:51:00 +010022#include <osmocom/core/application.h>
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +010023#include <osmocom/core/logging.h>
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +000024#include <osmocom/core/utils.h>
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +010025#include <osmocom/gsm/lapdm.h>
26#include <osmocom/gsm/rsl.h>
27
28#include <errno.h>
29
30#include <string.h>
31
32#define CHECK_RC(rc) \
33 if (rc != 0) { \
34 printf("Operation failed rc=%d on %s:%d\n", rc, __FILE__, __LINE__); \
35 abort(); \
36 }
37
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +010038static struct log_info info = {};
39
40struct lapdm_polling_state {
41 struct lapdm_channel *bts;
42 int bts_read;
43
44 struct lapdm_channel *ms;
45 int ms_read;
46};
47
48static struct msgb *msgb_from_array(const uint8_t *data, int len)
49{
50 struct msgb *msg = msgb_alloc_headroom(4096, 128, "data");
51 msg->l3h = msgb_put(msg, len);
52 memcpy(msg->l3h, data, len);
53 return msg;
54}
55
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +010056/*
57 * Test data is below...
58 */
59static const uint8_t cm[] = {
60 0x05, 0x24, 0x31, 0x03, 0x50, 0x18, 0x93, 0x08,
61 0x29, 0x47, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80,
62};
63
64static const uint8_t cm_padded[] = {
65 0x05, 0x24, 0x31, 0x03, 0x50, 0x18, 0x93, 0x08,
66 0x29, 0x47, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80,
67 0x2b, 0x2b, 0x2b, 0x2b
68};
69
Andreas Eversberg6e182082013-02-06 14:13:21 +010070static const uint8_t ua[] = {
71 0x01, 0x73, 0x41, 0x05, 0x24, 0x31, 0x03, 0x50,
72 0x18, 0x93, 0x08, 0x29, 0x47, 0x80, 0x00, 0x00,
73 0x00, 0x00, 0x80, 0x2b, 0x2b, 0x2b, 0x2b
74};
75
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +010076static const uint8_t mm[] = {
Holger Hans Peter Freyther3a5f08c2012-01-12 23:12:28 +010077 0x00, 0x0c, 0x00, 0x03, 0x01, 0x01, 0x20, 0x02,
78 0x00, 0x0b, 0x00, 0x03, 0x05, 0x04, 0x0d
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +010079};
80
81static const uint8_t dummy1[] = {
82 0xab, 0x03, 0x30, 0x60, 0x06,
83};
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +010084
Daniel Willmanne5233922012-12-25 23:15:50 +010085static const uint8_t rel_req[] = {
86 0x02, 0x07, 0x01, 0x0a, 0x02, 0x40, 0x14, 0x01
87};
88
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +010089static struct msgb *create_cm_serv_req(void)
90{
91 struct msgb *msg;
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +010092
93 msg = msgb_from_array(cm, sizeof(cm));
94 rsl_rll_push_l3(msg, RSL_MT_EST_REQ, 0, 0, 1);
95 return msg;
96}
97
98static struct msgb *create_mm_id_req(void)
99{
100 struct msgb *msg;
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100101
102 msg = msgb_from_array(mm, sizeof(mm));
Holger Hans Peter Freyther3a5f08c2012-01-12 23:12:28 +0100103 msg->l2h = msg->data + 3;
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000104 OSMO_ASSERT(msgb_l2len(msg) == 12);
Holger Hans Peter Freyther3a5f08c2012-01-12 23:12:28 +0100105 msg->l3h = msg->l2h + 6;
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000106 OSMO_ASSERT(msgb_l3len(msg) == 6);
Holger Hans Peter Freyther3a5f08c2012-01-12 23:12:28 +0100107
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100108 return msg;
109}
110
Holger Hans Peter Freyther90656db2012-01-13 05:49:29 +0800111static struct msgb *create_empty_msg(void)
112{
113 struct msgb *msg;
114
115 msg = msgb_from_array(NULL, 0);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000116 OSMO_ASSERT(msgb_l3len(msg) == 0);
Holger Hans Peter Freyther90656db2012-01-13 05:49:29 +0800117 rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, 0, 0, 1);
118 return msg;
119}
120
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100121static struct msgb *create_dummy_data_req(void)
122{
123 struct msgb *msg;
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100124
125 msg = msgb_from_array(dummy1, sizeof(dummy1));
126 rsl_rll_push_l3(msg, RSL_MT_DATA_REQ, 0, 0, 1);
127 return msg;
128}
129
Daniel Willmanne5233922012-12-25 23:15:50 +0100130static struct msgb *create_rel_req(void)
131{
132 struct msgb *msg;
133
134 msg = msgb_from_array(rel_req, sizeof(rel_req));
135 msg->l2h = msg->data;
136 msg->l3h = msg->l2h + sizeof(struct abis_rsl_rll_hdr);
137 return msg;
138}
139
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100140static int send(struct msgb *in_msg, struct lapdm_channel *chan)
141{
142 struct osmo_phsap_prim pp;
143 struct msgb *msg;
144 int rc;
145
146 msg = msgb_alloc_headroom(128, 64, "PH-DATA.ind");
147 osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_DATA,
148 PRIM_OP_INDICATION, msg);
149 /* copy over actual MAC block */
150 msg->l2h = msgb_put(msg, msgb_l2len(in_msg));
151 memcpy(msg->l2h, in_msg->l2h, msgb_l2len(in_msg));
152
153 /* LAPDm requires those... */
154 pp.u.data.chan_nr = 0;
155 pp.u.data.link_id = 0;
156 /* feed into the LAPDm code of libosmogsm */
157 rc = lapdm_phsap_up(&pp.oph, &chan->lapdm_dcch);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000158 OSMO_ASSERT(rc == 0 || rc == -EBUSY);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100159 return 0;
160}
161
Andreas Eversberg6e182082013-02-06 14:13:21 +0100162static int send_sabm(struct lapdm_channel *chan, int second_ms)
163{
164 struct osmo_phsap_prim pp;
165 struct msgb *msg;
166 int rc;
167
168 msg = msgb_alloc_headroom(128, 64, "PH-DATA.ind");
169 osmo_prim_init(&pp.oph, SAP_GSM_PH, PRIM_PH_DATA,
170 PRIM_OP_INDICATION, msg);
171 /* copy over actual MAC block */
172 msg->l2h = msgb_put(msg, 23);
173 msg->l2h[0] = 0x01;
174 msg->l2h[1] = 0x3f;
175 msg->l2h[2] = 0x01 | (sizeof(cm) << 2);
176 memcpy(msg->l2h + 3, cm_padded, sizeof(cm_padded));
177 msg->l2h[3] += second_ms; /* alter message, for second mobile */
178
179 /* LAPDm requires those... */
180 pp.u.data.chan_nr = 0;
181 pp.u.data.link_id = 0;
182 /* feed into the LAPDm code of libosmogsm */
183 rc = lapdm_phsap_up(&pp.oph, &chan->lapdm_dcch);
184 OSMO_ASSERT(rc == 0 || rc == -EBUSY);
185 return 0;
186}
187
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100188/*
189 * I get called from the LAPDm code when something was sent my way...
190 */
191static int bts_to_ms_tx_cb(struct msgb *in_msg, struct lapdm_entity *le, void *_ctx)
192{
193 struct lapdm_polling_state *state = _ctx;
194
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100195
196 printf("%s: MS->BTS(us) message %d\n", __func__, msgb_length(in_msg));
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +0100197
198
199 if (state->bts_read == 0) {
200 printf("BTS: Verifying CM request.\n");
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000201 OSMO_ASSERT(msgb_l3len(in_msg) == ARRAY_SIZE(cm_padded));
202 OSMO_ASSERT(memcmp(in_msg->l3h, cm_padded,
203 ARRAY_SIZE(cm_padded)) == 0);
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +0100204 } else if (state->bts_read == 1) {
205 printf("BTS: Verifying dummy message.\n");
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000206 OSMO_ASSERT(msgb_l3len(in_msg) == ARRAY_SIZE(dummy1));
207 OSMO_ASSERT(memcmp(in_msg->l3h, dummy1,
208 ARRAY_SIZE(dummy1)) == 0);
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +0100209 } else {
210 printf("BTS: Do not know to verify: %d\n", state->bts_read);
211 }
212
213 state->bts_read += 1;
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100214 msgb_free(in_msg);
215
216 return 0;
217}
218
219static int ms_to_bts_l1_cb(struct osmo_prim_hdr *oph, void *_ctx)
220{
221 int rc;
222 struct lapdm_polling_state *state = _ctx;
223 printf("%s: MS(us) -> BTS prim message\n", __func__);
224
225 /* i stuff it into the LAPDm channel of the BTS */
226 rc = send(oph->msg, state->bts);
227 msgb_free(oph->msg);
Holger Hans Peter Freytheraf723a42012-12-26 10:51:00 +0100228 return rc;
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100229}
230
231static int ms_to_bts_tx_cb(struct msgb *msg, struct lapdm_entity *le, void *_ctx)
232{
233 struct lapdm_polling_state *state = _ctx;
234
235 printf("%s: BTS->MS(us) message %d\n", __func__, msgb_length(msg));
236
237 if (state->ms_read == 0) {
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +0100238 struct abis_rsl_rll_hdr hdr;
239
240 printf("MS: Verifying incoming primitive.\n");
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000241 OSMO_ASSERT(msg->len == sizeof(struct abis_rsl_rll_hdr) + 3);
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +0100242
243 /* verify the header */
244 memset(&hdr, 0, sizeof(hdr));
245 rsl_init_rll_hdr(&hdr, RSL_MT_EST_CONF);
246 hdr.c.msg_discr |= ABIS_RSL_MDISC_TRANSP;
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000247 OSMO_ASSERT(memcmp(msg->data, &hdr, sizeof(hdr)) == 0);
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +0100248
249 /* Verify the added RSL_IE_L3_INFO but we have a bug here */
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000250 OSMO_ASSERT(msg->data[6] == RSL_IE_L3_INFO);
Holger Hans Peter Freyther4a075f82011-12-12 00:41:25 +0100251 #warning "RSL_IE_L3_INFO 16 bit length is wrong"
252 /* ASSERT(msg->data[7] == 0x0 && msg->data[8] == 0x9c); */
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +0100253 /* this should be 0x0 and 0x0... but we have a bug */
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100254 } else if (state->ms_read == 1) {
Holger Hans Peter Freyther3a5f08c2012-01-12 23:12:28 +0100255 printf("MS: Verifying incoming MM message: %d\n", msgb_l3len(msg));
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000256 OSMO_ASSERT(msgb_l3len(msg) == 3);
257 OSMO_ASSERT(memcmp(msg->l3h, &mm[12], msgb_l3len(msg)) == 0);
Holger Hans Peter Freyther15f740c2011-12-12 00:29:50 +0100258 } else {
259 printf("MS: Do not know to verify: %d\n", state->ms_read);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100260 }
261
262 state->ms_read += 1;
263 msgb_free(msg);
264 return 0;
265}
266
267static void test_lapdm_polling()
268{
269 printf("I do some very simple LAPDm test.\n");
270
271 int rc;
272 struct lapdm_polling_state test_state;
273 struct osmo_phsap_prim pp;
274
275 /* Configure LAPDm on both sides */
276 struct lapdm_channel bts_to_ms_channel;
277 struct lapdm_channel ms_to_bts_channel;
278 memset(&bts_to_ms_channel, 0, sizeof(bts_to_ms_channel));
279 memset(&ms_to_bts_channel, 0, sizeof(ms_to_bts_channel));
280
281 memset(&test_state, 0, sizeof(test_state));
282 test_state.bts = &bts_to_ms_channel;
283 test_state.ms = &ms_to_bts_channel;
284
285 /* BTS to MS in polling mode */
286 lapdm_channel_init(&bts_to_ms_channel, LAPDM_MODE_BTS);
287 lapdm_channel_set_flags(&bts_to_ms_channel, LAPDM_ENT_F_POLLING_ONLY);
288 lapdm_channel_set_l1(&bts_to_ms_channel, NULL, &test_state);
289 lapdm_channel_set_l3(&bts_to_ms_channel, bts_to_ms_tx_cb, &test_state);
290
291 /* MS to BTS in direct mode */
292 lapdm_channel_init(&ms_to_bts_channel, LAPDM_MODE_MS);
293 lapdm_channel_set_l1(&ms_to_bts_channel, ms_to_bts_l1_cb, &test_state);
294 lapdm_channel_set_l3(&ms_to_bts_channel, ms_to_bts_tx_cb, &test_state);
295
296 /*
297 * We try to send messages from the MS to the BTS to the MS..
298 */
299 /* 1. Start with MS -> BTS, BTS should have a pending message */
300 printf("Establishing link.\n");
301 lapdm_rslms_recvmsg(create_cm_serv_req(), &ms_to_bts_channel);
302
303 /* 2. Poll on the BTS for sending out a confirmation */
304 printf("\nConfirming\n");
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000305 OSMO_ASSERT(test_state.bts_read == 1);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100306 rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
307 CHECK_RC(rc);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000308 OSMO_ASSERT(pp.oph.msg->data == pp.oph.msg->l2h);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100309 send(pp.oph.msg, &ms_to_bts_channel);
310 msgb_free(pp.oph.msg);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000311 OSMO_ASSERT(test_state.ms_read == 1);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100312
313 /* 3. Send some data to the MS */
314 printf("\nSending back to MS\n");
315 lapdm_rslms_recvmsg(create_mm_id_req(), &bts_to_ms_channel);
316 rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
317 CHECK_RC(rc);
318 send(pp.oph.msg, &ms_to_bts_channel);
319 msgb_free(pp.oph.msg);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000320 OSMO_ASSERT(test_state.ms_read == 2);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100321
322 /* verify that there is nothing more to poll */
323 rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000324 OSMO_ASSERT(rc < 0);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100325
326 /* 3. And back to the BTS */
327 printf("\nSending back to BTS\n");
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000328 OSMO_ASSERT(test_state.ms_read == 2);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100329 lapdm_rslms_recvmsg(create_dummy_data_req(), &ms_to_bts_channel);
330
331
Holger Hans Peter Freyther3a5f08c2012-01-12 23:12:28 +0100332 /* 4. And back to the MS, but let's move data/l2h apart */
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000333 OSMO_ASSERT(test_state.bts_read == 2);
334 OSMO_ASSERT(test_state.ms_read == 2);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100335 rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
336 CHECK_RC(rc);
337 send(pp.oph.msg, &ms_to_bts_channel);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000338 OSMO_ASSERT(test_state.ms_read == 2);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100339 msgb_free(pp.oph.msg);
340
341 /* verify that there is nothing more to poll */
342 rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000343 OSMO_ASSERT(rc < 0);
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100344
Holger Hans Peter Freyther90656db2012-01-13 05:49:29 +0800345 /* check sending an empty L3 message fails */
346 rc = lapdm_rslms_recvmsg(create_empty_msg(), &bts_to_ms_channel);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000347 OSMO_ASSERT(rc == -1);
348 OSMO_ASSERT(test_state.ms_read == 2);
Holger Hans Peter Freyther90656db2012-01-13 05:49:29 +0800349
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100350 /* clean up */
351 lapdm_channel_exit(&bts_to_ms_channel);
352 lapdm_channel_exit(&ms_to_bts_channel);
353}
354
Daniel Willmanne5233922012-12-25 23:15:50 +0100355static void test_lapdm_early_release()
356{
357 printf("I test RF channel release of an unestablished channel.\n");
358
359 int rc;
360 struct lapdm_polling_state test_state;
361
362 /* Configure LAPDm on both sides */
363 struct lapdm_channel bts_to_ms_channel;
364 memset(&bts_to_ms_channel, 0, sizeof(bts_to_ms_channel));
365
366 memset(&test_state, 0, sizeof(test_state));
367 test_state.bts = &bts_to_ms_channel;
368
369 /* BTS to MS in polling mode */
370 lapdm_channel_init(&bts_to_ms_channel, LAPDM_MODE_BTS);
371 lapdm_channel_set_flags(&bts_to_ms_channel, LAPDM_ENT_F_POLLING_ONLY);
372 lapdm_channel_set_l1(&bts_to_ms_channel, NULL, &test_state);
373 lapdm_channel_set_l3(&bts_to_ms_channel, bts_to_ms_tx_cb, &test_state);
374
375 /* Send the release request */
376 rc = lapdm_rslms_recvmsg(create_rel_req(), &bts_to_ms_channel);
Katerina Barone-Adesi008e53b2013-03-03 10:36:52 +0000377 OSMO_ASSERT(rc == -EINVAL);
Daniel Willmanne5233922012-12-25 23:15:50 +0100378
379 /* clean up */
380 lapdm_channel_exit(&bts_to_ms_channel);
381}
382
Andreas Eversberg6e182082013-02-06 14:13:21 +0100383static void test_lapdm_contention_resolution()
384{
385 printf("I test contention resultion by having two mobiles collide and "
386 "first mobile repeating SABM.\n");
387
388 int rc;
389 struct lapdm_polling_state test_state;
390 struct osmo_phsap_prim pp;
391
392 /* Configure LAPDm on both sides */
393 struct lapdm_channel bts_to_ms_channel;
394 memset(&bts_to_ms_channel, 0, sizeof(bts_to_ms_channel));
395
396 memset(&test_state, 0, sizeof(test_state));
397 test_state.bts = &bts_to_ms_channel;
398
399 /* BTS to MS in polling mode */
400 lapdm_channel_init(&bts_to_ms_channel, LAPDM_MODE_BTS);
401 lapdm_channel_set_flags(&bts_to_ms_channel, LAPDM_ENT_F_POLLING_ONLY);
402 lapdm_channel_set_l1(&bts_to_ms_channel, NULL, &test_state);
403 lapdm_channel_set_l3(&bts_to_ms_channel, bts_to_ms_tx_cb, &test_state);
404
405 /* Send SABM MS 1, we must get UA */
406 send_sabm(&bts_to_ms_channel, 0);
407 rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
408 CHECK_RC(rc);
409 OSMO_ASSERT(memcmp(pp.oph.msg->l2h, ua, ARRAY_SIZE(ua)) == 0);
410
411 /* Send SABM MS 2, we must get nothing, due to collision */
412 send_sabm(&bts_to_ms_channel, 1);
413 rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
414 OSMO_ASSERT(rc == -ENODEV);
415
416 /* Send SABM MS 1 again, we must get UA gain */
417 send_sabm(&bts_to_ms_channel, 0);
418 rc = lapdm_phsap_dequeue_prim(&bts_to_ms_channel.lapdm_dcch, &pp);
419 CHECK_RC(rc);
420 OSMO_ASSERT(memcmp(pp.oph.msg->l2h, ua, ARRAY_SIZE(ua)) == 0);
421
422 /* clean up */
423 lapdm_channel_exit(&bts_to_ms_channel);
424}
425
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100426int main(int argc, char **argv)
427{
428 osmo_init_logging(&info);
429
430 test_lapdm_polling();
Daniel Willmanne5233922012-12-25 23:15:50 +0100431 test_lapdm_early_release();
Andreas Eversberg6e182082013-02-06 14:13:21 +0100432 test_lapdm_contention_resolution();
Holger Hans Peter Freyther72bd4eb2011-12-11 20:25:12 +0100433 printf("Success.\n");
434
435 return 0;
436}