Commit Graph

343 Commits

Author SHA1 Message Date
Harald Welte b66c5d0e62 move tests/rua_helper.[ch] to src directory
The RUA Helper is not test-specific.
2016-01-03 18:04:28 +01:00
Harald Welte 1f6bd7b51c add test-ranap to testsuite 2016-01-03 18:01:05 +01:00
Harald Welte 06bc548cee steps towards making 'make distcheck' work
'make distcheck' checks for out-of-source-tree builds and whether
the distribution tarball includes all source files.  This commit
fixes many problems, except some remaining with src/test still
to-be-fixd.
2016-01-03 17:54:24 +01:00
Harald Welte e8a4dc6b70 move asn1helpers.[ch] to libasn1c
Those helper functions are not specific to osmo-iuh, so I moved
them to libasn1c, which also resolves the problem that libosmo-ranap
is depending on those helpers (and subsequently external programs
linking libosmo-ranap will need to have access to the helpers)
2016-01-03 17:25:57 +01:00
Harald Welte bdf3fd1dc4 don't include hnbgw.h from ranap header files
To use libosmo-ranap from outside of this repository, we need to
eliminated all dependencies to local header files
2016-01-03 17:25:51 +01:00
Harald Welte 056984fab1 merge (+rename) iu_helpers.c into libosmo-ranap 2016-01-03 16:31:31 +01:00
Harald Welte a95d5a5f51 Makefile restructuring; install ranap header files 2016-01-03 16:22:16 +01:00
Harald Welte 0322feb68c Introduce libosmo-ranap.so as shared RANAP lib
This shared RANAP library will be used not only by hnbgw, but also by
OsmoCSCN, OsmoSGSN.
2016-01-03 15:39:11 +01:00
Harald Welte a575ebfd0f test-ranap: Call new RANAP encoder functions from ranap_msg_factory.c 2016-01-01 16:47:13 +01:00
Harald Welte 74157f6120 ranap_msg_factory: Fix memory leaks in OCTET_STRING
the 'ies' types do not have a free() function, and thus we have to avoid using
any functions that dynamically allocate memory, such as OCTET_STRING_fromBuf.
2016-01-01 16:47:13 +01:00
Harald Welte 962da50e08 asn1helpers: Add new OCTET_STRING_noalloc
This assings the buffer + size of an OCTET_STRING without allocating a new
buffer and copying the data.
2016-01-01 16:47:13 +01:00
Harald Welte 1cdb81dd98 ranap_msg_factory: Mark 'RANAP_Cause_t *' as const 2016-01-01 16:47:13 +01:00
Harald Welte 37223d8218 ranap_msg_factory: functions for RAB and IU Release Request 2016-01-01 16:47:13 +01:00
Harald Welte 01de8d716a fix copy+paste mistakes when encoding GTP TEI in RAB Parameters 2015-12-29 19:10:48 +01:00
Harald Welte 05ac677840 make bitrates configurable in new_rab_par_data() 2015-12-29 19:10:11 +01:00
Harald Welte 4928797807 more verbose logging in various places 2015-12-29 19:00:35 +01:00
Harald Welte 7bccc98cf8 ranap_common_cn: Handle non-terminal 'outcome' for RAB-ASS.resp 2015-12-28 14:44:49 +01:00
Harald Welte a31e63ab39 ranap_common_cn: Fix typo 2015-12-28 13:19:35 +01:00
Harald Welte bfe49a2293 ranap_msg_factory.c: Use X.213 NSAP encoding for TransportLayerAddr 2015-12-28 13:14:52 +01:00
Harald Welte 2cf0d8f1eb ranap_msg_factory: CipheringInformation is optional in SecurityModeCommand 2015-12-28 13:13:47 +01:00
Harald Welte 4e2783fc0f Dummy CN: Handle RANAP payload of DISCONNET.ind
In case of RANAP Release Complete, the DISCONNECT contains RANAP payload that
we'd like to parse and handle.
2015-12-26 23:49:52 +01:00
Harald Welte 0744d6f63e dummy CN: Handle Iu Release Request (respond with Release Command) 2015-12-26 23:45:18 +01:00
Harald Welte 1be24f1b0a dummy_cn_sua.c: Fix syntax errors 2015-12-26 23:44:28 +01:00
Harald Welte 2bc20f85c1 Dummy CN: Create a per-UE connection context and resolve it. 2015-12-26 23:43:48 +01:00
Harald Welte e311ae078a ranap: Allocate msgb's with headroom for SCCP User primitive pushing 2015-12-26 23:41:14 +01:00
Harald Welte 96e36eb675 remove ranap_parse_lai() from hnbgw_ranap.c 2015-12-26 23:40:54 +01:00
Harald Welte 5bea800fa7 More verbose logging (CS/PS domain) 2015-12-26 23:40:31 +01:00
Harald Welte 552fdf144a Start to use SUA local referencs from 1000 upwards
... which allows us to detect sequence 0 as something that's wrong
(i.e. uninitalized)
2015-12-26 23:39:30 +01:00
Harald Welte 4009b36d74 context_map: Don't forget to store the SCU connection ID 2015-12-26 23:39:05 +01:00
Harald Welte 2ebe42fed7 properly resolve the cnlink from SUA signalling link 2015-12-26 23:38:38 +01:00
Harald Welte cee5a2878b don't double-free msgb's in rua_helper and ranap_common_cn 2015-12-26 08:43:31 +01:00
Harald Welte 3aad6af6a4 add 'dummy cn' as a stub core netwrok element to which hnbgw connects 2015-12-26 08:43:04 +01:00
Harald Welte 37704d907d ranap_common.c: Add ranap_parse_lai() 2015-12-26 08:42:31 +01:00
Harald Welte 8c572fee2a use libosmocore SCCP_SSN_RANAP definition 2015-12-26 08:42:07 +01:00
Harald Welte efef6fb4de ranap_common: Add value_string for procedure code and presence 2015-12-25 15:35:01 +01:00
Harald Welte 87ffeb91dc factor out some common shared test init code 2015-12-25 15:34:22 +01:00
Harald Welte 3cfa450fdc Add new common RANAP parsing code for CN elements 2015-12-25 15:33:41 +01:00
Harald Welte 706213ac4b Fix typo / spelling mistakes 2015-12-25 10:33:09 +01:00
Harald Welte 2963ee2505 hnbgw_hnbap: Print HNBAP Cause during UE De-Register 2015-12-25 10:32:37 +01:00
Harald Welte 831e1ee8f4 hnbgw_rua.c: Print RUA cause in error indication 2015-12-25 10:28:55 +01:00
Harald Welte 23058e1144 hnbgw_ranap: Print RANAP Cause in RESET and ERROR INDICATION 2015-12-25 10:25:01 +01:00
Harald Welte c3ca7eba18 don't return undefined strings from rua_cause_str() 2015-12-25 10:17:17 +01:00
Harald Welte 3d39f84233 ranap_common: Add ranap_cause_str() to stringify RANAP Cause 2015-12-25 09:40:07 +01:00
Alexander Huemer ef8934612c fix build if depenedencies are in distinct directories 2015-12-24 16:15:17 +01:00
Harald Welte 7ac7e048b4 add rua_helper.[ch] missing from previous commit 2015-12-24 15:53:30 +01:00
Harald Welte c3851220db hnb-test: Add VTY to manually issue Iuh messages
We can now send Iuh messages with commands like 'hnbap hnb register',
'hnbap ue regiter imsi 12345', 'ranap reset cs', 'ranap reset ps',
and even establish connection-oriented RUA using
'channel cs lu imsi 12345'
2015-12-24 15:41:21 +01:00
Harald Welte f9c9aa5f20 ranap_msg_factory.c: Fix compiler warnings 2015-12-24 15:39:00 +01:00
Harald Welte 57d873392c ranap_msg_factory: use OCTET_STRING_fromBuf() in ranap_new_msg_dt()
When using asn1c, we cannot use buffers allocated elsewhere and/or on
the stack as input into encoding.
2015-12-24 15:33:21 +01:00
Harald Welte ea98b6f6d6 ranap: New ranap_new_msg_initial_ue() funcition
for testing, it is useful if we can also generate an InitialUE
message - even though a HNB-GW only needs to receive it.
2015-12-24 15:09:06 +01:00
Harald Welte afcaac08ee asn1helpers.h: Add missing declarations of functions in asn1helpers.c 2015-12-24 15:03:11 +01:00
Harald Welte b0de90639b hnbgw_rua.c: Incoming context IDs are 24bit wide according to spec
so don't try to decode them to u32, which expects 32bit input values.
2015-12-24 14:10:17 +01:00
Harald Welte c89c2a6e6a RANAP: Replace the last remainng TBCD-STRING with OCTET STRING
in order to work around a bug in asn1c.  When we keep the original
TBCD-STRING, the APER-encoded PLMNidentity always has an extra leading
length byte that the decoder doesn't expect.
2015-12-24 14:07:05 +01:00
Harald Welte 37166a27ca improve logging, remove obsolete FIXMEs, return of non-void functions 2015-12-24 10:12:09 +01:00
Harald Welte bc4560cf18 Implement forwarding of RANAP PAGING from CN to all HNBs 2015-12-24 08:46:58 +01:00
Harald Welte c4338deee9 hnbgw: Bring all parts together
We now have the RUA and SUA parts interconnected by the
context ID mapper, and should be able to pass messages back and forward
between both sides.

