path: root/asn1
AgeCommit message (Collapse)AuthorFilesLines
2017-12-26WIP: fix asn1 syntax errorsHarald Welte1-2/+2
Change-Id: Ib6977a9803fdce010eca9fc9a768c89ccf4215f8
2017-12-25compiler warning: asn1tostruct.py: return 0 at end of *_free_*()Neels Hofmeyr1-0/+2
Part of the resulting diff in the generated code: --- /tmp/hnbap_decoder.c 2017-12-24 17:06:50.983979866 +0100 +++ /tmp/hnbap_decoder.c 2017-12-24 17:07:10.760223354 +0100 @@ -1179,6 +1179,7 @@ TNLUpdateResponseIEs_t *tnlUpdateResponseIEs) { ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Context_ID, &tnlUpdateResponseIEs->context_ID); + return 0; } int hnbap_free_tnlupdaterequesties( @@ -1187,6 +1188,7 @@ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Context_ID, &tnlUpdateRequestIEs->context_ID); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_RABList, &tnlUpdateRequestIEs->rabList); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_Update_cause, &tnlUpdateRequestIEs->update_cause); + return 0; } int hnbap_free_errorindicationies( @@ -1197,12 +1199,14 @@ if ((errorIndicationIEs->presenceMask & ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT) == ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT) ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_CriticalityDiagnostics, &errorIndicationIEs->criticalityDiagnostics); + return 0; } int hnbap_free_hnbconfigtransferrequesties( HNBConfigTransferRequestIEs_t *hnbConfigTransferRequestIEs) { ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NeighbourInfoRequestList, &hnbConfigTransferRequestIEs->neighbourInfoRequestList); + return 0; } int hnbap_free_tnlupdatefailureies( [etc.] Related: OS#2670 Change-Id: Ieba12c09c33a81da964bf88a858714d922ced8c0
2017-12-20hnbap,rua,ranap decode: fix segfault on decode errorNeels Hofmeyr1-1/+6
Looking at hnbap_decode_hnbregisterrequesties(), I noticed a segfault if decoding the HNB Register Request PDU fails, which is due to an unchecked return value in code generated by asn1tostruct.py. Add return value and NULL pointer checks and hence fix null dereference on erratic PDUs across HNBAP, RUA and RANAP protocols. Similar checks exist in other places, this one was simply missing. Since the result of asn1tostruct.py is not committed, here is an example diff of the resulting change, of which there are 128 instances in total: @@ -304,7 +329,12 @@ memset(hnbRegisterRequestIEs, 0, sizeof(HNBRegisterRequestIEs_t)); HNBAP_DEBUG("Decoding message HNBRegisterRequestIEs (%s:%d)\n", __FILE__, __LINE__); - ANY_to_type_aper(any_p, &asn_DEF_HNBRegisterRequest, (void**)&hNBRegisterRequest_p); + tempDecoded = ANY_to_type_aper(any_p, &asn_DEF_HNBRegisterRequest, (void**)&hNBRegisterRequest_p); + + if (tempDecoded < 0 || hNBRegisterRequest_p == NULL) { + HNBAP_DEBUG("Decoding of message HNBRegisterRequestIEs failed\n"); + return -1; + } for (i = 0; i < hNBRegisterRequest_p->hnbRegisterRequest_ies.list.count; i++) { IE_t *ie_p; Change-Id: I6cb9cc9a88d22f03befa43f0968a874476fa079d
2017-04-05asn1tostruct.py: specify python version in shebangPau Espin Pedrol1-1/+1
The script is expected to be run using python 2.x, but nowadays some distros are already using python 3 as default, which will fail to run this script. This change fixes compilation in my Archlinux box. Change-Id: I6eb95351538a64f2b23d638824972818591b1b66
2016-07-12asn1tostruct.py: use '#\!/usr/bin/env python', not '#\!/usr/bin/python'Neels Hofmeyr1-1/+1
Change-Id: I0686467e59b35e68bccb38ccfe645f5ccac97941
2016-02-22asn1: Generate _free_*ies function declarationsDaniel Willmann1-0/+12
ranap_ies_defs.h is checked in so update it hnbap_ies_defs.h and rua_ies_defs.h need to be regenerated
2016-01-12asn1tostruct.py: Zero IEs_t target struct in decode functionDaniel Willmann1-0/+1
2016-01-07asn1tostruct: Add memory free functions and use them in HNBAPDaniel Willmann1-1/+30
2016-01-05asn1tostruct.py: don't generate unused local struct instances.Neels Hofmeyr1-3/+2
2015-12-27RANAP-PDU-Contents: fix syntax error regarding InitialUE-MessageHarald Welte1-1/+1
With that syntax error, the RAC was not treated as a possible IE in the InitialUE-Message, causing decoder failure.
2015-12-24RANAP: Replace the last remainng TBCD-STRING with OCTET STRINGHarald Welte1-1/+1
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-22asn1tostruct.py: Fix memory leaks in generated codeDaniel Willmann1-2/+9
The decode_*ies functions did not clean up after them. This change is taken from changes made to asn1tostruct.py in openair-cn repository.
2015-12-22Remove obsolete ffasn1c files.Neels Hofmeyr6-58879/+0
The ffasn1c files from early trials are obsolete, we're using asn1c now.
2015-12-19ranap ASN.1: Define IMSI as OCTET STRING to work around asn1c bugHarald Welte1-1/+1
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-19ranap: Don't forget ProtocolIE-CointainerPair around ProtocolIE-FieldPairHarald Welte1-1/+1
2015-12-18RANAP: Split FormatInformationParameter / SDUParameterItemHarald Welte1-2/+4
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-16One further RANAP hacking sessionHarald Welte2-75/+145
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-16asn1tostruct: Avoid erroneous double-underscoresHarald Welte1-2/+2
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-16RANAP: Add more types/IEs to RANAP-PDU.asn and re-generate CHarald Welte1-1/+363
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-09-11remove obsolete asn1c makefiles in the asn1c/ hierarchyHarald Welte2-12/+0
we are generating the code locally in src/{ranap,rua,hnbap}
2015-09-10ranap: Add more manual definitions to RANAP-PDUsHarald Welte1-0/+121
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-10asn1tostruct.py: Add support for type prefixingHarald Welte1-41/+44
If asn1c generates prefixed type names, the asn1tostruct.py of course also needs to be modified to do so.
2015-08-30asn1tostruct.py: Don't claim copyright on auto-generated codeHarald Welte1-31/+0
It is a legal impossibility to claim copyright on something that has been automatically generated by a computer program.
2015-08-30import ans1tostruct.py from Eurecom OpenAirInterfaceHarald Welte1-0/+515
2015-08-30HNBAP: Remove HNBRegisterAccept / HNBRegisterResposne naming inconsistencyHarald Welte1-4/+4
A HNBRegisterAccept message should not contain HNBRegisterResponse IEs This spec inconsistency is confusing the asn1tostruct.py code generator, so let's remove it.
2015-08-30generate ASN.1 structures for each message withotu iformation object classHarald Welte4-1/+584
this is done semi-automatically using the asn1msgs.pl script.
2015-08-30asn1 syntax fixup for ffasn1cHarald Welte3-16/+4
2015-08-30Add Procedure Codes and IEI constants to CommonDataTypesHarald Welte4-6/+427
... this is what's required for asn1c to generate nice C language enums for it. Conversion was performed semi-automatically by use of asn1enum.pl
2015-08-30RANAP: Further qualify Constants. They're not just integerHarald Welte1-319/+325
2015-08-30RUA ASN.1 Rewrite to avoid information object classesHarald Welte3-14/+63
If we avoid using Information Object Classes in the IE definitions (which are only used for Extension Containers), then we can compile the ASN.1 source using Lev Walkin's asn1c.
2015-08-30RANAP ASN.1 Rewrite to avoid information object classesHarald Welte3-566/+159
If we avoid using Information Object Classes in the IE definitions (which are only used for Extension Containers), then we can compile the ASN.1 source using Lev Walkin's asn1c.
2015-08-30HNBAP ASN.1: Rewrite to avoid information object classesHarald Welte2-107/+76
If we avoid using Information Object Classes in the IE definitions (which are only used for Extension Containers), then we can compile the ASN.1 source using Lev Walkin's asn1c.
2015-08-30ADD IU-Common.asn as an attempt to unify the message parsingHarald Welte1-0/+45
2015-08-30fixup ffasn1Harald Welte3-3/+3
2015-08-30give asn1c generated files more useful namesHarald Welte6-0/+0
2015-08-29Add generated code for RUA using eurecom asn1tostruct.pyHarald Welte3-0/+781
2015-08-29add ffasn1c generated code for HNBAP, RANAP and RUAHarald Welte6-0/+58879
2015-08-29RUA: Add missing RUA-PDU-Contents.asn and RUA-PDU-Descriptions.asnHarald Welte2-0/+361
2015-08-29Import RANAP from 3GPP TS 25.413 V12.4.0 (2015-03)Harald Welte6-0/+7514
2015-08-29Import HNBAP asn.1 from 3GPP TS 25.469 V12.4.0 (2015-03)Harald Welte6-0/+1650
2015-08-29add RUA asn.1 syntax from 3GPP TS 25.468 V12.1.0 (2014-12)Harald Welte4-0/+445