mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Fix all trivial compiler warnings
This commit is contained in:
parent
4f68a945ed
commit
881576212c
@ -368,6 +368,7 @@ int audio_msm_g1_stop()
|
||||
{
|
||||
audio_msm_g1_stop_play();
|
||||
audio_msm_g1_stop_record();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int audio_msm_g1_start()
|
||||
|
4
batman.c
4
batman.c
@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include "serval.h"
|
||||
|
||||
struct reachable_peer {
|
||||
@ -170,7 +171,8 @@ int readBatmanPeerFile(char *file_path,struct in_addr peers[],int *peer_count,in
|
||||
{
|
||||
struct in_addr i;
|
||||
if (!p.addr_len) break;
|
||||
i.s_addr=*(unsigned int *)&p.addr[0];
|
||||
union { char c[4]; uint32_t ui32; } *u = (void*)&p.addr[0];
|
||||
i.s_addr = u->ui32;
|
||||
if (*peer_count<peer_max) peers[(*peer_count)++]=i;
|
||||
if (debug&DEBUG_PEERS) fprintf(stderr,"Found BATMAN peer '%s'\n",inet_ntoa(i));
|
||||
}
|
||||
|
@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#define _GNU_SOURCE // For asprintf()
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
6
dna.c
6
dna.c
@ -347,7 +347,7 @@ int setVerbosity(const char *optarg) {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
char *pin=NULL;
|
||||
//char *pin=NULL;
|
||||
char *did=NULL;
|
||||
char *sid=NULL;
|
||||
char *keyring_file=NULL;
|
||||
@ -362,7 +362,7 @@ int main(int argc, char **argv)
|
||||
memabuseInit();
|
||||
srandomdev();
|
||||
|
||||
server_save_argv(argc, argv);
|
||||
server_save_argv(argc, (const char*const*)argv);
|
||||
|
||||
if (argv[1]&&argv[1][0]!='-') {
|
||||
/* First argument doesn't start with a dash, so assume it is for the new command line
|
||||
@ -451,7 +451,7 @@ int main(int argc, char **argv)
|
||||
if (additionalPeer(optarg)) exit(-3);
|
||||
break;
|
||||
case 'P': /* Supply pin */
|
||||
pin=strdup(optarg);
|
||||
//pin=strdup(optarg);
|
||||
clientMode=1;
|
||||
break;
|
||||
case 'd': /* Ask by DID */
|
||||
|
@ -17,9 +17,10 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "serval.h"
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include "serval.h"
|
||||
|
||||
char *asterisk_extensions_conf="/data/data/org.servalproject/asterisk/etc/asterisk/gatewayextensions.conf";
|
||||
char *asterisk_binary="/data/data/org.servalproject/asterisk/sbin/asterisk";
|
||||
|
4
lsif.c
4
lsif.c
@ -59,9 +59,7 @@
|
||||
#define SIOCGIFBRDADDR OSIOCGIFBRDADDR
|
||||
#endif
|
||||
|
||||
int overlay_interface_register(unsigned char *name,
|
||||
struct sockaddr_in local,
|
||||
struct sockaddr_in broadcast);
|
||||
#include "serval.h"
|
||||
|
||||
/* for when all other options fail, as can happen on Android,
|
||||
if the permissions for the socket-based method are broken.
|
||||
|
16
monitor.c
16
monitor.c
@ -89,6 +89,7 @@ int monitor_setup_sockets()
|
||||
int dud=0;
|
||||
int r=bind(monitor_named_socket, (struct sockaddr *)&name, len);
|
||||
if (r) { dud=1; r=0; WHY_perror("bind"); }
|
||||
DEBUG("listen"); //XXX
|
||||
r=listen(monitor_named_socket,MAX_MONITOR_SOCKETS);
|
||||
if (r) { dud=1; r=0; WHY_perror("listen");
|
||||
}
|
||||
@ -182,13 +183,16 @@ int monitor_poll()
|
||||
/* Check for new connections */
|
||||
fcntl(monitor_named_socket,F_SETFL,
|
||||
fcntl(monitor_named_socket, F_GETFL, NULL)|O_NONBLOCK);
|
||||
while((
|
||||
while (
|
||||
#ifdef HAVE_LINUX_IF_H
|
||||
s=accept4(monitor_named_socket,ignored_address,&ignored_length,O_NONBLOCK)
|
||||
(DEBUG("accept4"), 1) && //XXX
|
||||
(s = accept4(monitor_named_socket,ignored_address,&ignored_length,O_NONBLOCK))
|
||||
#else
|
||||
s=accept(monitor_named_socket,&ignored_address,&ignored_length)
|
||||
(DEBUG("accept"), 1) && //XXX
|
||||
(s = accept(monitor_named_socket,&ignored_address,&ignored_length))
|
||||
#endif
|
||||
)>-1) {
|
||||
!= -1
|
||||
) {
|
||||
WHYF("ignored_length=%d",ignored_length);
|
||||
int res = fcntl(s,F_SETFL, O_NONBLOCK);
|
||||
if (res) { close(s); continue; }
|
||||
@ -226,6 +230,7 @@ int monitor_poll()
|
||||
fcntl(monitor_named_socket,F_SETFL,
|
||||
fcntl(monitor_named_socket, F_GETFL, NULL)|O_NONBLOCK);
|
||||
}
|
||||
DEBUG_perror("accept"); //XXX
|
||||
|
||||
/* Read from any open connections */
|
||||
int i;
|
||||
@ -248,8 +253,10 @@ int monitor_poll()
|
||||
break;
|
||||
}
|
||||
errno=0;
|
||||
DEBUG("read"); //XXX
|
||||
bytes=read(c->socket,&c->line[c->line_length],1);
|
||||
if (bytes<1) {
|
||||
DEBUG_perror("read"); //XXX
|
||||
switch(errno) {
|
||||
case EAGAIN: case EINTR: case ENOTRECOVERABLE:
|
||||
/* transient errors */
|
||||
@ -285,6 +292,7 @@ int monitor_poll()
|
||||
break;
|
||||
case MONITOR_STATE_DATA:
|
||||
errno=0;
|
||||
DEBUG("read"); //XXX
|
||||
bytes=read(c->socket,
|
||||
&c->buffer[c->data_offset],
|
||||
c->data_expected-c->data_offset);
|
||||
|
10
overlay.c
10
overlay.c
@ -78,8 +78,6 @@ keyring_file *keyring=NULL;
|
||||
|
||||
int overlayServerMode()
|
||||
{
|
||||
long long server_pid_time_ms = overlay_gettime_ms();
|
||||
|
||||
/* In overlay mode we need to listen to all of our sockets, and also to
|
||||
send periodic traffic. This means we need to */
|
||||
fprintf(stderr,"Running in overlay mode.\n");
|
||||
@ -128,7 +126,7 @@ int overlayServerMode()
|
||||
/* Work out how long we can wait before we need to tick */
|
||||
long long ms=overlay_time_until_next_tick();
|
||||
memabuseCheck();
|
||||
int filesPresent=0;
|
||||
//int filesPresent=0;
|
||||
fds[0].fd=sock; fds[0].events=POLLIN;
|
||||
fdcount=1;
|
||||
rhizome_server_get_fds(fds,&fdcount,128);
|
||||
@ -156,8 +154,10 @@ int overlayServerMode()
|
||||
fds[fdcount].revents=0;
|
||||
fdcount++;
|
||||
}
|
||||
if (overlay_interfaces[i].fileP)
|
||||
{ filesPresent=1; if (ms>5) ms=5; }
|
||||
if (overlay_interfaces[i].fileP) {
|
||||
//filesPresent=1;
|
||||
if (ms>5) ms=5;
|
||||
}
|
||||
}
|
||||
|
||||
/* Progressively update link scores to neighbours etc, and find out how long before
|
||||
|
@ -203,12 +203,12 @@ unsigned int ob_get_int(overlay_buffer *b,int offset)
|
||||
if ((offset+sizeof(unsigned int))>b->length) return WHY("passed offset too large");
|
||||
|
||||
// Some platforms require alignment
|
||||
if (((unsigned long long)&b->bytes[offset])&3) {
|
||||
unsigned char bb[4];
|
||||
bcopy(&b->bytes[offset],&bb[0],4);
|
||||
return ntohl(*(unsigned int *)&bb[0]);
|
||||
if (((uintptr_t)&b->bytes[offset])&3) {
|
||||
union { unsigned char uc[4]; uint32_t ui32; } bb;
|
||||
bcopy(&b->bytes[offset], &bb.uc[0], 4);
|
||||
return ntohl(bb.ui32);
|
||||
} else
|
||||
return ntohl(*((unsigned int *)&b->bytes[offset]));
|
||||
return ntohl(*((uint32_t*)&b->bytes[offset]));
|
||||
}
|
||||
|
||||
int ob_append_rfs(overlay_buffer *b,int l)
|
||||
|
@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include "serval.h"
|
||||
|
||||
#ifdef HAVE_IFADDRS_H
|
||||
|
@ -296,7 +296,7 @@ int overlay_saw_mdp_containing_frame(int interface,overlay_frame *f,long long no
|
||||
bcopy(&f->source[0],&mdp.in.src.sid[0],SID_SIZE);
|
||||
|
||||
int len=f->payload->length;
|
||||
unsigned char *b;
|
||||
unsigned char *b = NULL;
|
||||
unsigned char plain_block[len+16];
|
||||
|
||||
if (len<10) return WHY("Invalid MDP frame");
|
||||
|
@ -262,7 +262,6 @@ int overlay_add_selfannouncement(int interface,overlay_buffer *b)
|
||||
|
||||
unsigned char c;
|
||||
unsigned char *sid=overlay_get_my_sid();
|
||||
unsigned long long now=overlay_gettime_ms();
|
||||
|
||||
/* Header byte */
|
||||
c=OF_TYPE_SELFANNOUNCE;
|
||||
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
int process_packet(unsigned char *packet,int len,
|
||||
int recvttl,struct sockaddr *sender,int sender_len)
|
||||
{
|
||||
int authenticatedP=0;
|
||||
//int authenticatedP=0;
|
||||
char did[128];
|
||||
char sid[128];
|
||||
unsigned char *transaction_id=&packet[OFS_TRANSIDFIELD];
|
||||
@ -49,7 +49,7 @@ int process_packet(unsigned char *packet,int len,
|
||||
else
|
||||
{
|
||||
/* No attempt at authentication was made */
|
||||
authenticatedP=0;
|
||||
//authenticatedP=0;
|
||||
if (debug&DEBUG_SECURITY) fprintf(stderr,"No PIN was supplied.\n");
|
||||
}
|
||||
|
||||
|
@ -186,14 +186,14 @@ int rhizome_make_space(int group_priority, long long bytes)
|
||||
{
|
||||
/* Make sure we can drop this blob, and if so drop it, and recalculate number of bytes required */
|
||||
const unsigned char *id;
|
||||
long long length;
|
||||
//long long length;
|
||||
|
||||
/* Get values */
|
||||
if (sqlite3_column_type(statement, 0)==SQLITE_TEXT) id=sqlite3_column_text(statement, 0);
|
||||
else {
|
||||
fprintf(stderr,"Incorrect type in id column of files table.\n");
|
||||
continue; }
|
||||
if (sqlite3_column_type(statement, 1)==SQLITE_INTEGER) length=sqlite3_column_int(statement, 1);
|
||||
if (sqlite3_column_type(statement, 1)==SQLITE_INTEGER) ;//length=sqlite3_column_int(statement, 1);
|
||||
else {
|
||||
fprintf(stderr,"Incorrect type in length column of files table.\n");
|
||||
continue; }
|
||||
@ -205,7 +205,7 @@ int rhizome_make_space(int group_priority, long long bytes)
|
||||
}
|
||||
sqlite3_finalize(statement);
|
||||
|
||||
long long equal_priority_larger_file_space_used = sqlite_exec_int64("SELECT COUNT(length) FROM FILES WHERE highestpriority=%d and length>%lld",group_priority,bytes);
|
||||
//long long equal_priority_larger_file_space_used = sqlite_exec_int64("SELECT COUNT(length) FROM FILES WHERE highestpriority=%d and length>%lld",group_priority,bytes);
|
||||
/* XXX Get rid of any equal priority files that are larger than this one */
|
||||
|
||||
/* XXX Get rid of any higher priority files that are not relevant in this time or location */
|
||||
|
8
serval.h
8
serval.h
@ -1403,6 +1403,13 @@ int overlay_mdp_getmyaddr(int index,unsigned char *sid);
|
||||
int overlay_mdp_bind(unsigned char *localaddr,int port);
|
||||
int overlay_route_node_info(overlay_mdp_frame *mdp,
|
||||
struct sockaddr_un *addr,int addrlen);
|
||||
int overlay_interface_register(unsigned char *name,
|
||||
struct sockaddr_in local,
|
||||
struct sockaddr_in broadcast);
|
||||
int overlay_queue_dump(overlay_txqueue *q);
|
||||
int overlay_broadcast_ensemble(int interface_number,
|
||||
struct sockaddr_in *recipientaddr /* NULL == broadcast */,
|
||||
unsigned char *bytes,int len);
|
||||
|
||||
int app_vomp_status(int argc, const char *const *argv, struct command_line_option *o);
|
||||
int app_vomp_dial(int argc, const char *const *argv, struct command_line_option *o);
|
||||
@ -1446,3 +1453,4 @@ int encodeAndDispatchRecordedAudio(int fd,int callSessionToken,
|
||||
int recordCodec,
|
||||
unsigned char *sampleData,
|
||||
int sampleBytes);
|
||||
int scrapeProcNetRoute();
|
||||
|
4
server.c
4
server.c
@ -448,7 +448,6 @@ int processRequest(unsigned char *packet,int len,
|
||||
unsigned char *transaction_id,int recvttl, char *did,char *sid)
|
||||
{
|
||||
/* Find HLR entry by DID or SID, unless creating */
|
||||
int ofs;
|
||||
int records_searched=0;
|
||||
|
||||
int prev_pofs=0;
|
||||
@ -510,7 +509,7 @@ int processRequest(unsigned char *packet,int len,
|
||||
if (instrumentation_file)
|
||||
{
|
||||
if (!i_f) { if (strcmp(instrumentation_file,"-")) i_f=fopen(instrumentation_file,"a"); else i_f=stdout; }
|
||||
if (i_f) fprintf(i_f,"%ld:%08x:%d:%d\n",time(0),*(unsigned int *)&sender->sa_data[0],field,value);
|
||||
if (i_f) fprintf(i_f,"%ld:%02x%02x%02x%02x:%d:%d\n",time(0),sender->sa_data[0],sender->sa_data[1],sender->sa_data[2],sender->sa_data[3],field,value);
|
||||
if (i_f) fflush(i_f);
|
||||
}
|
||||
}
|
||||
@ -545,7 +544,6 @@ int processRequest(unsigned char *packet,int len,
|
||||
|
||||
if (debug&DEBUG_DNAREQUESTS) fprintf(stderr,"Processing ACTION_GET (var_id=%02x, instance=%02x, pofs=0x%x, len=%d)\n",var_id,instance,pofs,len);
|
||||
|
||||
ofs=0;
|
||||
if (debug&DEBUG_HLR) fprintf(stderr,"Looking for identities with sid='%s' / did='%s'\n",(sid&&sid[0])?sid:"null",did?did:"null");
|
||||
|
||||
/* Keyring only has DIDs in it for now.
|
||||
|
@ -134,6 +134,7 @@ int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out){
|
||||
memset(cnt, 0, sizeof(cnt));
|
||||
for(i=n-1; i>=0; i--){ cnt[in[i]]++; }
|
||||
m = n;
|
||||
e = 0;
|
||||
for(i=1; i<256; i++){
|
||||
int sum;
|
||||
if( i=='\'' ) continue;
|
||||
|
1
vomp.c
1
vomp.c
@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
int vomp_call_count=0;
|
||||
int vomp_active_call=-1;
|
||||
vomp_call_state vomp_call_states[VOMP_MAX_CALLS];
|
||||
int dump_vomp_status();
|
||||
|
||||
/* which codecs we support (set by registered listener) */
|
||||
unsigned char vomp_local_codec_list[256];
|
||||
|
Loading…
x
Reference in New Issue
Block a user