Commit Graph

110 Commits

Author SHA1 Message Date
Harald Welte e937532ae9 Add SCCP <-> SUA message transcoding routines
Change-Id: I8151a9b08a0b0ca97b9c73105ad4548512ce3be8
2017-04-10 11:48:34 +02:00
Harald Welte cd13b68e67 sua.c: Replace sua_msgb_alloc() with new sccp_msgb_alloc()
Change-Id: I7067a85dcc5dda66f4b17b0fe08da8cb3efe79ef
2017-04-10 11:48:34 +02:00
Harald Welte dd59a11667 sua: Extend address parsing with GT, RI and IPv4 support
Change-Id: I186df77cbdbedfe1a60b855be3626b6766f4681c
2017-04-10 11:48:23 +02:00
Harald Welte 1471dc9764 sua: Make use of xua_msg_dialect
We fill in the data structures of a xua_msg_dialect and make use of it
for generic mandatory IE checking and messageheader printing.

Change-Id: I966103f30b9be247ba6905ba8e06b87654d9981a
2017-04-10 10:41:16 +02:00
Harald Welte 2d3a709527 Add new 'osmo_ss7' SS7 core code with M3UA, ASP/AS FSM, ...
This is what aims to be a rather complete/proper implementation of the
SIGTRAN + SS7 protocol suite.  It has proper abstraction between the
layers with primitives, finite state machines for things like the AS and
ASP state machines, support for point code routing, etc.

What's not implemented at this point:
* re-integration of pre-existing SUA (pending)
* actual MTP2 and physical E1/T1 link support
* different trafic modes like broadcast/fail-over/load-balance

Change-Id: I375eb80f01acc013094851d91d1d3333ebc12bc7
2017-04-10 10:41:16 +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 0ebde0c42d sccp_helpers: Add osmo_sccp_{addr,gt}_dump() functions
They stringify a global title or SCCP address for human consumption

Change-Id: I630308aa4519c6e9a260419d37a376aac6a1ce28
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
Neels Hofmeyr e734655afb sccp_helpers: add convenience function for RANAP unitdata
Change-Id: Ie96d78512b8e3907753272d75471b882365968c4
2017-02-13 13:58:09 +00:00
Neels Hofmeyr 199b97652b sccp_helpers: add osmo_ prefix to all functions
Change-Id: I839c976f3ac722b955da18216de3df2eaa4c5af3
2017-02-13 13:58:01 +00:00
Neels Hofmeyr 81f63035ee sccp_helpers: adjust .h include and copyright
Change-Id: Id2d9a6c3e9b0928d245580895c78aa7355627adc
2017-02-13 13:57:53 +00:00
Neels Hofmeyr c07796dc3b sccp_helpers.h/.c: fix: apply rename of osmo_sua_link to osmo_sccp_link
Change-Id: If8b09bb05297ebf663b4a04d3cc094a6a8087f53
2017-02-13 13:57:44 +00:00
Neels Hofmeyr 86cfe9b3b4 Add sccp_helpers.[hc] moved from osmo-iuh, 1:1 at first
Move here unchanged first, so we're able to see the modifications in diffs.
Pending changes will follow in subsequent patches.

Moved from osmo-iuh 3da8608b6ad014fc74536dbb49019704fd425b8c, which was before
the rename of osmo_sua_link and osmo_sua_user to osmo_sccp_link and
osmo_sccp_user, so this will not compile.

Change-Id: Iae0c58c5f1eb00a685de70add0d5257e4316c6d5
2017-02-13 13:57:29 +00:00
Harald Welte 0c72c1c0d3 Start to log + handle SCTP notifications
Change-Id: Ie00c4fc65c66e55262e2db084826084dcaf34b91
2017-01-27 22:14:27 +00:00
Neels Hofmeyr 1f94c07ed2 fix: use proper disconnect prim param type
For the N-DISCONNECT prim, parse CREF, RLC and RLSD from the proper parameter
struct type: osmo_scu_disconn_param instead of osmo_scu_connect_param.

Before this, the conn_id ended up in the wrong place and the other side always
received a zero conn_id.

Tested only for the RLSD case, which fixes Iu-Release message evaluation for
all except the very first SUA conn received by the CN components.

In all three cases, set:

* param->responding_addr to conn->called_addr.
* param->originator to OSMO_SCCP_ORIG_UNDEFINED.

Change-Id: I446f2fe57cc3b7c52723f3ab82836513a5d37752
2017-01-27 09:59:31 +01:00
Neels Hofmeyr 6075f6ad51 cosmetic: sua.c: comments
Add some human readable names.

Change-Id: If4aa15aae8b03c764a45b866a751eb3fbabebec1
2017-01-27 09:59:31 +01:00
Neels Hofmeyr eddf138666 parse SCCP src+dst addresses
In order to receive a Paging command with a valid RANAP SSN, decode the SCCP
source and destination address IEs. This is used by hnbgw to forward a Paging
from CN to RNC.

This may be done more generally as soon as more IEs need parsing of their sub
parts. For now, iterate the higher level IE's data chunk and obtain the address
sub part IEs without storing sub part locations.

Change-Id: I03d0c2a9003fda59c5b88c8738df009c30fbc11c
2017-01-27 09:59:31 +01:00
Neels Hofmeyr b79a61de9a remove two compiler warnings for unused variables
Change-Id: I173dc67050d907f9b09b99265af9dee9d142ace3
2017-01-27 09:59:31 +01:00
Neels Hofmeyr db3a4bb5a5 SUA COIT: send dest ref nr, not dest addr
See RFC 3868 3.3.11
https://tools.ietf.org/html/rfc3868#section-3.3.11

