Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 1 | -include Makefile.am.libasncodec |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 2 | |
Lev Walkin | 61c391b | 2006-09-28 09:19:34 +0000 | [diff] [blame] | 3 | TARGET = megaco-dump |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 4 | ASN_LIBRARY=libasncodec.a |
| 5 | LIBS += -lm |
| 6 | CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=MegacoMessage -I. |
| 7 | ASN_CONVERTER_SOURCES := \ |
| 8 | converter-example.c |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 9 | |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 10 | all: maybe-wip-pause MegacoMessage.c $(TARGET) |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 11 | |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 12 | $(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o) |
| 13 | $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS) |
| 14 | |
| 15 | $(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o) |
| 16 | $(AR) rcs $@ $^ |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 17 | |
| 18 | .SUFFIXES: |
| 19 | .SUFFIXES: .c .o |
| 20 | |
| 21 | .c.o: |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 22 | $(CC) $(CFLAGS) -o $@ -c $< |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 23 | |
| 24 | clean: |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 25 | rm -f $(TARGET) $(ASN_LIBRARY) |
| 26 | rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o) |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 27 | |
| 28 | regen: regenerate-from-asn1-source |
| 29 | |
| 30 | regenerate-from-asn1-source: |
Lev Walkin | d7f5cb9 | 2006-09-23 02:56:19 +0000 | [diff] [blame] | 31 | ../../asn1c/asn1c -S ../../skeletons -pdu=MegacoMessage -fcompound-names ../rfc3525-MEDIA-GATEWAY-CONTROL.asn1 |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 32 | |
| 33 | |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 34 | MegacoMessage.c: ../sample.makefile.regen ../rfc3525-MEDIA-GATEWAY-CONTROL.asn1 |
Lev Walkin | cc7c94e | 2006-09-17 04:01:29 +0000 | [diff] [blame] | 35 | make regen-makefile |
| 36 | @touch MegacoMessage.c |
| 37 | make |
| 38 | |
| 39 | regen-makefile: |
Lev Walkin | f5b4939 | 2006-09-12 06:19:15 +0000 | [diff] [blame] | 40 | ASN1CMDOPTS="-fcompound-names" \ |
| 41 | ASN1MODULES="../rfc3525-MEDIA-GATEWAY-CONTROL.asn1" \ |
| 42 | ASN1PDU=MegacoMessage \ |
Lev Walkin | 61c391b | 2006-09-28 09:19:34 +0000 | [diff] [blame] | 43 | PROGNAME=megaco-dump \ |
Lev Walkin | 2fd86de | 2006-09-13 02:10:23 +0000 | [diff] [blame] | 44 | ../sample.makefile.regen |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 45 | |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 46 | check: ${TARGET} check-ber check-xer check-oer check-per |
Lev Walkin | 1f12da4 | 2006-09-24 19:47:07 +0000 | [diff] [blame] | 47 | @echo ================ |
| 48 | @echo All tests passed |
| 49 | @echo ================ |
| 50 | |
| 51 | check-ber: |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 52 | @if test -f sample-MegacoMessage-1.[db]er ; then \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 53 | for f in sample-*-*.[db]er; do \ |
| 54 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 55 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 56 | echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ |
| 57 | ./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ |
| 58 | ./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 59 | diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 60 | rm -f ./.tmp.[12].$$$$; \ |
Lev Walkin | 1f12da4 | 2006-09-24 19:47:07 +0000 | [diff] [blame] | 61 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 62 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \ |
| 63 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 64 | done; done; fi |
Lev Walkin | 1f12da4 | 2006-09-24 19:47:07 +0000 | [diff] [blame] | 65 | |
| 66 | check-xer: |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 67 | @if test -f sample-MegacoMessage-1.xer ; then \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 68 | for f in sample-*-*.xer; do \ |
| 69 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 70 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 71 | echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \ |
| 72 | ./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ |
| 73 | ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 74 | diff $$f ./.tmp.2.$$$$ || exit 4; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 75 | rm -f ./.tmp.[12].$$$$; \ |
Lev Walkin | 1f12da4 | 2006-09-24 19:47:07 +0000 | [diff] [blame] | 76 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 77 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \ |
| 78 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \ |
| 79 | done; done; fi |
| 80 | |
| 81 | check-oer: |
| 82 | @if test -f sample-MegacoMessage-1.*oer ; then \ |
| 83 | for f in sample-*-*.*oer; do \ |
| 84 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
| 85 | for b in 1 17 33 980 8192; do \ |
| 86 | echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \ |
| 87 | ./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ |
| 88 | ./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ |
| 89 | diff $$f ./.tmp.2.$$$$ || exit 4; \ |
| 90 | rm -f ./.tmp.[12].$$$$; \ |
| 91 | echo "Test junking $$f (please wait) ($$b) ..."; \ |
| 92 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \ |
| 93 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 94 | done; done; fi |
Lev Walkin | 1f12da4 | 2006-09-24 19:47:07 +0000 | [diff] [blame] | 95 | |
| 96 | check-per: |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 97 | @if test -f sample-MegacoMessage-1-nopad.per ; then \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 98 | for f in sample-*-[1-9]-nopad.per; do \ |
| 99 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 100 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 101 | echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \ |
| 102 | ./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ |
| 103 | ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ |
| 104 | ./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 105 | diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 106 | rm -f ./.tmp.[123].$$$$; \ |
Lev Walkin | 1f12da4 | 2006-09-24 19:47:07 +0000 | [diff] [blame] | 107 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 108 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \ |
| 109 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 110 | done; done; fi |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 111 | @if test -f sample-MegacoMessage-1.per ; then \ |
| 112 | for f in sample-*-[1-9].per; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 113 | pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 114 | for b in 1 17 33 980 8192; do \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 115 | echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \ |
| 116 | ./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ |
| 117 | ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ |
| 118 | ./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ |
Lev Walkin | 5aef2c5 | 2007-06-29 12:46:06 +0000 | [diff] [blame] | 119 | diff $$f ./.tmp.1.$$$$ || exit 6; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 120 | rm -f ./.tmp.[12].$$$$; \ |
Lev Walkin | 1f12da4 | 2006-09-24 19:47:07 +0000 | [diff] [blame] | 121 | echo "Test junking $$f (please wait)..."; \ |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 122 | ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \ |
| 123 | ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \ |
Lev Walkin | 13afe53 | 2006-09-18 21:30:04 +0000 | [diff] [blame] | 124 | done; done; fi |
Lev Walkin | c744a02 | 2006-09-15 18:33:25 +0000 | [diff] [blame] | 125 | |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 126 | maybe-wip-pause: |
| 127 | @if [ -f WIP ]; then cat WIP; sleep 2; fi |
| 128 | |
Lev Walkin | d83172f | 2006-09-09 04:49:45 +0000 | [diff] [blame] | 129 | distclean: clean |
Lev Walkin | bcda5ff | 2006-09-17 03:29:51 +0000 | [diff] [blame] | 130 | rm -f $(ASN_MODULE_SOURCES) |
| 131 | rm -f $(ASN_MODULE_HEADERS) |
Lev Walkin | f5b4939 | 2006-09-12 06:19:15 +0000 | [diff] [blame] | 132 | rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) |
Lev Walkin | ad77591 | 2017-09-26 22:55:22 -0700 | [diff] [blame] | 133 | rm -f Makefile.am.example |