Commit Graph

226 Commits

Author SHA1 Message Date
Harald Welte 64deeb0a52 sua.h: Define more IEIs; base definitions on m3ua.h
A lot of IEIs are identical between the different xUA dialects, so let's
base the SUA definitions on the m3ua definitions.

Change-Id: I64c7166cf0b5c8a927ab7e14955100f8d13fe16a
2017-04-10 10:41:16 +02:00
Harald Welte 7a4f782692 Replace unused m3ua_types.h with protocol/m3ua.h
This is more in line with what we do for SUA in protocol/sua.h

Change-Id: I4a32cb698d28b4ccff9280b8512557ab5a353fe3
2017-04-10 10:41:09 +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 f17725a86f sccp/sccp.h: Add #include to linuxlist.h
sccp.h is using 'struct llist_head' so it must include the associated
linuxlist.h header.

Change-Id: I1fc4c34e59c27dce9e8a73abc6e58073f091c978
2017-02-13 15:09:17 +01:00
Harald Welte 840cef34a8 sccp_types.h: Include stdint.h
We're using types like uint8_t, for whcih we need stdint.h

Change-Id: I67a3b94c866e05be32b99566d6f97fbc8a2accad
2017-02-13 15:09:17 +01:00
Harald Welte 9b988826cd sccp_types.h: Add 'struct sccp_data_unitdata_service'
We didn't have as struct for UDTS messages so far, let's change that.

