aboutsummaryrefslogtreecommitdiffstats
path: root/examples/sample.source.ULP
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sample.source.ULP')
-rw-r--r--examples/sample.source.ULP/Makefile339
-rw-r--r--examples/sample.source.ULP/README53
-rw-r--r--examples/sample.source.ULP/config.h10
3 files changed, 402 insertions, 0 deletions
diff --git a/examples/sample.source.ULP/Makefile b/examples/sample.source.ULP/Makefile
new file mode 100644
index 00000000..417be53d
--- /dev/null
+++ b/examples/sample.source.ULP/Makefile
@@ -0,0 +1,339 @@
+ASN_MODULE_SOURCES= \
+ ULP-PDU.c \
+ UlpMessage.c \
+ SUPLINIT.c \
+ Notification.c \
+ NotificationType.c \
+ EncodingType.c \
+ FormatIndicator.c \
+ SLPMode.c \
+ MAC.c \
+ KeyIdentity.c \
+ SUPLSTART.c \
+ SETCapabilities.c \
+ PosTechnology.c \
+ PrefMethod.c \
+ PosProtocol.c \
+ SUPLRESPONSE.c \
+ SETAuthKey.c \
+ KeyIdentity4.c \
+ SUPLPOSINIT.c \
+ RequestedAssistData.c \
+ NavigationModel.c \
+ SatelliteInfo.c \
+ SatelliteInfoElement.c \
+ SUPLPOS.c \
+ PosPayLoad.c \
+ SUPLEND.c \
+ SUPLAUTHREQ.c \
+ SETNonce.c \
+ KeyIdentity2.c \
+ SUPLAUTHRESP.c \
+ SPCAuthKey.c \
+ KeyIdentity3.c \
+ Version.c \
+ SessionID.c \
+ SetSessionID.c \
+ SETId.c \
+ SlpSessionID.c \
+ IPAddress.c \
+ SLPAddress.c \
+ FQDN.c \
+ Ver.c \
+ LocationId.c \
+ Status.c \
+ CellInfo.c \
+ Position.c \
+ PositionEstimate.c \
+ AltitudeInfo.c \
+ CdmaCellInformation.c \
+ GsmCellInformation.c \
+ WcdmaCellInformation.c \
+ FrequencyInfo.c \
+ FrequencyInfoFDD.c \
+ FrequencyInfoTDD.c \
+ UARFCN.c \
+ NMR.c \
+ NMRelement.c \
+ MeasuredResultsList.c \
+ MeasuredResults.c \
+ CellMeasuredResultsList.c \
+ UTRA-CarrierRSSI.c \
+ CellMeasuredResults.c \
+ CellParametersID.c \
+ TGSN.c \
+ PrimaryCCPCH-RSCP.c \
+ TimeslotISCP.c \
+ TimeslotISCP-List.c \
+ PrimaryCPICH-Info.c \
+ CPICH-Ec-N0.c \
+ CPICH-RSCP.c \
+ Pathloss.c \
+ StatusCode.c \
+ QoP.c \
+ Velocity.c \
+ Horvel.c \
+ Horandvervel.c \
+ Horveluncert.c \
+ Horandveruncert.c \
+ PosMethod.c
+
+ASN_MODULE_HEADERS= \
+ ULP-PDU.h \
+ UlpMessage.h \
+ SUPLINIT.h \
+ Notification.h \
+ NotificationType.h \
+ EncodingType.h \
+ FormatIndicator.h \
+ SLPMode.h \
+ MAC.h \
+ KeyIdentity.h \
+ SUPLSTART.h \
+ SETCapabilities.h \
+ PosTechnology.h \
+ PrefMethod.h \
+ PosProtocol.h \
+ SUPLRESPONSE.h \
+ SETAuthKey.h \
+ KeyIdentity4.h \
+ SUPLPOSINIT.h \
+ RequestedAssistData.h \
+ NavigationModel.h \
+ SatelliteInfo.h \
+ SatelliteInfoElement.h \
+ SUPLPOS.h \
+ PosPayLoad.h \
+ SUPLEND.h \
+ SUPLAUTHREQ.h \
+ SETNonce.h \
+ KeyIdentity2.h \
+ SUPLAUTHRESP.h \
+ SPCAuthKey.h \
+ KeyIdentity3.h \
+ Version.h \
+ SessionID.h \
+ SetSessionID.h \
+ SETId.h \
+ SlpSessionID.h \
+ IPAddress.h \
+ SLPAddress.h \
+ FQDN.h \
+ Ver.h \
+ LocationId.h \
+ Status.h \
+ CellInfo.h \
+ Position.h \
+ PositionEstimate.h \
+ AltitudeInfo.h \
+ CdmaCellInformation.h \
+ GsmCellInformation.h \
+ WcdmaCellInformation.h \
+ FrequencyInfo.h \
+ FrequencyInfoFDD.h \
+ FrequencyInfoTDD.h \
+ UARFCN.h \
+ NMR.h \
+ NMRelement.h \
+ MeasuredResultsList.h \
+ MeasuredResults.h \
+ CellMeasuredResultsList.h \
+ UTRA-CarrierRSSI.h \
+ CellMeasuredResults.h \
+ CellParametersID.h \
+ TGSN.h \
+ PrimaryCCPCH-RSCP.h \
+ TimeslotISCP.h \
+ TimeslotISCP-List.h \
+ PrimaryCPICH-Info.h \
+ CPICH-Ec-N0.h \
+ CPICH-RSCP.h \
+ Pathloss.h \
+ StatusCode.h \
+ QoP.h \
+ Velocity.h \
+ Horvel.h \
+ Horandvervel.h \
+ Horveluncert.h \
+ Horandveruncert.h \
+ PosMethod.h
+
+ASN_MODULE_HEADERS+=BOOLEAN.h
+ASN_MODULE_SOURCES+=BOOLEAN.c
+ASN_MODULE_HEADERS+=ENUMERATED.h
+ASN_MODULE_SOURCES+=ENUMERATED.c
+ASN_MODULE_HEADERS+=INTEGER.h
+ASN_MODULE_HEADERS+=NativeEnumerated.h
+ASN_MODULE_HEADERS+=GeneralizedTime.h
+ASN_MODULE_SOURCES+=GeneralizedTime.c
+ASN_MODULE_HEADERS+=IA5String.h
+ASN_MODULE_SOURCES+=IA5String.c
+ASN_MODULE_SOURCES+=INTEGER.c
+ASN_MODULE_SOURCES+=NativeEnumerated.c
+ASN_MODULE_HEADERS+=NativeInteger.h
+ASN_MODULE_SOURCES+=NativeInteger.c
+ASN_MODULE_HEADERS+=UTCTime.h
+ASN_MODULE_SOURCES+=UTCTime.c
+ASN_MODULE_HEADERS+=VisibleString.h
+ASN_MODULE_SOURCES+=VisibleString.c
+ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h
+ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c
+ASN_MODULE_HEADERS+=asn_SET_OF.h
+ASN_MODULE_SOURCES+=asn_SET_OF.c
+ASN_MODULE_HEADERS+=constr_CHOICE.h
+ASN_MODULE_SOURCES+=constr_CHOICE.c
+ASN_MODULE_HEADERS+=constr_SEQUENCE.h
+ASN_MODULE_SOURCES+=constr_SEQUENCE.c
+ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h
+ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c
+ASN_MODULE_HEADERS+=constr_SET_OF.h
+ASN_MODULE_SOURCES+=constr_SET_OF.c
+ASN_MODULE_HEADERS+=asn_application.h
+ASN_MODULE_HEADERS+=asn_system.h
+ASN_MODULE_HEADERS+=asn_codecs.h
+ASN_MODULE_HEADERS+=asn_internal.h
+ASN_MODULE_HEADERS+=OCTET_STRING.h
+ASN_MODULE_SOURCES+=OCTET_STRING.c
+ASN_MODULE_HEADERS+=BIT_STRING.h
+ASN_MODULE_SOURCES+=BIT_STRING.c
+ASN_MODULE_SOURCES+=asn_codecs_prim.c
+ASN_MODULE_HEADERS+=asn_codecs_prim.h
+ASN_MODULE_HEADERS+=ber_tlv_length.h
+ASN_MODULE_SOURCES+=ber_tlv_length.c
+ASN_MODULE_HEADERS+=ber_tlv_tag.h
+ASN_MODULE_SOURCES+=ber_tlv_tag.c
+ASN_MODULE_HEADERS+=ber_decoder.h
+ASN_MODULE_SOURCES+=ber_decoder.c
+ASN_MODULE_HEADERS+=der_encoder.h
+ASN_MODULE_SOURCES+=der_encoder.c
+ASN_MODULE_HEADERS+=constr_TYPE.h
+ASN_MODULE_SOURCES+=constr_TYPE.c
+ASN_MODULE_HEADERS+=constraints.h
+ASN_MODULE_SOURCES+=constraints.c
+ASN_MODULE_HEADERS+=xer_support.h
+ASN_MODULE_SOURCES+=xer_support.c
+ASN_MODULE_HEADERS+=xer_decoder.h
+ASN_MODULE_SOURCES+=xer_decoder.c
+ASN_MODULE_HEADERS+=xer_encoder.h
+ASN_MODULE_SOURCES+=xer_encoder.c
+ASN_MODULE_HEADERS+=per_support.h
+ASN_MODULE_SOURCES+=per_support.c
+ASN_MODULE_HEADERS+=per_decoder.h
+ASN_MODULE_SOURCES+=per_decoder.c
+ASN_MODULE_HEADERS+=per_encoder.h
+ASN_MODULE_SOURCES+=per_encoder.c
+ASN_MODULE_HEADERS+=per_opentype.h
+ASN_MODULE_SOURCES+=per_opentype.c
+ASN_CONVERTER_SOURCES+=converter-sample.c
+
+
+lib_LTLIBRARIES=libsomething.la
+libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS)
+
+# This file may be used as an input for make(3)
+# Remove the lines below to convert it into a pure .am file
+TARGET = ulp-dump
+CFLAGS += -DASN_CONVERTER_TITLE="OMA UserPlane Location Protocol decoder" -DHAVE_CONFIG_H -DJUNKTEST -DPDU=ULP_PDU -I.
+OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}
+
+all: ULP-PDU.c $(TARGET)
+
+$(TARGET): ${OBJS}
+ $(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+.c.o:
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+clean:
+ rm -f $(TARGET)
+ rm -f $(OBJS)
+
+regen: regenerate-from-asn1-source
+
+regenerate-from-asn1-source:
+ ../../asn1c/asn1c -S ../../skeletons -pdu=ULP-PDU -fcompound-names -gen-PER ../ulp.asn1
+
+
+ULP-PDU.c: ../sample.makefile.regen ../ulp.asn1
+ make regen-makefile
+ @touch ULP-PDU.c
+ make
+
+regen-makefile:
+ TITLE="OMA UserPlane Location Protocol decoder" \
+ ASN1CMDOPTS="-fcompound-names -gen-PER" \
+ ASN1MODULES="../ulp.asn1" \
+ ASN1PDU=ULP-PDU \
+ PROGNAME=ulp-dump \
+ ../sample.makefile.regen
+
+check: ${TARGET} check-ber check-xer check-per
+ @echo ================
+ @echo All tests passed
+ @echo ================
+
+check-ber:
+ @if test -f sample-ULP-PDU-1.[db]er ; then \
+ for f in sample-ULP-PDU-*.[db]er; do \
+ for b in 1 17 33 980 8192; do \
+ echo "Recoding $$f into XER and back ($$b)..."; \
+ ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
+ ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
+ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
+ rm -f ./.tmp.[12].$$$$; \
+ echo "Test junking $$f (please wait)..."; \
+ ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \
+ ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \
+ done; done; fi
+
+check-xer:
+ @if test -f sample-ULP-PDU-1.xer ; then \
+ for f in sample-ULP-PDU-*.xer; do \
+ for b in 1 17 33 980 8192; do \
+ echo "Recoding $$f into DER and back ($$b)..."; \
+ ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
+ diff $$f ./.tmp.2.$$$$ || exit 4; \
+ rm -f ./.tmp.[12].$$$$; \
+ echo "Test junking $$f (please wait)..."; \
+ ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \
+ ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \
+ done; done; fi
+
+check-per:
+ @if test -f sample-ULP-PDU-1-nopad.per ; then \
+ for f in sample-ULP-PDU-[1-9]-nopad.per; do \
+ for b in 1 17 33 980 8192; do \
+ echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \
+ ./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
+ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
+ ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
+ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
+ rm -f ./.tmp.[123].$$$$; \
+ echo "Test junking $$f (please wait)..."; \
+ ./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \
+ ./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \
+ done; done; fi
+ @if test -f sample-ULP-PDU-1.per ; then \
+ for f in sample-*-[1-9].per; do \
+ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \
+ for b in 1 17 33 980 8192; do \
+ echo "Recoding $$f into DER into XER and back ($$b)..."; \
+ ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
+ ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
+ ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
+ diff $$f ./.tmp.1.$$$$ || exit 6; \
+ rm -f ./.tmp.[12].$$$$; \
+ echo "Test junking $$f (please wait)..."; \
+ ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \
+ ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \
+ done; done; fi
+
+distclean: clean
+ rm -f $(ASN_MODULE_SOURCES)
+ rm -f $(ASN_MODULE_HEADERS)
+ rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
+ rm -f Makefile.am.sample
diff --git a/examples/sample.source.ULP/README b/examples/sample.source.ULP/README
new file mode 100644
index 00000000..88f71587
--- /dev/null
+++ b/examples/sample.source.ULP/README
@@ -0,0 +1,53 @@
+
+GENERAL INFORMATION
+===================
+
+The OMA ULP (UserPlane Location Protocol) decoder.
+Invoking `make` will compile the ASN.1 specifications from the
+../ulp.asn1 file.
+
+THERE IS NO ulp.asn1 FILE THERE YET!
+
+OBTAINING THE ULP SPECIFICATION
+===============================
+
+Due to unclear stanza of Open Mobile Alliance regarding the extraction of
+ASN.1 modules from their documents, and also due to some OMA membership
+concerns, asn1c can not include the ULP ASN.1 module in its distribution.
+
+To obtain the ULP ASN.1 specification, you should go to
+ http://www.openmobilealliance.org/UseAgreement.html
+and agree with their licensing terms by clicking the "I ACCEPT" button.
+
+Then, go to http://member.openmobilealliance.org/ftp/Public_documents/LOC/Permanent_documents/
+and download the necessary specification file. For example, one of these:
+ Version 1.0 specifications (Candidate versions):
+ OMA-TS-ULP-V1_0-20070122-C.zip (V1.0, 2007 January 22)
+ OMA-TS-ULP-V1_0-20070613-C.zip (V1.0, 2007 June 13)
+ Version 2.0 specification (Draft version):
+ OMA-TS-ULP-V2_0-20070625-D.zip (V2.0, 2007 April 25)
+
+A .ZIP file with several Microsoft Word .DOC files will download shortly.
+
+You should extract the ASN.1 module from the section 8 of these .DOC files
+and save it as the ../ulp.asn1 file. The ../ulp.asn1 file should start with
+the following line
+ "ULP DEFINITIONS IMPLICIT TAGS ::="
+and end with the "END" token.
+Be careful not to copy any non-ASN.1 preambles from that .DOC file.
+
+After obtaining the tap3.asn1, type `make` in the directory containing
+this README file.
+
+ulp-dump USAGE
+==============
+
+The ulp-dump utility may be used to dump the contents of the PER-encoded
+ULP message record file:
+
+ ./ulp-dump ulpfile.per # Print as XML (BASIC-XER)
+
+The full list of recognized command line options may be obtained with
+
+ > ./ulp-dump -h
+
diff --git a/examples/sample.source.ULP/config.h b/examples/sample.source.ULP/config.h
new file mode 100644
index 00000000..2dda9297
--- /dev/null
+++ b/examples/sample.source.ULP/config.h
@@ -0,0 +1,10 @@
+
+extern int opt_debug;
+
+#define ASN_DEBUG(fmt, args...) do { \
+ if(opt_debug < 2) break; \
+ fprintf(stderr, fmt, ##args); \
+ fprintf(stderr, " (%s:%d)\n", \
+ __FILE__, __LINE__); \
+ } while(0)
+