mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-20 05:37:57 +00:00
Default asterisk module to use routing table
This commit is contained in:
parent
df70fa54d2
commit
8910febc18
11
Makefile
11
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)
|
||||
|
@ -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<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;
|
||||
@ -229,21 +224,20 @@ static int sdnalookup_exec(struct ast_channel *chan, void *data)
|
||||
static int unload_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
||||
ast_cli_unregister_multiple(cli_sdnalookup, ARRAY_LEN(cli_sdnalookup));
|
||||
res = ast_unregister_application(sdnalookup_app);
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user