HNBAP, RUA and RANAP protocol codecs

This patch introduces protocol codecs for the HNBAP, RUA and RANAP
protocols, which is mandatory for testing IuCS, IuPS or Iuh in
the future.

As Eclipse TITAN ASN.1 only supports the BER codec and the above
protocols all use APER, we need to use an external transcoder from
APER to BER and vice-versa.  This was implemented using a proprietary
ASN.1 compiler / trnaslator which sysmocom is packaging as
libfftranscode, which is made available as binary package
for Debian 9 at https://ftp.osmocom.org/binaries/libfftranscode/

Related: OS#2856, OS#2857, OS#2858
Change-Id: If4a72de9bc54d6e6a7daaca78a4d4aa5684203a5
diff --git a/library/hnbap/HNBAP_IEs.asn b/library/hnbap/HNBAP_IEs.asn
new file mode 100644
index 0000000..3a4fa1c
--- /dev/null
+++ b/library/hnbap/HNBAP_IEs.asn
@@ -0,0 +1,518 @@
+-- HNBAP-IEs.asn
+--
+-- 3GPP TS 25.469 V10.1.0 (2011-06)
+-- http://www.3gpp.org/ftp/Specs/html-info/25469.htm
+--
+-- 9.3.4	Information Element Definitions
+--
+
+-- **************************************************************
+--
+-- Information Element Definitions
+--
+-- **************************************************************
+
+HNBAP-IEs {
+itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) 
+umts-Access (20) modules (3) hnbap(6) version1 (1) hnbap-IEs (2) }
+
+DEFINITIONS AUTOMATIC TAGS ::= 
+
+BEGIN
+
+IMPORTS
+	maxNrOfErrors,
+	maxnoofRABs,
+	maxnoofNeighbours,
+	maxnoofIurhAddresses,
+	id-HNB-Internet-Information,
+	id-HNB-Cell-Identifier
+	
+FROM HNBAP-Constants
+
+	Criticality,
+	ProcedureCode,
+	ProtocolIE-ID,
+	TriggeringMessage
+FROM HNBAP-CommonDataTypes
+
+	ProtocolExtensionContainer{},
+	HNBAP-PROTOCOL-EXTENSION
+FROM HNBAP-Containers;
+
+
+--A
+Access-stratum-release-indicator ::=	ENUMERATED {r99,
+										rel-4, rel-5, rel-6, rel-7, rel-8-and-beyond,
+										...}
+
+AccessResult	::=		ENUMERATED {allowed, notAllowed, ...}
+
+AltitudeAndDirection ::= SEQUENCE {
+	directionOfAltitude		ENUMERATED {height, depth},
+	altitude		INTEGER (0..32767),
+	...
+}
+
+--B
+BackoffTimer ::= INTEGER(0..3600)
+
+BindingID	::= OCTET STRING(SIZE(1..4,...))
+
+--C
+Cause ::= CHOICE {
+	radioNetwork			CauseRadioNetwork,
+	transport				CauseTransport,
+	protocol				CauseProtocol,
+	misc					CauseMisc,
+	...
+}
+CauseRadioNetwork ::= ENUMERATED {
+	overload,
+	unauthorised-Location,
+	unauthorised-HNB,
+	hNB-parameter-mismatch,
+	invalid-UE-identity,
+	uE-not-allowed-on-this-HNB,
+	uE-unauthorised,
+	connection-with-UE-lost,
+	ue-RRC-telease,
+	hNB-not-registered,
+	unspecified,
+	normal,
+	uE-relocated,
+	ue-registered-in-another-HNB,
+	...
+}
+
+CauseTransport ::= ENUMERATED {
+	transport-resource-unavailable,
+	unspecified,
+	...
+}
+
+CauseProtocol ::= ENUMERATED {
+	transfer-syntax-error,
+	abstract-syntax-error-reject,
+	abstract-syntax-error-ignore-and-notify,
+	message-not-compatible-with-receiver-state,
+	semantic-error,
+	unspecified,
+	abstract-syntax-error-falsely-constructed-message,
+	...
+}
+
+CauseMisc ::= ENUMERATED {
+	processing-overload,
+	hardware-failure,
+	o-and-m-intervention,
+	unspecified,
+	...
+}
+						
+CellIdentity ::=		BIT STRING (SIZE (28))
+
+Context-ID	::=	 BIT STRING (SIZE(24))
+
+CriticalityDiagnostics ::= SEQUENCE {
+	procedureCode				ProcedureCode													OPTIONAL,
+	triggeringMessage			TriggeringMessage												OPTIONAL,
+	procedureCriticality		Criticality														OPTIONAL,
+	iEsCriticalityDiagnostics	CriticalityDiagnostics-IE-List									OPTIONAL,
+	iE-Extensions				ProtocolExtensionContainer { {CriticalityDiagnostics-ExtIEs} } 	OPTIONAL,
+	...
+}
+
+CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1..maxNrOfErrors)) OF
+	SEQUENCE {
+		iECriticality			Criticality,
+		iE-ID					ProtocolIE-ID,
+		typeOfError				TypeOfError,
+		iE-Extensions			ProtocolExtensionContainer { {CriticalityDiagnostics-IE-List-ExtIEs} }	OPTIONAL,
+		...
+	}
+
+CriticalityDiagnostics-IE-List-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+CriticalityDiagnostics-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+CSG-ID			::=	BIT STRING (SIZE (27))
+
+CSG-Capability	::=	ENUMERATED {
+				csg-capable,
+				not-csg-capable,
+				...
+			}
+
+CSGMembershipStatus ::= ENUMERATED { 
+	member, 
+	non-member,
+	...
+}
+
+CGI ::= SEQUENCE {
+	pLMNidentity		PLMNidentity,
+	lAC					LAC,
+	cI					CI,
+	iE-Extensions		ProtocolExtensionContainer { {CGI-ExtIEs} } OPTIONAL
+}
+
+CGI-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+CI					::= OCTET STRING (SIZE (2))
+
+
+CN-DomainIndicator ::= ENUMERATED { 
+	cs-domain, 
+	ps-domain 
+}
+--D
+--E
+ESN		::=	BIT STRING (SIZE(32))
+--F
+--G
+GeographicalLocation ::= SEQUENCE {
+	geographicalCoordinates		GeographicalCoordinates,
+	altitudeAndDirection		AltitudeAndDirection,
+	iE-Extensions				ProtocolExtensionContainer { { GeographicLocation-ExtIEs} } OPTIONAL,
+	...
+}
+
+GeographicLocation-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+GeographicalCoordinates ::= SEQUENCE {
+	latitudeSign			ENUMERATED {north, south},
+	latitude				INTEGER (0..8388607),
+	longitude				INTEGER (-8388608..8388607),
+	iE-Extensions			ProtocolExtensionContainer { {GeographicalCoordinates-ExtIEs} }		OPTIONAL,
+	...
+}
+
+GeographicalCoordinates-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+GTP-TEI					::= OCTET STRING (SIZE (4))
+
+--H
+
+HNB-Cell-Access-Mode::= ENUMERATED {
+	closed,
+	hybrid,
+	open,
+	... 
+}
+
+HNB-Cell-Identifier	::= 	SEQUENCE	{
+	pLMNidentity			PLMNidentity,
+	cellIdentity			CellIdentity,
+	iE-Extensions			ProtocolExtensionContainer { { HNB-Cell-Identifier-ExtIEs } }		OPTIONAL,
+	...
+}
+
+HNB-Cell-Identifier-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+HNB-RNL-Identity	::= 	CHOICE	{
+	hNB-Identity-as-Cell-Identifier	HNB-Cell-Identifier,
+	...
+}
+
+HNBConfigInfo	::= 	SEQUENCE	{
+	hnb-RNL-Identity					HNB-RNL-Identity,
+	configurationInformation			ConfigurationInformation,
+	iE-Extensions						ProtocolExtensionContainer { { HNBConfigInfo-ExtIEs } }		OPTIONAL,
+	...
+}
+
+HNBConfigInfo-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+ConfigurationInformation ::= CHOICE {
+	provided	HNBConfigurationInformationProvided,
+	missing		HNBConfigurationInformationMissing,
+	...
+}
+
+HNBConfigurationInformationProvided ::= SEQUENCE {
+
+	psc									PSC				OPTIONAL,
+	cSG-ID								CSG-ID				OPTIONAL,
+	hNB-Cell-Access-Mode				HNB-Cell-Access-Mode,
+	iurh-Signalling-TNL-AddressList		Iurh-Signalling-TNL-AddressList,
+	iE-Extensions						ProtocolExtensionContainer { { HNBConfigurationInformationProvided-ExtIEs } }		OPTIONAL,
+	...
+}
+
+HNBConfigurationInformationProvided-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+HNBConfigurationInformationMissing ::= SEQUENCE {
+	cause					Cause,
+	iE-Extensions			ProtocolExtensionContainer { { HNBConfigurationInformationMissing-ExtIEs } }		OPTIONAL,
+	...
+}
+
+HNBConfigurationInformationMissing-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+HNB-Location-Information	::=	SEQUENCE	{
+	macroCoverageInfo		MacroCoverageInformation	OPTIONAL,
+	geographicalCoordinates	GeographicalLocation	OPTIONAL,
+	iE-Extensions			ProtocolExtensionContainer { { HNB-Location-Information-ExtIEs } }		OPTIONAL,
+		...
+}
+
+HNB-Location-Information-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+-- Extension for release-8 to support IP address for location verification --
+{ID id-HNB-Internet-Information	CRITICALITY reject	EXTENSION IP-Address	PRESENCE optional	},
+	...
+}
+
+
+
+HNB-Identity	::=		SEQUENCE {
+	hNB-Identity-Info		HNB-Identity-Info,
+	iE-Extensions		ProtocolExtensionContainer { { HNB-Identity-ExtIEs } }		OPTIONAL,
+	...
+}
+
+HNB-Identity-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+
+HNB-Identity-Info ::= OCTET STRING (SIZE (1..255))
+
+--I
+
+IMEI					::= BIT STRING (SIZE(60))
+
+IMSI					::= OCTET STRING (SIZE (3..8))
+-- Reference: 23.003
+IMSIDS41				::= OCTET STRING (SIZE (5..7))
+
+IMSIESN				::= SEQUENCE {
+	iMSIDS41		IMSIDS41,
+	eSN				ESN
+}	
+
+
+IP-Address		::=SEQUENCE {
+		ipaddress		CHOICE {
+		ipv4info		Ipv4Address,
+		ipv6info		Ipv6Address,
+		...
+		},
+	iE-Extensions		ProtocolExtensionContainer { { IP-Address-ExtIEs } }		OPTIONAL,
+		...
+}
+
+IP-Address-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+Ipv4Address		::= OCTET STRING (SIZE (4))
+
+Ipv6Address		::= OCTET STRING (SIZE (16))
+
+Iurh-Signalling-TNL-AddressList ::= SEQUENCE (SIZE(1..maxnoofIurhAddresses)) OF	IP-Address
+
+
+--J
+--K
+--L
+LAC			::= OCTET STRING(SIZE(2))
+
+LAI			::= SEQUENCE {
+	pLMNID		PLMNidentity,
+	lAC			LAC,
+	...
+			}
+			
+-- M
+
+MacroCoverageInformation	::= SEQUENCE {
+		cellIdentity		MacroCellID,
+		iE-Extensions		ProtocolExtensionContainer { { MacroCoverageInformation-ExtIEs } }		OPTIONAL,
+		...
+}
+
+MacroCoverageInformation-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+MacroCellID ::= CHOICE {
+	uTRANCellID			UTRANCellID, 
+	gERANCellID			CGI,
+	...
+}
+
+MuxPortNumber ::= INTEGER (1024..65535)
+
+--N
+
+NeighbourInfoList	::=	SEQUENCE (SIZE(1..maxnoofNeighbours)) OF	HNBConfigInfo
+
+NeighbourInfoRequestList	::=	SEQUENCE (SIZE(1..maxnoofNeighbours)) OF	NeighbourInfoRequestItem
+
+NeighbourInfoRequestItem ::= SEQUENCE {
+	hnb-RNL-Identity	HNB-RNL-Identity,
+	iE-Extensions		ProtocolExtensionContainer { { NeighbourInfoRequestItem-ExtIEs } }		OPTIONAL,
+	...
+}
+
+NeighbourInfoRequestItem-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+--O
+--P
+PLMNidentity 				::= OCTET STRING (SIZE (3))
+
+PSC			::= BIT STRING (SIZE(9))
+
+PTMSI		::=	BIT STRING (SIZE(32))
+
+PTMSIRAI		::= SEQUENCE {
+	pTMSI		PTMSI,
+	rAI			RAI,
+	...
+	}
+	
+
+--Q
+--R
+
+RAB-ID		::= BIT STRING (SIZE (8))
+
+RABList		::= SEQUENCE (SIZE(1..maxnoofRABs)) OF RABListItem
+
+RABListItem	::= SEQUENCE {
+	rAB-ID						RAB-ID,
+	old-transport-Info			TransportInfo,
+	new-transport-Info			TransportInfo,
+	cn-domain-indicator			CN-DomainIndicator,
+	iE-Extensions		ProtocolExtensionContainer { { RABListItem-ExtIEs } }		OPTIONAL,
+...
+}
+
+RABListItem-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+RAC			::= OCTET STRING(SIZE(1))
+
+RAI			::= SEQUENCE {
+	lAI			LAI,
+	rAC			RAC,
+	...
+}
+
+
+Registration-Cause	::= ENUMERATED {
+				emergency-call,
+				normal,
+				...,
+				ue-relocation
+			}
+
+RNC-ID	::=	INTEGER(0..65535)
+
+--S
+
+SAC			::= OCTET STRING(SIZE(2))
+
+--T
+TMSILAI		::=	SEQUENCE {
+	tMSI		BIT STRING(SIZE (32)),
+	lAI			LAI
+}
+
+TMSIDS41	::=		OCTET STRING (SIZE (2..17))
+
+TransportInfo	::= SEQUENCE {
+	transportLayerAddress		TransportLayerAddress,
+	transportAssociation		CHOICE	{
+	gtp-TEI						GTP-TEI,
+	bindingID					BindingID,
+	...
+	},
+	iE-Extensions		ProtocolExtensionContainer { { TransportInfo-ExtIEs } }		OPTIONAL,
+...
+}
+
+TransportInfo-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+TransportLayerAddress	::= BIT STRING(SIZE(1..160,...))
+
+TypeOfError ::= ENUMERATED {
+	not-understood,
+	missing,
+	...
+}
+--U
+UE-Capabilities ::= SEQUENCE {
+	access-stratum-release-indicator	Access-stratum-release-indicator,
+	csg-capability						CSG-Capability,
+	iE-Extensions		ProtocolExtensionContainer { { UE-Capabilities-ExtIEs } }		OPTIONAL,
+...
+}
+
+UE-Capabilities-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+
+UTRANCellID ::= SEQUENCE {
+	lAC						LAC,
+	rAC						RAC,
+	pLMNidentity			PLMNidentity,
+	uTRANcellID				CellIdentity,
+	iE-Extensions			ProtocolExtensionContainer { {UTRANCellID-ExtIEs} } OPTIONAL
+}
+
+UTRANCellID-ExtIEs HNBAP-PROTOCOL-EXTENSION ::= {
+	...
+}
+							
+
+
+UE-Identity	::=	CHOICE {
+	iMSI		IMSI,
+	tMSILAI		TMSILAI,
+	pTMSIRAI	PTMSIRAI,
+	iMEI		IMEI,
+	eSN			ESN,
+	iMSIDS41	IMSIDS41,
+	iMSIESN		IMSIESN,
+	tMSIDS41	TMSIDS41,
+	...
+}
+
+Update-cause ::=	ENUMERATED {
+	relocation-preparation,
+	...
+}
+
+--V
+--W
+--X
+--Y
+--Z
+
+
+END