Unfortunately this touches a bit of everything, but the structures are
all still very much in flux.  Hopefully they will start to stabilize at
some point soon...
2015-12-24 00:41:45 +01:00
Harald Welte cd5e981490 hnbgw_rua: Don't use msgb as imput, allow more parameters 2015-12-23 22:14:16 +01:00
Harald Welte 90256bad58 Add a context mapper to map RUA ContextIDs <-> SUA Connection IDs 2015-12-23 22:13:53 +01:00
Harald Welte f42317ba9c Introduce DRANAP/DRUA log categories to separate logging 2015-12-23 15:37:17 +01:00
Alexander Huemer f6d0138d76 fix copy/paste mistake in src/Makefile.am 2015-12-23 13:56:23 +01:00
Harald Welte ffa7c0ad39 use msgb_sctp_ppid() from libosmo-netif, remove local declaration 2015-12-23 00:04:05 +01:00
Harald Welte 75a4e65f52 hnbgw: Add SUA client socket towards localhost
This socket doesn't do much yet except to connect to localhost:14001

The host/port needs to be made configurable, and the RUA<->SUA
interfacing needs to be implemented.

Also, we'll need two SUA sockets, one for MSC and one for SGSN.
2015-12-23 00:04:05 +01:00
Daniel Willmann 269b8ac7ee hnbgw: Free msgb when connection is closed 2015-12-22 16:40:46 +01:00
Daniel Willmann 541e429a39 hnbgw_hnbap.c: Clean up after encoding a UE register accept
Need to free the ASN.1 structs after using them to encode the UE
register accept message.
2015-12-22 16:40:46 +01:00
Neels Hofmeyr c51f735b35 really fix src/Makefile.am
Add BUILT_SOURCES to src/Makefile.am.

