Commit Graph

23 Commits

Author SHA1 Message Date
Harald Welte bf85d6f433 xua: introduce xua_msg_get_u32p() helper
Change-Id: Id7780074b82bc668ae148456750b1a01799decd1
2021-02-08 18:11:12 +01:00
Harald Welte 1153675012 xua_msg: Add xua_msg*_get_str() to obtain string IE
We copy the contents to a static thread-local buffer to ensure
zero termination of the string received by a remote entity.

Change-Id: I8cbb7aeaf0cb64db0ce01c21e5fca9ab3cd932b6
2021-02-08 10:40:46 +00:00
Harald Welte 30c2edb099 xua_msg: const-ify input arguments to xua_*_get_u32()
Change-Id: I517943bd11d73195de9418fb1c5d4151dab77873
2021-02-07 12:43:47 +01:00
Harald Welte c584d87d0c xua_msg_add_data() Mark input argument as 'const'
We only read from it.

Change-Id: I12c17273b9d64a084f59d91fc06ae1512d70855b
2021-02-06 17:45:33 +01:00
Pau Espin 2221ad87f4 xua_msg: Get Rid of confusing double network byte order swap
The ipv4 addr in addr->ip.v4 is already in network byte order, as it's
usual in struct in_addr (see sua_addr_parse_part()).
So the code in there was simply calling ntohl() because
msgb_t16l16vp_put_u32() is calling htonl() on the given parameter before
storing it. Let's simply use msgb_t16l16vp_put() directly and avoid a
double byte swap which only adds confusion.

Change-Id: I70a94ee1b459d56116f0c6a6c7c3b778a939b7ea
2020-09-14 12:35:21 +02:00
Pau Espin 95e2ec698d sua: Support SUA_IEI_IPv6
Change-Id: I5bd69e8400fd2d9251b5d4edd9bf3514e1194b5a
2020-09-14 12:16:02 +02:00
Pau Espin 535e43268c xua: Avoid multiline log in xua_msg_dump()
In general we want to avoid multiline log messages since they make
parsing more difficult. Also output in VTY over telnet looks strange
(indentation incremented at each new line).

Change-Id: Id9084d0e0f976bb374186db93d6ff8062b99e238
2019-11-12 21:35:24 +00:00
Neels Hofmeyr 28c8a4bf2f add osmo_xua_msg_tall_ctx_init()
So far the tall_xua ctx used to allocate from in xua_msg_alloc() was never
initialized, actually hiding memory leaks from the talloc report.
Add this API to allow branching the xua_msg ctx off a sane root ctx.

Explicitly initialize tall_xua to NULL, so that, if xua_msg_ctx_init() isn't
called, tall_xua is still guaranteed to not be a random pointer.

osmo-bsc will use this function to hook the tall_xua ctx to osmo-bsc's own root
ctx.

Change-Id: I618878680a096a7f7fc2d83098590f2e4cb08870
2018-07-12 05:25:56 +02:00
Harald Welte b393b3f4cc Add SPDX-License-Identifier + missing copyright statements
Change-Id: I113232bbeaa7a835871df7f9b883ba573d8a2534
2017-11-13 01:25:47 +09:00
Harald Welte 1e25c3a0ac xua_msg: Add xua_from_nested() helper function for nested IEs
... and add a test case to ensure it continues to work.

Change-Id: Iee434886598b528d23ddce0490dcc782e0f5d6ae
2017-04-10 11:48:35 +02:00
Harald Welte 4881c5c169 xua: Remove library-internal DXUA log subsystem
We don't really need those thre log messages, and we can thus do away
with the library-internal log-subsystem of DXUA.  The rest of
libosmo-sigtran uses the new globa DL... subsystems anyway

Change-Id: Iea0d3db34a3674a9c6422b174a879bfdaa25786f
2017-04-10 11:48:34 +02:00
Harald Welte c96db7fa58 xua_msg: Add support for msg_event_maps
msg_event_maps facilitate the mapping from a xUA message (class + type)
to an integer event.  This is useful when passing xUA messages to a
osmo_fsm.

Change-Id: Iee1c7fc2bf64219ebb71a0dbe6fd210749332413
2017-04-10 10:41:16 +02:00
Harald Welte d75e8967ef License headers: Should always have been GPLv2-or-later
libosmo-sigtran is GPLv2-or-later, there were some files that
accidentially had an AGPLv3 license header, which was a copy+paste
mistake at that time.

Change-Id: I67dfd0ae6157afafd3873a3baaa4c6107c04ddfd
2017-04-10 10:41:16 +02:00
Harald Welte 654bed7d5e xua_msg: Add support for encoding IPv4 addr in osmo_sccp_addr
Change-Id: I956f069ce4cea78cb0db0470265ca8365093c0e5
2017-04-10 10:41:16 +02:00
Harald Welte b929e4e3e8 xua_msg: Add support for encoding Global Title in osmo_sccp_addr
Change-Id: I4668fd0fba2e1be1ec37e75eeee85ed476320d14
2017-04-10 10:41:16 +02:00
Harald Welte 6023bcae16 xua_msg: Add concept of xua_msg_class and xua_msg_dialect
A xua_msg_class repreents one xUA message class (like M3UA XFER
or SUA CL).  A dialect is then something like SUA or M3UA, each
consisting of as many as 256 message classes.  Each class contains
value_strings of the individual messages, as well as constraint
information on mandatory IEs for each message.

Change-Id: Ib538aca295b7b50132bc814b2d7b56cbe5d65bfc
2017-04-10 10:41:16 +02:00
Harald Welte 58768015ed xua_msg: Add xua_msg_free_tag() and xua_msg_copy_part()
... also, mark input to xua_msg_find_tag as 'const' pointer.

Change-Id: I083634db9c3606bcff87700f253054a38a20816d
2017-04-10 10:41:16 +02:00
Harald Welte eddeeff310 Add xua_msg_part_get_u32() to get U32 value from xua_msg_part
Sometimes one already has the xua_msg_part and thus can avoid the
lookup that's done by xua_msg_get_u32().

Change-Id: Ie11c35f9528313d0b35786a361d853addd17364f
2017-02-13 15:09:17 +01:00
Harald Welte 0dd089f17d Move xua_msg_add_sccp_addr() to xua_msg.h and export it
Change-Id: I07fa00dd71d8ecdf1542734598fab8ecad5a7b53
2017-02-13 15:09:17 +01:00
Harald Welte 222cd10c2f xua_msg: Make DXUA available to other XUA code
Change-Id: Ie5b6492ead2c523de3969134291b2c3f434f92a2
2017-02-13 15:09:17 +01:00
Harald Welte 1c43cc2918 migrate some generic XUA helpers from sua.c to xua_msg.c
Change-Id: I59e55d21a05b5d770c120da4c17220d5f21d44bd
2017-02-13 15:09:12 +01:00
Harald Welte bf49cc1c00 Import SUA (SCCP User Adaptation) and SCCP User SAP
... this code originates from the osmo-iuh repository, but is now part
of a new shared libosmo-sigtran.so library generated in this repository.
2015-12-22 23:03:41 +01:00
Holger Hans Peter Freyther 7046633c02 xua: Generalize the m2ua_msg and call it xua_msg
Generalize, this requires various API modifications
but that is the most sane path forward.
2015-03-23 12:28:06 +01:00