Commit Graph

687 Commits

Author SHA1 Message Date
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
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 9614d9aea7 add more relevant/related specs 2015-10-07 15:59:45 +02: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