mirror of https://github.com/sipwise/libtcap.git
parent
6ef1885716
commit
df33deecd1
@ -1,11 +1,14 @@
|
|||||||
# stub
|
.PHONY: all regenerate-asn1 clean
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all regenerate-asn1
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
exit 1
|
$(MAKE) -C asn1-compiled
|
||||||
|
$(MAKE) -C src
|
||||||
|
|
||||||
regenerate-asn1:
|
regenerate-asn1:
|
||||||
rm -f asn1-compiled/*
|
rm -f asn1-compiled/*
|
||||||
(cd asn1-compiled && asn1c -fskeletons-copy ../asn1/tcap.asn)
|
(cd asn1-compiled && asn1c -fskeletons-copy ../asn1/tcap.asn)
|
||||||
|
ln -s ../asn1/Makefile.compiled asn1-compiled/Makefile
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(MAKE) -C asn1-compiled lib-clean
|
||||||
|
$(MAKE) -C src clean
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
../asn1/Makefile.compiled
|
@ -0,0 +1,17 @@
|
|||||||
|
.PHONY: all lib clean lib-clean
|
||||||
|
|
||||||
|
LIBNAME=libtcap-asn.a
|
||||||
|
|
||||||
|
CFLAGS=-g -Wall -O3
|
||||||
|
|
||||||
|
lib: $(LIBNAME)
|
||||||
|
|
||||||
|
include Makefile.am.sample
|
||||||
|
|
||||||
|
LIB_OBJS=${ASN_MODULE_SOURCES:.c=.o}
|
||||||
|
|
||||||
|
$(LIBNAME): $(LIB_OBJS)
|
||||||
|
ar cr $(LIBNAME) $(LIB_OBJS)
|
||||||
|
|
||||||
|
lib-clean: clean
|
||||||
|
rm -f $(LIBNAME)
|
@ -0,0 +1 @@
|
|||||||
|
*.sw?
|
@ -0,0 +1,21 @@
|
|||||||
|
LIBNAME=libtcap
|
||||||
|
VERSION=0
|
||||||
|
|
||||||
|
CC=gcc
|
||||||
|
CFLAGS=-I../asn1-compiled -g -Wall -O3 -fPIC
|
||||||
|
LDFLAGS=-O3 -shared -fPIC -Wl,-soname,$(LIBNAME).so.$(VERSION)
|
||||||
|
|
||||||
|
OBJS=tcap.o
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
|
||||||
|
all: $(LIBNAME).so
|
||||||
|
|
||||||
|
$(LIBNAME).so: $(OBJS) ../asn1-compiled/libtcap-asn.a
|
||||||
|
$(CC) -o $@ $(OBJS) $(LDFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
rm -f $(LIBNAME).so
|
@ -0,0 +1,21 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "TCMessage.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TCMessage_t *tcap_decode(const char *buf, size_t len) {
|
||||||
|
TCMessage_t *ret = NULL;
|
||||||
|
asn_dec_rval_t rv;
|
||||||
|
|
||||||
|
rv = ber_decode(0, &asn_DEF_TCMessage, (void **) &ret, buf, len);
|
||||||
|
|
||||||
|
if (rv.code == RC_OK)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
asn_DEF_TCMessage.free_struct(&asn_DEF_TCMessage, ret, 0);
|
||||||
|
return NULL;
|
||||||
|
}
|
Loading…
Reference in new issue