diff options
Diffstat (limited to 'tests/abis/abis_test.c')
-rw-r--r-- | tests/abis/abis_test.c | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/tests/abis/abis_test.c b/tests/abis/abis_test.c index ca6daed8..ac470fc7 100644 --- a/tests/abis/abis_test.c +++ b/tests/abis/abis_test.c @@ -1,6 +1,6 @@ /* * (C) 2012 by Holger Hans Peter Freyther <zecke@selfish.org> - * (C) 2017 by sysmocom - s.m.f.c. GmbH <info@sysmocom.de> + * (C) 2017 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> * All Rights Reserved * * This program is free software; you can redistribute it and/or modify @@ -13,10 +13,6 @@ * 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 General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * */ #include <osmocom/core/application.h> @@ -171,7 +167,7 @@ static inline void chk_descr(struct msgb *msg, const char *f_id, const char *f_v } } -static void test_sw_descr() +static void test_sw_descr(void) { const char *f_id = "TEST.L0L", *f_ver = "0.1.666~deadbeeffacefeed-dirty"; uint8_t chain[] = { 0x42, 0x12, 0x00, 0x03, 0x01, 0x02, 0x03, 0x13, 0x00, 0x03, 0x03, 0x04, 0x05, 0x42, 0x12, @@ -197,6 +193,52 @@ static void test_sw_descr() msgb_free(msg); } +/* Test decode IPAC_DLCX_IND obtained from SYS#5915 */ +static void test_dec_ipac_dlc_indx(void) +{ +/* Radio Signalling Link (RSL) + 0111 111. = Message discriminator: ip.access Vendor Specific messages (63) + .... ...0 = T bit: Not considered transparent by BTS + .111 0110 = Message type: ip.access DLCX INDication (0x76) + Channel number IE + Element identifier: Channel Number (0x01) + 0000 1... = C-bits: Bm + ACCH (1) + .... .110 = Time slot number (TN): 6 + Element identifier: Connection Identifier (0xf8) + ip.access Connection ID: 0 + Element identifier: Connection Statistics (0xf6) + [1 byte length here, val = 28 (0x1c)] + Packets Sent: 1202 + Octets Sent: 45052 + Packets Received: 556 + Octets Received: 24580 + Packets Lost: 0 + Inter-arrival Jitter: 0 + Average Tx Delay: 0 + Cause IE + Element identifier: Cause (0x1a) + Length: 1 + 0... .... = Extension: No Extension + .000 .... = Class: Normal event (0) + .000 1111 = Cause Value: normal event, unspecified (15) +*/ + const uint8_t hex[] = { + 0x7e, 0x76, 0x01, 0x0e, 0xf8, 0x00, 0x00, 0xf6, 0x1c, 0x00, 0x00, 0x04, 0xb2, 0x00, 0x00, 0xaf, + 0xfc, 0x00, 0x00, 0x02, 0x2c, 0x00, 0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x01, 0x0f + }; + struct abis_rsl_dchan_hdr *dh = (struct abis_rsl_dchan_hdr *)&hex[0]; + + struct tlv_parsed tp; + int rc; + + printf("Testing decoding IPAC_DLCX_IND\n"); + + rc = rsl_tlv_parse(&tp, dh->data, sizeof(hex) - sizeof(*dh)); + + OSMO_ASSERT(rc == 3); +} + int main(int argc, char **argv) { void *ctx = talloc_named_const(NULL, 0, "abis_test"); @@ -206,6 +248,7 @@ int main(int argc, char **argv) test_simple_sw_config(); test_simple_sw_short(); test_dual_sw_config(); + test_dec_ipac_dlc_indx(); printf("OK.\n"); |