Open Mobile Alliance UserPlane Location Protocol
diff --git a/examples/README b/examples/README
index 42910a8..e97683d 100644
--- a/examples/README
+++ b/examples/README
@@ -15,11 +15,15 @@
    Lightweight Directory Access Protocol version 3 PDU as specified in
    rfc4211.txt.
 
+6. The ./sample.source.RRC directory contains the 3GPP Radio Resource Control
+   decoder. Just type `make` in there to compile.
+
 5. The ./sample.source.TAP3 directory contains the GSM TAP3 decoder.
    Before trying to compile, read the README file in that directory.
 
-6. The ./sample.source.RRC directory contains the 3GPP Radio Resource Control
-   decoder. Just type `make` in there to compile.
+6. The ./sample.source.ULP directory contains the Open Mobile Alliance
+   UserPlane Location Protocol decoder. Before trying to compile, read the
+   README file in that directory.
 
 The clyx2asn1.pl script can be used to extract ASN.1 data from LyX editor files.
 
diff --git a/examples/sample.makefile.regen b/examples/sample.makefile.regen
index 5e18947..50551b2 100755
--- a/examples/sample.makefile.regen
+++ b/examples/sample.makefile.regen
@@ -39,9 +39,8 @@
 fi
 
 EXTRA_CFLAGS="-DJUNKTEST"
-if test -f config.h ; then
-	EXTRA_CFLAGS="-DHAVE_CONFIG_H ${EXTRA_CFLAGS}"
-fi
+test -f config.h && EXTRA_CFLAGS="-DHAVE_CONFIG_H ${EXTRA_CFLAGS}"
+test -n "$TITLE" && EXTRA_CFLAGS="-DASN_CONVERTER_TITLE=\"$TITLE\" ${EXTRA_CFLAGS}"
 
 set -x
 cat Makefile.am.sample						\
@@ -58,6 +57,7 @@
 	echo "	make"
 	echo
 	echo "regen-makefile:"
+	test -n "$TITLE" && echo "	TITLE=\"$TITLE\" \\"
 	echo "	ASN1CMDOPTS=\"${ASN1CMDOPTS}\" \\"
 	echo "	ASN1MODULES=\"${ASN1MODULES}\" \\"
 	echo "	ASN1PDU=${ASN1PDU} \\"
diff --git a/examples/sample.source.LDAP3/Makefile b/examples/sample.source.LDAP3/Makefile
index b47bbcc..c47e22f 100644
--- a/examples/sample.source.LDAP3/Makefile
+++ b/examples/sample.source.LDAP3/Makefile
@@ -154,6 +154,8 @@
 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
 
 
@@ -163,7 +165,7 @@
 # This file may be used as an input for make(3)
 # Remove the lines below to convert it into a pure .am file
 TARGET = ldap3dump
-CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -DPDU=LDAPMessage -I.
+CFLAGS += -DASN_CONVERTER_TITLE="Lightweight Directory Access Protocol V3 decoder" -DHAVE_CONFIG_H -DJUNKTEST -DPDU=LDAPMessage -I.
 OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}
 
 all: LDAPMessage.c $(TARGET)
@@ -193,6 +195,7 @@
 	make
 
 regen-makefile:
+	TITLE="Lightweight Directory Access Protocol V3 decoder" \
 	ASN1CMDOPTS="-fcompound-names" \
 	ASN1MODULES="../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1" \
 	ASN1PDU=LDAPMessage \
diff --git a/examples/sample.source.MEGACO/Makefile b/examples/sample.source.MEGACO/Makefile
index 47507af..1784c30 100644
--- a/examples/sample.source.MEGACO/Makefile
+++ b/examples/sample.source.MEGACO/Makefile
@@ -276,6 +276,8 @@
 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
 
 
@@ -332,12 +334,12 @@
 	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 2; \
-	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || 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 2; \
-	./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 2; \
+	./${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:
@@ -346,41 +348,41 @@
 	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 2; \
-	diff $$f ./.tmp.2.$$$$ || 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 2; \
-	./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 2; \
+	./${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-MegacoMessage-1.per ; then \
-	for f in sample-MegacoMessage-[1-9].per; do \
+	@if test -f sample-MegacoMessage-1-nopad.per ; then \
+	for f in sample-MegacoMessage-[1-9]-nopad.per; do \
 	for b in 1 17 33 980 8192; do \
-	echo "Recoding $$f into DER into XER and back ($$b)..."; \
-	./${TARGET} -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
-	./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
-	./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \
-	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \
+	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 -iper -onull $$f || exit 2; \
-	./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 2; \
+	./${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-MegacoMessage-1-padded.per ; then \
-	for f in sample-*-[1-9]-padded.per; do \
+	@if test -f sample-MegacoMessage-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 byte-padded $$f into DER into XER and back ($$b)..."; \
-	./${TARGET} -b $$b -per-padded -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
-	./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \
-	./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \
-	diff $$f ./.tmp.1.$$$$ || exit 2; \
+	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 -per-padded -iper -onull $$f || exit 2; \
-	./${TARGET} -J0.001 -n 1000 -b $$b -per-padded -iper -onull $$f || exit 2; \
+	./${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
diff --git a/examples/sample.source.PKIX1/Makefile b/examples/sample.source.PKIX1/Makefile
index da4029e..112b517 100644
--- a/examples/sample.source.PKIX1/Makefile
+++ b/examples/sample.source.PKIX1/Makefile
@@ -336,6 +336,8 @@
 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
 
 
diff --git a/examples/sample.source.RRC/Makefile b/examples/sample.source.RRC/Makefile
index 5ecd357..6c5dd4a 100644
--- a/examples/sample.source.RRC/Makefile
+++ b/examples/sample.source.RRC/Makefile
@@ -4730,6 +4730,8 @@
 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
 ASN_CONVERTER_SOURCES+=pdu_collection.c
 
diff --git a/examples/sample.source.TAP3/Makefile b/examples/sample.source.TAP3/Makefile
index 491d08c..6a44b5b 100644
--- a/examples/sample.source.TAP3/Makefile
+++ b/examples/sample.source.TAP3/Makefile
@@ -618,8 +618,6 @@
 
 ASN_MODULE_HEADERS+=INTEGER.h
 ASN_MODULE_HEADERS+=NativeEnumerated.h
-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
@@ -670,6 +668,8 @@
 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
 
 
@@ -679,7 +679,7 @@
 # This file may be used as an input for make(3)
 # Remove the lines below to convert it into a pure .am file
 TARGET = tap3dump
-CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -DPDU=DataInterChange -I.
+CFLAGS += -DASN_CONVERTER_TITLE="GSM TAP3 (Transferred Account Procedure, Version 3) decoder" -DHAVE_CONFIG_H -DJUNKTEST -DPDU=DataInterChange -I.
 OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}
 
 all: DataInterChange.c $(TARGET)
@@ -709,6 +709,7 @@
 	make
 
 regen-makefile:
+	TITLE="GSM TAP3 (Transferred Account Procedure, Version 3) decoder" \
 	ASN1CMDOPTS="" \
 	ASN1MODULES="../tap3.asn1" \
 	ASN1PDU=DataInterChange \
diff --git a/examples/sample.source.ULP/Makefile b/examples/sample.source.ULP/Makefile
new file mode 100644
index 0000000..417be53
--- /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 0000000..88f7158
--- /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 0000000..2dda929
--- /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)
+