Commit Graph

165 Commits

Author SHA1 Message Date
Harald Welte 8960704d1c SUA: Ensure osmo_ prefix is used on all global symbols 2015-12-21 23:51:08 +01:00
Harald Welte 70e84ab5f9 SUA: More FIXMEs 2015-12-21 23:50:36 +01:00
Harald Welte 283c7fde38 Add WIP code for SCCP User Adaptation (SUA) and SCCP User SAP
The idea of this code is to
* provide a SCCP User SAP as boundary between the User of SCCP
  or SCCP-like transport like SUA
* implement the minimum subset of SUA to transport RANAP messages
  betweene HNB-GW and MSC/SGSN

At this point
* we don't yet implement the proper state machines and timer
* we don't imp[lement the SCCP RESET procedure
* we don't implement AS/ASP management

The code is full of FIXMEs whihc hopefully will get fixed gradually.

After some cleanup + verification, it should move to a library, possibly
either replacing/renaming libomo-sccp, or adding it to libosmo-netif?
2015-12-21 23:35:56 +01:00
Harald Welte 71f73a2919 move COPYING file to root directory 2015-12-21 21:01:00 +01:00
Harald Welte ef5055c275 Makefile.am: Try to model the asn1tostruct.py generation dependencies 2015-12-21 17:50:11 +01:00
Harald Welte e98dacd1cb add TS 25.412 spec 2015-12-19 16:24:22 +01:00
Harald Welte c32b0d9848 Add various RANAP packet captures (pcap files) found on the net 2015-12-19 14:52:44 +01:00
Harald Welte b2daa0d803 ranap ASN.1: Define IMSI as OCTET STRING to work around asn1c bug
When IMSI is a TBCD-STRING type, and TBCD-STRING is defined as OCTET
STRING, we end up encoding the IMSI the wrong way.  I don't knwo why
that is, but changing it fixed the problem, as described below:

before this commit:
00 17                           PeranentNAS-UE-ID
40                              criticality ignore
0a                              (length)
00                              presence = IMSI
08                              BUG: why the additional length field?
46 23 91 34 70 77 80 f3         IMSI (643219430777083)

after this commit:
00 17                           PeranentNAS-UE-ID
40                              criticality ignore
09                              (length)
50                              presence = IMSI
46 23 91 34 70 77 80 f3         IMSI (643219430777083)
2015-12-19 13:05:19 +01:00
Harald Welte 0a3eafee45 ranap: Don' shift the RAB ID by 3 bits 2015-12-19 02:38:09 +01:00
Harald Welte 94a62d591d ranap: No need for htonl() of IP addresses and the like 2015-12-19 02:37:48 +01:00
Harald Welte b7f67c4b14 ranap: Don't forget ProtocolIE-CointainerPair around ProtocolIE-FieldPair 2015-12-19 02:37:35 +01:00
Harald Welte de9055f142 Makefile.am: Replace .PHONY asn1tostruct.py rules
asn1tostruct.py generates three files.  Try to teach the makefile that
all three of them depend on the .asn source file to ensure they're
re-built whenever the .asn source file changes.
2015-12-18 20:20:51 +01:00
Harald Welte f8db61b554 First compiling (and leak-free) RANAP message generation functions
encoding correctness still needs to be verified at this point.  At least
they generate some binary output without failing somewhere earlier in
the encoding process - and they don't leave any leaked memory behind,
see talloc_report() at the end of test-ranap.c:main().
2015-12-18 20:20:47 +01:00
Harald Welte fcabec3665 implement BIT_STRING_fromBuf() similar to OCTET_STRING_fromBuf() 2015-12-18 17:51:50 +01:00
Harald Welte 16232780d8 ranap_common: Fix error cleanup path while generating IE Pair 2015-12-18 17:22:04 +01:00
Harald Welte 04329dcbdc {hnbap,rua,ranap}_common: check for encoding errors in new_ie() 2015-12-18 15:18:13 +01:00
Harald Welte 629391321f {hnbap,ranap,rua}_common: use FREEMEM(), not free() directly
If we allocate with CALLOC/MALLOC macros, we need to release memory via the
same API.
2015-12-18 14:58:34 +01:00
Harald Welte 8526d158f8 hnbap/rua: Don't usse malloc() directly but use CALLOC() macro 2015-12-18 13:41:39 +01:00
Harald Welte 9c397d4969 ranap: Use CALLOC() macro of libasn1c
we don't use malloc() directly, as that doesn't mix well with
our libasn1c using talloc.
2015-12-18 13:35:58 +01:00
Harald Welte 2676554c92 ranap: Ensure we free any intermediate dynamically allocated memory 2015-12-18 13:35:58 +01:00
Harald Welte d062df5307 test-ranap.c: Further WIP, it now actually compiles 2015-12-18 13:35:58 +01:00
Harald Welte 93690184b0 RANAP: Split FormatInformationParameter / SDUParameterItem
The definition of the above data types as per 3GPP specs results in a
SEQUENCE_OF() an anonymous structure, which is slightly inconvenient to
use.  So let's split the SEQUENCE OF part and the actual definition of
the item in separate types.
2015-12-18 13:35:58 +01:00
Harald Welte 091039d47e test-ranap.c: More WIP code for convoluted RANAP message encoding 2015-12-18 13:35:58 +01:00
Daniel Willmann 141a0baac9 hnb-test: Add an option to transmit multiple UE register/deregister msgs 2015-12-17 18:03:52 +01:00
Daniel Willmann 28b9ec1473 Enable vty command to output talloc report
I don't think I can print this into a string and thus output it via VTY.
In that case it might be smarte to do in a signal handler
2015-12-17 18:02:37 +01:00
Daniel Willmann 5f810f4222 hnbgw_hnbap: Initialize return value and always return something 2015-12-17 17:57:51 +01:00
Daniel Willmann 59d17d8961 hnbap: Free ASN.1 components after they are no longer needed 2015-12-17 17:56:56 +01:00
Daniel Willmann 6637a289da hnb-test: Handle closed connections correctly 2015-12-17 14:47:51 +01:00
Daniel Willmann 19dedbb6b1 hnb-test: Send UE de-register after receiving the UE registration accept 2015-12-17 13:09:37 +01:00
Daniel Willmann 92856e6ef2 hnb-test.c: Remove pdus.h include as it is not used
The messages are constructed so no need to include the binary asn1 data.
2015-12-17 13:09:37 +01:00
Daniel Willmann 3279780557 hnb-test: Add HNBAP category and reduce MAIN loglevel to INFO 2015-12-17 13:09:18 +01:00
Daniel Willmann bded9841b5 hnbgw: Change logging priorities and add HNBAP category
Log hnbap messages to the HNBAP category. Change MAIN category to only
log INFO and above and change SCTP notification message to debug.
2015-12-17 13:09:18 +01:00
Daniel Willmann efceb187aa hnbgw_hnbap: Process UEDeRegister and try to free correct UE 2015-12-17 13:09:18 +01:00
Daniel Willmann 4267a29ee0 hnbgw: Handle closed connections correctly
We still need to clean up the HNB data structures after the connection
is closed
2015-12-17 13:09:18 +01:00
Daniel Willmann 7c27f7b792 hnbgw: Lower level of SCTP notif. msg to debug and set default log level to info 2015-12-17 13:08:32 +01:00
Harald Welte ace1d24d34 ranap_common: Add function to wrap IEs into a RANAP_ProtocolIE_FieldPair_t
The FieldPair is a strange construct of RANAP Radio Access Bearer
assignment, where certain IEs appear in pairs.
2015-12-16 23:07:19 +01:00
Harald Welte 462db35426 hnbap_common: Fix copy+paste mistake (use hnbap msgb allocator) 2015-12-16 23:06:59 +01:00
Harald Welte d328c1a3ac WIP: add some early code for generating required RANAP messages 2015-12-16 23:04:21 +01:00
Harald Welte c16117a22c Add ranap_generate_outcome() function
Ranap has not only successsful and unsuccessful outcome, but also
an unqualified general 'outcome'.
2015-12-16 20:30:11 +01:00
Harald Welte 8dacb07baf {hnbap,rua,ranap}_common.c: Reduce code duplicatioon
There used to be a lot of code duplication between the code to generate
initiating, successfulOutcome and unsuccessfulOutcome messages.  Try to
reduce that by callign a generic function.
2015-12-16 20:27:14 +01:00
Harald Welte cbaaeefe00 {rua,hnbap,ranap}_common: Add missing encoding functions
We used to only have those generator functions that we needed for
the existing hnbgw code; Implement the missing encoders
2015-12-16 20:17:26 +01:00
Harald Welte 08d5da6647 hnbgw: Use the now-compiling RANAP encoder+decoder code
So far, we copy-pasted/cherry-picked individual encoder/decoder
functions as the overall ranap_{encode,decode} didn't compile yet.

