Commit Graph

25 Commits

Author SHA1 Message Date
Neels Hofmeyr e4a77d4673 add osmo_sccp_user_name()
There is a naming dilemma: though the osmo_ prefix is now reserved for
libosmocore, all surrounding API already has the osmo_ prefix.

This will be used by osmo-hnbgw's VTY 'show cnlink' command.

Change-Id: Ib7abf69cfcf4c56273223054b280458451e6c2f6
2017-12-24 20:32:03 +01:00
Harald Welte 769e9354ab sccp_sap.h: Fix SSN for BSSAP and BSSAP-LE
* BSSAP is 254 on both MSC and BSC side: Add missing define
* BSSAP-LE (LCS Extension) has 250/251, adjust name to add -LE suffix

Change-Id: Iccec75cfc0cf16bd717a9bd4606d1e772c332ccc
2017-09-03 21:20:32 +02:00
Philipp Maier 3219e52dcf sccp: fixup for osmo_sccp_get_ss7()
osmo_sccp_get_ss7() has the risk of a nullpointer dereference, when
sccp is NULL.

Return NULL when the sccp instance is NULL.

Add doxygen comment

Change-Id: I84d484e4441fd37443fff8c67e17df8fb15d5b2e
2017-08-11 17:49:38 +02:00
Philipp Maier c34bcd42e4 sccp: function to get sccp instance from sccp user
It is currently impossible to find out which SCCP instance handles
a particular user.

Introduce function to lookup the SCCP instance from a given SCCP
user.

Change-Id: I9562c4f1d00e2ebb3252c5dea598b643aa393719
2017-08-11 17:42:35 +02:00
Neels Hofmeyr 603e065f43 add osmo_sccp_addr_name() and three value_string[]s
osmo_sccp_addr_dump() just prints the raw values. In osmo_sccp_addr_name(), use
osmo_ss7_pointcode_print() and newly added RI, SSN and GT value_string[] to
print more human readable log output.

Change-Id: Ie1aedd7894acd69ddc887cd65a8a0df4b888838c
2017-08-09 13:54:44 +02:00
Neels Hofmeyr c881c49127 introduce OSMO_SCCP_RI_NONE to indicate unset RI
Allows to automatically set an RI in future change
I75c67d289693f1c2a049ac61cf2b2097d6e5687d
"sccp-addr vty: set RI to SSN_PC when setting a point-code"

Change-Id: I6e2f31b023b08cba2f2ee8234e6108efcaca41c0
2017-08-09 13:54:44 +02:00
Philipp Maier 81a029a4e4 sccp: add function to check sccp addresses
In order to catch invalid CS7 configurations, It is necessary
to check if sccp addresses contain plausible address data.

Change-Id: Ic6245288b0171eae10aa708403c1ddb584c92f38
2017-08-09 09:53:35 +00:00
Philipp Maier 882f340b6c sccp: derive local address from given sccp instance
The most important parts of an SCCP address are the routing
indicator and the pointcode. The latter one is always available
via the SS7 instance, so a basic local address can be derived
from there.

Add function osmo_sccp_local_addr_by_instance() to derive a basic
local SCCP address from a given SCCP instance

Change-Id: I371dc9132871aad3d8321ea13cf9fd69d76eff8f
2017-08-01 11:08:05 +00:00
Philipp Maier 9fc351de69 sccp: global addressbook search + api fix
The sccp-addressbook only allows defining addresses for a specific
ss7 instance. It is not possible to use an sscp-address, that is
defined in the one ss7 instance in another ss7 instance.

Add a second global list where all sscp-addresses are added,
regardless on which instance they are defined.

Fixup the search functions so that they always search the global
list.

Change the API, so that the address data is written to a
destination pointer. This protects the stored address from
unintentional changes. Also return the ss7 instance, where the
address is associated with.

Change-Id: I5acc1e5abc3b3081149a9f476038e4e53d23b763
2017-07-20 12:38:37 +02:00
Philipp Maier 34cb3c16a5 sccp: add addressbook functionality for sccp addresses
SCCP addresses are defined through a number of compoinents, not
just an IP-Address, there is also point code, ssn and more. To
simplify and unify the handling of such objects, this patch
introduces an addressbook functionality. The user can set up
multiple addresses per ss7 instance and give them names. Later
that name can be used to reference the address at a later point
in the config. This means that the usage of sccp-addresses from
the programmers point of view boils down to a VTY function that
reads the string name of a previously defined address. The
programmer can then use the API to get a pointer to the SCCP
address struct and use it normally.

