diff --git a/Makefile b/Makefile index 86220d05..0bde8c5c 100644 --- a/Makefile +++ b/Makefile @@ -2,15 +2,19 @@ OBJS= dna.o server.o client.o peers.o ciphers.o responses.o packetformats.o data hlrdata.o srandomdev.o simulate.o batman.o overlay.o export.o gateway.o HDRS= Makefile mphlr.h LDFLAGS= +CFLAGS= -Os -g -Wall DEFS= -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_LIBC=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDIO_H=1 -DHAVE_ERRNO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_POLL_H=1 -DHAVE_NETDB_H=1 +DEFS+= -DHAVE_BZERO + +ASTERISK_APP_OBJS= asterisk_app.o $(OBJS) all: dna %.o: %.c $(HDRS) - $(CC) $(DEFS) -Os -g -Wall -c $< + $(CC) $(DEFS) $(CFLAGS) -c $< dna: $(OBJS) - $(CC) -Os -g -Wall -o dna $(OBJS) $(LDFLAGS) + $(CC) $(CFLAGS) -o dna $(OBJS) $(LDFLAGS) testserver: dna clear @@ -35,3 +39,6 @@ testset: dna testget testbigset: testget clear ./dna -vvv -s `cat testget | cut -f2 -d: | tail -1` -i 0 -W note=@411.txt + +app_serval.so: $(ASTERISK_APP_OBJS) + $(CC) $(CFLAGS) -shared -o app_serval.so $(DEFS) -DDNA_NO_MAIN $(ASTERISK_APP_OBJS) $(LDFLAGS) diff --git a/asterisk_app.c b/asterisk_app.c index 55ae7329..0ebf7ea5 100644 --- a/asterisk_app.c +++ b/asterisk_app.c @@ -61,7 +61,7 @@ static char *handle_cli_sdnalookup(int fd, int argc, char *argv[]) unsigned char buffer[65535]; int len=0; int instance=0; - + if (argc != 4) { ast_cli(fd, "You did not provide an argument to serval dna lookup\n\n"); return RESULT_FAILURE; @@ -69,8 +69,6 @@ static char *handle_cli_sdnalookup(int fd, int argc, char *argv[]) did=argv[3]; - batman_peerfile="/data/data/org.servalproject/var/batmand.peers"; - if (requestItem(did,sid,"locations",instance,buffer,sizeof(buffer),&len,NULL)) { ast_cli(fd,"Serval DNA Lookup: requestItem() failed (len=%d).\n\n",len); @@ -84,13 +82,12 @@ static char *handle_cli_sdnalookup(int fd, int argc, char *argv[]) static char *handle_cli_sdnapeers(int fd, int argc, char *argv[]) { int i; - + if (argc != 3) { ast_cli(fd, "serval dna peers does not argue about arguments.\n\n"); return RESULT_FAILURE; } - batman_peerfile="/data/data/org.servalproject/var/batmand.peers"; getPeerList(); ast_cli(fd,"%d peers reachable:\n",peer_count); for(i=0;i