As the latter is now finally compiling, we can remove those copies and
link in ranap_{encode,decode}.o
2015-12-16 17:31:43 +01:00
Harald Welte 49695572ba One further RANAP hacking session
This is not development, it is random trial and error hacking.  I really
hate the fact that we have no useful asn.1 code generator and need to
work with hacks like asn1tostruct.py and asn1c without information
object classes :/

This commit is a one-day-long iteration of trial+error, manually editing
and adding the .asn source of RANAP until we get something that in the
end at least compiles and links.  Do I trust the resulting code? No.
But we have no alternative :(
2015-12-16 17:26:05 +01:00
Harald Welte a0c74240fa asn1tostruct: Avoid erroneous double-underscores
We shouldn't generate names like
RANAP_RAB_SetupList_EnhancedRelocCompleteReq__t when creating the
_encode() and _decode() functiosn, as the '-IEs' at the end must be
stripped before converting all '-' to '_'.
2015-12-16 16:45:48 +01:00
Harald Welte 1c4d4bc233 Make .gitignore aware of autoconf artefacts 2015-12-16 13:17:22 +01:00
Harald Welte 1989913ba2 RANAP: Add more types/IEs to RANAP-PDU.asn and re-generate C
As asn1c cannot understand information object classes, we cannot compile
RANAP-PDU-Contents.asn but instead need to manually add the respective
infrmation elements to RANAP-PDU.asn.
2015-12-16 13:15:02 +01:00
Harald Welte fd5db064cb Re-add the 'regen' targets lost in the automake transition
This might need a lot of cleanup for out-of-source-tree builds and the
like, but let's not spend time on this now.  The old Makefile also
didn't support that.  But loosing the ability to regenerate the C source
is not an option either.
2015-12-16 13:14:10 +01:00
Harald Welte 3297dbaaa7 rename ASN_MODULE_FILES to ASN_MODULE_SOURCES
... brings us closer to the Makefile.am.sampl generated by asn1c,
facilitating copy+paste.
2015-12-16 13:13:30 +01:00
Daniel Willmann 29b9e00355 Autotoolize the build
Use Autoconf/make for building and autotest for tests
2015-12-15 15:10:31 +01:00
Daniel Willmann a7b02405be hnb-test: Parse UE register accept 2015-12-14 10:37:26 +01:00