For this feature, two additional VTY nodes are necessary,
this commit depends libosmocore change:
Change-Id I42aa29c0cccc97f284b85801c5329b015b189640

Change-Id: I068ed7f7d113dab88424a9d47bab7fc703bb7942
2017-06-21 18:02:05 +02:00
Harald Welte c031536808 SCCP: Add VTY interface for SCCP
Change-Id: I100daaa947dbab6a4528c4e9fbd0d30790288f63
2017-04-14 20:25:50 +02:00
Harald Welte 30c2b89925 Add osmo_sccp_get_ss7() accessor function
as 'struct osmo_sccp_instance' is opaque to the user application, it is
useful to have an accessor function that resolves the ss7 instance used
by the SCCP instance.

Change-Id: I8057a6d69584239b9781c5cece42066293ea1dd6
2017-04-10 11:48:35 +02:00
Harald Welte c9c11b6cfd sccp: add osmo_sccp_user_{get,set}_priv() API function
As 'struct osmo_sccp_user' is private, we need this accessor functions
for the SCCP User so it can set and get the 'priv' data.

Change-Id: Ia68a36dc18a7d754d63ae29c86d68e495b5c4134
2017-04-10 11:48:34 +02:00
Harald Welte ee350893cf Add new SCCP implementation
This is an implementation of SCCP as specified in ITO-T Q.71x,
particularly the SCRC (routing), SCLC (Connectionless) and SCOC
(Connection Oriented) portions.  the elaborate state machines of
SCOC are implemented using osmo_fsm, with one state machine for each
connection.

Interfaces to the top (user application) are the SCCP-USER-SAP and on
the bottom (network) side the MTP-USER-SAP as provided by osmo_ss7.

Contrary to a straight-forward implementation, the code internally
always uses a SUA representation of all messages (in struct xua_msg).
This enables us to have one common implementation of all related state
machines and use them for both SUA and SCCP.  If used with real SCCP
wire format, all messages are translated from SCCP to SUA on ingress and
translated from SUA to SCCP on egress.  As SUA is a super-set of SCCP,
this can be done "lossless".

Change-Id: I916e895d9a4914b05483fe12ab5251f206d10dee
2017-04-10 11:48:34 +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 3b0abab223 sccp_sap: Add support for N-NOTICE.indication
Change-Id: I6656889b4333e9909cf1c60c24dfc754281547b4
2017-04-10 10:41:16 +02:00
Harald Welte 18d00e046b sccp_sap: Add routing indication (RI) to osmo_sccp_addr
Change-Id: I4dd23150f4c588b6430c22fc0cb66635994ceea9
2017-04-10 10:41:16 +02:00
Harald Welte 3d2aa4a5c0 sccp_sap: Use zero-terminated string for GT digits in osmo_sccp_addr
This is more natural to most application code, so simply go for ASCII
string with NUL-termination rather than an array with explicit length.

Change-Id: I6312208cdfa83184be41157a473c96e9120c63db
2017-04-10 10:41:16 +02:00
Neels Hofmeyr fe19e46783 cosmetic: add comments for GT, PC, SSN to help noobs finding their way
Change-Id: I8f47f855c2718f4922b36229a388fa719c628bf6
2017-01-27 09:59:31 +01:00
Neels Hofmeyr bfdbde2bd8 fix struct member typo: repsonding_addr in osmo_scu_disconn_param
By accident, I already fixed this typo in osmo-iuh, breaking the build. Instead
of reverting there, fix it here.

Change-Id: I4076fb37c0d94be7adff46e76465884a61c54c9a
2016-07-07 15:23:16 +02:00
Harald Welte a5b2fed35b Add more OSMO_SCCP_SSN_ defines
hopefully we should now know all that we ever expect to need.
2016-04-16 13:27:50 +02:00
Neels Hofmeyr 752b39e763 Fix RANAP SSN: it's 142, not 143
143 is actually the SSN for RNSAP. Wireshark displayed a RNSAP message type
and malformed packet warning until I fixed this to 142. Now I get the proper
RANAP and id-Paging reported.

There has been a reallocation for RANAP and RNSAP SSNs, though the old SSN for
RANAP is apparently 32 (seen in a pcap from a real 3G network). When I send 32
instead of 142, wireshark also decodes the message as valid RANAP.
2016-04-16 13:15:59 +02:00
Harald Welte 0b44895a88 Add missing OSMO_SCCP_SSN_RANAP for RANAP SSN 2015-12-25 16:53:57 +01:00
Harald Welte f57a1594b7 Properly define SCCP_SAP_USER without random magic number 2015-12-23 14:16:21 +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