Change-Id: I083384876d4a8d7fa9c03409fbdc9e00e3c8f416
2017-01-27 09:59:30 +01:00
Harald Welte b5f0d1c9bc sua: Ensure that a SUA client will continuously try to reconnect
Change-Id: Ic05a2b78e29e4ede214a3395430ef54bacd84e60
2017-01-27 09:59:30 +01:00
Harald Welte 32a1d54279 sua: call conn_disconnect() in sua_disconnect_req()
disconnect is not a class3/4 operation. We simply generate + send the
DISCONNECT.ind message to the remote side and drop all local state about the
connection.

Change-Id: I4e336f9dfd4ebd0122cd9e5a70db3d05e9dc1764
2017-01-27 09:59:30 +01:00
Harald Welte edfab6fdf5 sua: Fix typo in log message
Change-Id: I13bb0e2f4ec688fefd9b98d6d2389562e2a2dad7
2017-01-27 09:59:30 +01:00
Harald Welte 452b87285b allow user to give private data to osmo_sua_user_create()
... which can be resolved from the primitive call back prim_cb() by
calling osmo_sccp_link_get_user_priv().

Change-Id: If4c0f96f0621fb2adf4c78dc5994d3398431d92f
2017-01-27 09:59:06 +01:00
Neels Hofmeyr 26bcc0b9c4 fix NULL deref: sua_accept_cb: missing error-return
When server creation failed, besides closing the fd also return an error,
instead of continuing to use the NULL srv.

Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577
Fixes: coverity CID#57684
2016-12-12 10:59:20 +00:00
Neels Hofmeyr 8fab8413bf NULL safety: sccp_create_sccp_addr: copy only non-NULL sock->gti
presumably, sock->gti_len is always zero when sock->gti is NULL, but ensure
with a check and make coverity scan happy.

Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428
Fixes: coverity CID#57683
2016-12-11 21:24:59 +01:00
Harald Welte dfb4d91892 sua: Remove unused 'cur' variables
There are some compiler warnings about other unused variables which we
rather keep as a reminder that the SUA code is partially incomplete and
should be finished at some day.

Change-Id: I42b76351f1bbdfb7fe339d5fad98c5a065822a45
2016-11-11 15:40:06 +01:00
Neels Hofmeyr 03ad002c28 cosmetic: rename osmo_sua_link and osmo_sua_user to osmo_sccp_*
hwelte requested this change for the addition of libiu in openbsc. In a
conversation we came to the conclusion that a rename of these two opaque
structs would suffice.

This is the "upstream" rename and will require adaptation of:

* the sysmocom/iu branch in this repository
* the iu related branches in openbsc.git
* the hnbgw and dummy_cn code in osmo-iuh.git

See https://gerrit.osmocom.org/#/c/192/2/openbsc/src/libiu/iu.c@57

Change-Id: Icbf64dd96f8e0e27695df73d1144519b88360b94
2016-07-06 15:55:02 +02:00
Neels Hofmeyr e076bf2107 fix log msg typo, x5
Change-Id: I00ff99ef14d62d3b353fe69762ae49f374938f94
Reviewed-on: https://gerrit.osmocom.org/265
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-14 22:19:11 +00:00
Neels Hofmeyr 1a698a537d clarify fixme comment, x7
The fixme is about an actual message sent back, not about the error log.

Change-Id: I6de8fb202c7beb025232e9b97605e9f46778506a
Reviewed-on: https://gerrit.osmocom.org/228
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
2016-06-14 10:36:23 +00:00
Ruben Undheim 5a1abeb02a Fix for big-endian architectures 2016-02-12 21:18:27 +01:00
Alexander Huemer 7438165b6c fix build if depenedencies are in distinct directories 2015-12-24 16:13:16 +01:00
Harald Welte ec86dcdc2f sccp.c: Fix compiler warnings about size_t / %u 2015-12-22 23:24:27 +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 a9c411ec8c sccp: Allow to specify the context of the incoming message
At the time a SCCP CREF is sent there is no context anymore
and the user of the API might not know where to return the
message to. Allow to specify the incoming context and use it
on the way out.

There are no more callers of _send_msg which passes a NULL
connection and a NULL context.
2015-06-15 09:40:43 +02: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
Holger Hans Peter Freyther 4d244d3c31 XUA: Move m2ua headers to sigtran, create xua_types.h and m3ua_types.h
Begin with type definitions for m3ua
2015-03-23 11:06:51 +01:00
Alexander Huemer 7925409b35 Makefile.am: Use AM_CPPFLAGS
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-06-12 07:56:31 +02:00
Holger Hans Peter Freyther b01178898f sccp: Create sccp_create_cr and use it in the connection creation
The data is optional in the in the CR msg so we have to check if the
msgb is NULL or not.
2013-04-10 16:17:14 +02:00
Holger Hans Peter Freyther 0b0dda7e4b misc: Use a unsigned result for the sizeof sizes
Avoid comparing unsigned/signed values with the msgb. In practice
our messages are way lower than this would would matter though.
2013-04-10 16:17:13 +02:00
Holger Hans Peter Freyther 84406e2779 sccp: Make sccp_write take an additional local context
For connection less data there is no way to pass a per context
data for outgoing data, add one.
2011-06-04 16:55:50 +02:00
Harald Welte d35a3079df namespace: use osmo_static_assert() instead of static_assert() 2011-05-08 09:43:49 +02:00
Harald Welte 2d97000f98 Update include paths with libosmocore 0.2.0 2011-03-23 18:30:22 +01:00