Change-Id: I9cbd3980fd95d5af6f0fc807ede34aa6b0f64ea7
2017-02-13 15:09:17 +01:00
Harald Welte 663651462a protocol/sua.h: Add #defines for CAUSE group values (from RFC)
Change-Id: I5b0af77aab4ba03262c0ecd25a893f170ca9c4bb
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 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
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 04694923b2 add comment (meaning of COIT)
Change-Id: I63276ca2bfd6282676618e50268ed2234025b7bb
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 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
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
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
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 e0cd6c4d3b mtp: Correct the pointcode mask
Taken from libosmocore
2015-03-24 19:19:57 +01:00
Holger Hans Peter Freyther e48db7f497 mtp: Add missing defines from cellmgr-ng 2015-03-24 19:16:16 +01:00
Holger Hans Peter Freyther 6bdea14915 mtp: Add implementation from cellmgr 2015-03-24 19:12:54 +01:00
Holger Hans Peter Freyther 837beea52c mtp: Convert to pragma once
This already fixes a clash of filenames in cellmgr-ng
2015-03-24 19:09:13 +01:00
Holger Hans Peter Freyther 80565cd8c3 mtp: Error about unknown endian as well 2015-03-24 19:08:56 +01:00
Holger Hans Peter Freyther 0a8308764c mtp: Implement reading the OPC/DPC for little endian 2015-03-24 19:07:02 +01:00
Holger Hans Peter Freyther 953d4eda47 m3ua: Add the definition of the protocol data header 2015-03-24 18:34:57 +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
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
Holger Hans Peter Freyther a93c6f3113 endian: Use new osmocom/core/endian.h
Use the new osmocom/core/endian.h to gaim portability.
This has only been compiled/make check on two little
endian systems.
2015-03-22 09:10:23 +01: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 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 2d97000f98 Update include paths with libosmocore 0.2.0 2011-03-23 18:30:22 +01:00
Holger Hans Peter Freyther 4cd6e62eb3 m2ua: Fix some defines found when moving this to Smalltalk 2011-02-25 11:49:04 +01:00
Holger Hans Peter Freyther 2bf19da405 m2ua: Allow to set a log area for DM2UA. 2011-01-22 22:59:39 +01:00
Holger Hans Peter Freyther 9566027b07 m2ua: Implement to find a tag inside a message 2011-01-13 13:53:26 +01:00
Holger Hans Peter Freyther f3b7effbc1 m2ua: Add parsing and creation of m2ua packages 2011-01-12 12:50:09 +01:00
Holger Hans Peter Freyther b8962797a5 m2ua: Add enum values for the parameters of the individual messages 2011-01-12 12:50:01 +01:00
Holger Hans Peter Freyther 2127f19672 m2ua: Add basic header file for the common structure of a M2UA msg 2011-01-12 12:50:01 +01:00
Holger Hans Peter Freyther c7ba0e5018 mtp: Remove the mtp_data header file as it refers to the cellmgr 2011-01-12 12:49:55 +01:00
Holger Hans Peter Freyther 27cdccf74a sccp: Pass the sccp_connection down to the send method if it exists
This allows to identify the sccp connection and send the SCCP
payload down to a different stream depending on the connection. It
will be used by the bsc_msc_ip to keep multiple MSC connections
open.
2010-08-25 12:01:12 +08:00
Harald Welte 61307dafb8 move include files to $(includedir)/osmocom/* 2010-08-03 14:58:33 +02:00
Holger Hans Peter Freyther 3e021b827f sccp.c: Make the create work with data + len to not have a msgb 2010-08-02 23:01:02 +08:00
Holger Hans Peter Freyther b5a2f8d589 sccp: We have the gti_ind inside the address already. 2010-08-02 22:00:28 +08:00
Holger Hans Peter Freyther d2a7174414 sccp: Allow to create a _udt message with the given parameter. 2010-08-01 20:52:01 +08:00
Holger Hans Peter Freyther 00e6f692e9 mtp: Add the MTP Level3 code to the SCCP repoistory
SCCP can be wrapped inside the MTP Level3, and one can
use it for link testing as well. This repository should
be renamed to libosmo-itu or libosmo-ss7 and be a host
to SS7 related encapsulation...

The code is coming from the cellmgr-ng code.
2010-08-01 17:01:26 +08:00
Holger Hans Peter Freyther 7360a36ead sccp: Copy out pointers to the GTI into the parsed structure.. 2010-08-01 04:57:41 +08:00
Holger Hans Peter Freyther 9aa8c8bb35 sccp: Make it possible to have a POC inside the sockaddr_sccp.
Embed the POC, add the indicator, add the POC byte.
2010-08-01 04:57:41 +08:00
Holger Hans Peter Freyther 444d8d1234 sccp: Make it possible to put a GlobalTitle into the SCCP header. 2010-08-01 04:57:40 +08:00
Holger Hans Peter Freyther 17097d06b5 sccp: Add a new buildsystem for the OSMO SCCP library 2010-07-30 02:13:37 +08:00
Holger Hans Peter Freyther e4cb3e039b sccp: Adjust the code to only depend on libosmocore
* Introduce a method to set the value of the debug area to
  use and default it to -1. Turn the DSCCP enum into a local
  variable to make the log messages work.
* Remove usage of openbsc and libbsc.a
2010-07-30 02:12:02 +08:00
Holger Hans Peter Freyther e3c0d8bbf3 sccp: u_int32_t -> uint32_t 2010-07-23 18:40:10 +08:00
Holger Hans Peter Freyther acd31a3ac4 sccp: u_int8_t -> uint8_t 2010-07-23 18:39:17 +08:00
Holger Hans Peter Freyther 4da58e06ca [sccp] Add method to create a dt1 packet. 2010-05-17 04:08:57 +08:00
Holger Hans Peter Freyther 29c30a0c15 [sccp] Create a method to create RLSD messages. 2010-05-17 04:08:50 +08:00
Holger Hans Peter Freyther 72bec50b8e [sccp] Create a SCCP CC creation routine. 2010-05-17 04:08:42 +08:00
Holger Hans Peter Freyther 38cc0e6c4d [sccp] Make it optional to send data on a SCCP Connection Refuse
This can be used to send a Location Updating Reject down to the
BSC when it is clear that a subscriber is not allowed.
2010-05-15 05:35:48 +08:00
Holger Hans Peter Freyther bfa3c776af [sccp] Export function to create SCCP Refuse message. 2010-05-15 05:35:20 +08:00
Holger Hans Peter Freyther c459c0491a [sccp] Parse the error message and add a unit test for it. 2010-04-25 23:04:38 +08:00
Holger Hans Peter Freyther 902e32e051 [sccp] Add a force_free method for connections
E.g. when the underlying connection transport medium is gone
one needs to force to close SCCP connections, add this helper.

It will remove the connection from the list of connections and
it will free the data.
2010-04-05 22:00:24 +02:00
Holger Hans Peter Freyther a9e39c3264 sccp: Change the ownership of the msgb passed to the callback
Instead of deleting the msgb within the SCCP library the implementor
of the write callback needs to free it. This is required for non
blocking io with the server.
2010-03-26 05:44:21 +01:00
Holger Hans Peter Freyther dcf5d78525 Merge branch 'on-waves/sccp' 2010-02-14 19:27:52 +01:00
Holger Hans Peter Freyther f1aec7d448 [sccp] Make the bitfields work on big endian machines too
* Use the endian.h to fogure out for which endianess we are
  building and then use the bitfields in reverse order
2010-02-14 19:27:16 +01:00
Holger Hans Peter Freyther 756aaadf5b Merge branch 'on-waves/sccp' 2010-02-12 22:52:12 +01:00
Holger Hans Peter Freyther 63cd135faa [sccp] Make the file includable outside of OpenBSC 2010-02-12 22:51:24 +01:00
Holger Hans Peter Freyther 9ba1c6253a [sccp] Install the static sccp library and the headers 2010-02-12 22:42:13 +01:00
Holger Hans Peter Freyther 575d5def1b [sccp] Invent new API to be used by the BSC NAT
I want to reuse the SCCP code for header parsing in the BSC
NAT to identify data and patch the source local reference. To do
this the current handle_* methods will be changed into two parts
one is strictly parsing the other is handling the parsed data.
2010-01-29 04:35:34 +01:00
Holger Hans Peter Freyther 762afe424d [sccp] Add a utility for the nat..
Add a small helper to determine the type of a message
2010-01-29 04:35:18 +01:00
Holger Hans Peter Freyther 2ac75aeb4d [sccp] Implement sending the Inactivity Test on a connection..
Currently this will send a dummy inactivity test message,
there is currently no parsing or API to receive the messages.

The sequencing and credit entries are empty as sequencing
is currently not used at all.

The test is currently limited to send the message and see
if the application is crashing or not.
2009-11-20 13:09:15 +01:00
Holger Hans Peter Freyther 8bfd8d1648 [sccp] Implement parts of ITU SCCP for use in the A-Interface
include/sccp/sccp_types.h contain Q.713 and GSM definitions
include/sccp/sccp.h is the application interface resembling
                    the esentials of the UNIX socket interface.

src/sccp.c is the actual implementation of SCCP featuring
           connection and UDT1 support.

tests/sccp/sccp.c is testing connection creation and formating
                  of the SCCP messages used by the A-interface. And
                  it contains a simple fuzzing test to test the
                  robustnes of the implementation.
2009-11-20 13:09:15 +01:00