(And remove a stray space.)
2015-12-22 12:27:02 +01:00
Alexander Huemer fec171d8b4 fix Makefile.am 2015-12-22 12:24:27 +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 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 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
Daniel Willmann 9224731379 asn1helpers: Fix 24 bit conversion function and use it in hnbgw_hnbap
The 32 bit int needs to be shifted left one byte so the correct bytes
end up at the beginning of the bit string buffer.
2015-12-14 10:36:36 +01:00
Daniel Willmann 4e31250367 hnb-test: Send UE register request 2015-12-14 10:36:36 +01:00
Daniel Willmann 479cb300ce hnb-test: Send HNB register request and parse the accept 2015-12-14 10:36:36 +01:00
Daniel Willmann 4abdee0803 hnb-test: setsockopt SCTP_EVENTS is needed to get the sctp_sndrcvinfo 2015-12-14 10:36:36 +01:00
Daniel Willmann d6a45b402c asn1helpers: Add 28 bit conversion function and use it for Cell ID
The padding bits in the bit string are at the end and the byte-order is
MSB-first. This means the number needs to be shifted left so the padding
bits are the least significant.
2015-12-14 10:21:51 +01:00
Daniel Willmann a1e202e15e tests/hnb-test: Generate the HNBAP registration request from ASN.1 2015-12-07 17:21:07 +01:00
Daniel Willmann 0e8ef67b7a hnbap_common: Add function to HNBAP generate initiating message
An earlier version was commented out, this function now works like
hnbap_generate_successful_outcome()
2015-12-07 17:19:40 +01:00
Daniel Willmann f3685c2a13 asn1helpers: Add helper to convert u8/u16 to OCTET_STRING 2015-12-07 17:18:56 +01:00
Daniel Willmann 4aeef6c3c4 hnb-test: Send hard-coded HNB register request for now 2015-12-03 17:02:13 +01:00
Daniel Willmann 97374c039b tests: Add hnb-test to connect to hnbgw and tests its functions
Only connects currently
2015-12-03 09:37:58 +01:00
Daniel Willmann 56f6273430 hnbgw: Add VTY commands to show info about connected HNBs and UEs 2015-12-02 12:58:42 +01:00
Daniel Willmann 9a12a4b992 test-helpers: Also print out hexdump of encoded bit string 2015-11-30 16:27:11 +01:00
Daniel Willmann b2548fb1e8 asn1helpers, test-helpers: Use ntoh/hton* to convert integers
Since the asn1_u32/24_to_bitstring functions need to change the source
variable change the signature to clarify that the uint32_t * will be
modified.
2015-11-30 16:24:57 +01:00
Daniel Willmann e2956431e8 test-hnbap: Check CID and Identity Info as well 2015-11-30 16:05:51 +01:00
Daniel Willmann 23c86e38bc test-hnbap: Use different types for UE request and accept IEs 2015-11-30 16:03:36 +01:00
Daniel Willmann e3adf0edc3 asn1helpers: Fix asn1str_to_uX functions
The values are stored big-endian so convert them
2015-11-27 17:53:19 +01:00
Daniel Willmann ea4c088e78 test-hnbap: Test decoding of the hnbap registration request
The 16-bit values are not decoded correctly
2015-11-27 16:14:09 +01:00
Daniel Willmann 1a86955288 tests/test-hnbap: Decode HNBAP UE Register accept as well 2015-11-24 18:11:03 +01:00
Daniel Willmann 39e643a62d tests: Add test-hnbap to test en-/decoding of HNBAP messages
Decode a HNBAP UE register request and check the result.
2015-11-24 18:03:29 +01:00
Daniel Willmann 8ea918d772 tests: Test cropping of string still is NULL-terminated 2015-11-23 15:59:02 +01:00
Daniel Willmann 53018e937c asn1helpers: Ensure that string is NULL-terminated
The buf in an OCTET_STRING_t is not (necessarily) NULL-terminated, so
make sure there is a terminating NULL byte at the end in the resulting
string.
2015-11-23 15:55:46 +01:00
Daniel Willmann ec0e50e148 tests: Test asn1_strncpy function 2015-11-23 15:48:59 +01:00
Daniel Willmann 6e59d413a2 asn1helpers.c: Fix asn1bitstr_to_u32 function
The value in buf is kept in host byte order so no need to swap it
around.
2015-11-23 14:03:04 +01:00
Daniel Willmann 54a9a143f0 tests: Test asn1_u32_to_bitstring and asn1bitstr_to_u32 2015-11-23 14:02:38 +01:00
Daniel Willmann cc5f7cafa2 src/Makefile: Change order of dependencies so a clean checkout builds
There still seem to be some issues with the _decode.o dependencies, but
this will eventually build through.
2015-11-20 19:52:00 +01:00
Harald Welte 0bb1261239 add asn1_u24_to_bitstring()
Sometimes we have a native uint32_t, but we don't want to encode
it to a 4-byte long ASN1 BITSTRING, but rather to one that is only
24 bits.
2015-10-06 22:08:54 +02:00
Harald Welte 4dd16b9643 make asn1bitstr_to_u32() work for sub-32bit bit-strings
IF the ASN1 Bit-string is only 24 bits or even less long,
we might still want to retrieve it as an uint32_t.
2015-10-06 22:08:10 +02:00
Harald Welte 77847ad020 add copyright statement and AGPLv3 headers to source code files 2015-10-06 22:07:04 +02:00
Harald Welte 6286880caa the Context ID is a 24bit number, we cannot use len = 4 bytes! 2015-09-18 01:23:55 +02:00
Harald Welte 1c2ada0e7f ranap: receive/parse DirectTransfer 2015-09-11 20:10:17 +02:00
Harald Welte 80401adcb0 ranap: Parse InitialUE message and hex-print NAS PDU 2015-09-11 19:48:06 +02:00
Harald Welte 0f0ea8112f RUA: hand off RANAP from all PDU types, not just UnitDataTransfer
Also, we now offer a ranap_tx_dt() message for connection-oriented
RANAP transfers.  A far as I understand the RUA spec, on RUA layer,
all operations are Class 2, i.e. without any response/confirmation.
2015-09-11 18:58:28 +02:00
Harald Welte cc27bebd30 ranap: prepare decoding of InitialUE message 2015-09-11 18:45:39 +02:00
Harald Welte 1d2c39d83b various cleanups (compiler warnings, coding style) 2015-09-11 17:49:37 +02:00
Harald Welte 35cbc11757 add unit test for BCD encoding/decoding 2015-09-11 17:36:59 +02:00
Harald Welte 208b7b0778 iu_helpers: fix encoding of BCD (like IMSI) into OCTET STING 2015-09-11 17:35:52 +02:00
Harald Welte 393f2bd9fb move BCD string encoding/decoding functions to iu_helpers.[ch] 2015-09-11 17:13:51 +02:00
Harald Welte 3af1db87ed hnbap: Print error messages in error cases 2015-09-11 17:03:16 +02:00
Harald Welte 10dfc5a97d respond to HNBAP UE REGISTER REQ withe correspnding ACCEPT
The Accept incudes the IMSI that the phone presented, but
somehow we fail to encode the Context ID as bitstring,  see
../pcap/20150911-hnbap-ue_register.pcap
2015-09-11 01:36:44 +02:00
Harald Welte 256c67ad81 ue context: fix linked list insert 2015-09-11 01:22:29 +02:00
Harald Welte b534e5c085 introduce ue_context management
We keep one 'ue_context' structure for every UE that we see
a UE REGISTER REQUEST for.
2015-09-11 00:15:54 +02:00
Harald Welte e2e5d4dd53 Back RUA/RANAP integration until RANAP Reset works for cs+ps
The hNodeB is now actively transmitting and we are getting up to the
HNBAP UE-REGISTER.req with the IMSI of the MS.
2015-09-10 23:49:45 +02:00
Harald Welte 350814a5cb first dispatch of RUA into RANAP
This is becoming more and more of a hack, as asn1c + asn1tostruct.py
don't really deal well with the RANAP syntax :(
2015-09-10 22:32:15 +02:00
Harald Welte ac9c024432 ranap: Add more manual definitions to RANAP-PDUs
It seems that individual IEs contain nested containers, and
asn1c is not generating code for that unless we help it by some
hand-crafted additional definitions. *sigh*
2015-09-10 21:18:16 +02:00
Harald Welte 68fcff219f don't attempt to regenerate ranap-common, it is not auto generated! 2015-09-10 19:35:09 +02:00
Harald Welte 64b4ebe57c rua: dispatch different message types and print context/cause 2015-09-10 19:29:59 +02:00
Harald Welte 318e4d5713 actually dispatch RUA messages to RUA handling code 2015-09-10 18:47:08 +02:00
Harald Welte 656ad301a8 enable building + linking of RUA support 2015-09-10 18:33:47 +02:00
Harald Welte 3bc7ff0bb5 hnbap Makefile: add asn1c include directory 2015-09-10 16:43:44 +02:00
Harald Welte 71733fe9b3 add AGPLv3 license text 2015-09-10 11:02:31 +02:00
Harald Welte 0ec7f13667 Cleanups (rename 'asn1c' to 'hnbap', Makefile sanitizing) 2015-09-10 10:53:37 +02:00
Harald Welte b90c37dbaf build + link to RUA and RANAP libraries 2015-09-10 10:53:36 +02:00
Harald Welte ee0918971f add asn1c generated C source for RANAP (and Makefile to regenerate) 2015-09-10 10:53:36 +02:00
Harald Welte 019830c460 add asn1c generated RUA c+header files 2015-09-10 10:53:36 +02:00
Harald Welte 3ca78c8607 add Makefile.local to generate prefixed RUA code 2015-09-10 10:53:36 +02:00
Harald Welte f2f3000457 msgb_free() all received messages after handling 2015-09-08 00:09:23 +02:00
Harald Welte 17878e267f avoid parsing SCTP noficiations as user data 2015-09-08 00:09:13 +02:00
Harald Welte 7b54e32c63 hnbap: Don't enqueue a NULL msgb for transmit 2015-09-07 22:41:45 +02:00
Harald Welte 9e270b4834 hnbgw.c: Fix double-free in wait-queue transmit code 2015-09-07 22:41:26 +02:00
Harald Welte 1c1c53ca11 hnbap encode: don't pass 0 as available buffer space 2015-09-07 22:41:02 +02:00
Harald Welte c060b7bf2c more error logging in hnbap TX successful outcome 2015-09-07 22:40:41 +02:00
Harald Welte cfcc1e67ad use htonl(ppid) when sending a SCTP message 2015-09-07 22:39:56 +02:00
Harald Welte 3f71256750 Use implement HNBAP transmit using per-hnb write_queue 2015-09-07 22:25:35 +02:00
Harald Welte 2204f9d43d hnbgw: zero-initialize the output struct before aper_decode()
asn1c has this strange behavior that the _output_ struct must be
zero-initialized.
2015-09-07 22:25:35 +02:00
Harald Welte 5c11c94637 hnbgw: Fix SCTP server/receiver
* we need to swap PPID endianness
* we need to explicitly subscrie to the event(s) for sctp_sndrcvinfo
2015-09-07 22:25:35 +02:00
Harald Welte 08a793be9f hnbgw: Initialize linked list header of hnbgw's 2015-09-07 22:25:35 +02:00
Harald Welte 1c0f538a8b hnbgw: Bind to INADDR_ANY, not to localhost only 2015-09-07 22:25:35 +02:00
Harald Welte 385836171b update .gitignore 2015-08-31 09:58:12 +02:00
Harald Welte ff4750fde8 cosmetics: asn1c now no longer explicitly states -fnative-types 2015-08-31 09:55:28 +02:00
Harald Welte 08de638790 start using the shared libasn1c, now that it has aper support 2015-08-31 09:54:45 +02:00
Harald Welte 9da9697f55 makefile: asn1tostruct.py rules for RUA and RANAP 2015-08-31 09:38:13 +02:00
Harald Welte 0bdea4da55 Makefile: chrdir to asn1c subdir and build library there 2015-08-30 23:13:06 +02:00
Harald Welte d523a69dbe import ans1c generated C sources for HNBAP
TODO: split the HNBAP specific code from the core runtime code
and use libosmo-asn1c instead.  This is required as we will be
dealing with multiple ASN.1 data formats from within a single
executable.
2015-08-30 23:11:19 +02:00
Harald Welte 11e0306a3a add .gitignore for src directory 2015-08-30 23:10:13 +02:00
Harald Welte 76427b753b implement HNBAP_DEBUG via osmocore DEBUGP 2015-08-30 23:08:48 +02:00
Harald Welte 339b8e2a77 successful has only one 'l' (copy+paste error) 2015-08-30 23:08:32 +02:00
Harald Welte 4d42551466 actually build + link the asn1c generated HNBAP ASN.1 2015-08-30 23:04:23 +02:00
Harald Welte 27f9c4ab4b migration of code from ffasn1c to asn1c + asn1tostruct.py 2015-08-30 22:48:59 +02:00
Harald Welte 2facbada27 remove ffasn1c generated hnbap.[ch] from source
we want to use asn1c instead.
2015-08-30 19:03:37 +02:00
Harald Welte ee77cff224 hnbgw: Actually link in + call ffasn1c runtime library 2015-08-30 16:57:53 +02:00
Harald Welte c3fa0b0e43 add iu_common.h using C structs to describe PER encoded Iu headers 2015-08-30 16:55:43 +02:00
Harald Welte 30afef3073 move asn.1 helper functions to asn1helpers.[ch] 2015-08-30 12:28:29 +02:00
Harald Welte b3dae30e5e first compiling code (untested) 2015-08-30 12:20:09 +02:00
Harald Welte a2e6a7a05e further tiny steps of progress on the hnb-gw infrastructure 2015-08-29 21:47:39 +02:00
Harald Welte ba43de4bf6 very early intial code snippets for handling HNBAP in a HNB-GW 2015-08-29 20:33:16 +02:00