Default asterisk module to use routing table

This commit is contained in:
Jeremy Lakeman 2011-06-08 12:14:16 +09:30
parent df70fa54d2
commit 8910febc18
3 changed files with 19 additions and 15 deletions

View File

@ -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)

View File

@ -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);
@ -90,7 +88,6 @@ static char *handle_cli_sdnapeers(int fd, int argc, char *argv[])
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<peer_count;i++)
@ -185,8 +182,6 @@ static int sdnalookup_exec(struct ast_channel *chan, void *data)
char status[256] = "INVALIDARGS";
batman_peerfile="/data/data/org.servalproject/var/batmand.peers";
/* Clear Serval DNA set variables */
pbx_builtin_setvar_helper(chan, "SDNADID", "");
pbx_builtin_setvar_helper(chan, "SDNASID", "");
@ -220,7 +215,7 @@ static int sdnalookup_exec(struct ast_channel *chan, void *data)
if (debug) fprintf(stderr,"SNASID=%s\n",sid);
}
if (len) {
pbx_builtin_setvar_helper(chan,"SDNALOCATION",buffer);
pbx_builtin_setvar_helper(chan,"SDNALOCATION",(char*)buffer);
if (debug) fprintf(stderr,"SNALOCATION=%s\n",buffer);
}
return 0;
@ -238,12 +233,11 @@ static int unload_module(void)
static int load_module(void)
{
batman_peerfile=NULL;
ast_cli_register_multiple(cli_sdnalookup, ARRAY_LEN(cli_sdnalookup));
return ast_register_application(sdnalookup_app, sdnalookup_exec, sdnalookup_synopsis, sdnalookup_descrip);
}
// PGS XXX 20110317 - Why on earth do we need to define this?
#define AST_MODULE "ael"
#define AST_MODULE "app_serval"
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Serval Mesh Telephony Adapter and Serval DNA Resolver");

3
dna.c Executable file → Normal file
View File

@ -259,6 +259,7 @@ int usage(char *complaint)
exit(-1);
}
#ifndef DNA_NO_MAIN
int main(int argc,char **argv)
{
int c;
@ -406,3 +407,5 @@ int main(int argc,char **argv)
/* Client mode: */
return 0;
}
#endif