diff options
-rw-r--r-- | ax25ipd/ax25ipd.c | 33 | ||||
-rw-r--r-- | ax25ipd/ax25ipd.h | 33 | ||||
-rw-r--r-- | ax25ipd/bpqether.c | 3 | ||||
-rw-r--r-- | ax25ipd/io.c | 22 | ||||
-rw-r--r-- | ax25ipd/kiss.c | 18 | ||||
-rw-r--r-- | ax25ipd/routing.c | 6 | ||||
-rw-r--r-- | ax25mond/ax25mond.c | 30 | ||||
-rw-r--r-- | ax25rtd/ax25rtd.c | 6 | ||||
-rw-r--r-- | ax25rtd/cache_ctl.c | 4 | ||||
-rw-r--r-- | ax25rtd/config.c | 10 | ||||
-rw-r--r-- | ax25rtd/listener.c | 2 | ||||
-rw-r--r-- | call/call.c | 34 | ||||
-rw-r--r-- | call/crc.c | 2 | ||||
-rw-r--r-- | call/dostime.c | 4 | ||||
-rw-r--r-- | listen/listen.c | 14 | ||||
-rw-r--r-- | listen/opentracdump.c | 104 | ||||
-rw-r--r-- | listen/utils.c | 2 |
17 files changed, 186 insertions, 141 deletions
diff --git a/ax25ipd/ax25ipd.c b/ax25ipd/ax25ipd.c index 65df46a..66bd47f 100644 --- a/ax25ipd/ax25ipd.c +++ b/ax25ipd/ax25ipd.c @@ -23,19 +23,36 @@ #include "../pathnames.h" #include "ax25ipd.h" -jmp_buf restart_env; +int udp_mode; /* true if we need a UDP socket */ +int ip_mode; /* true if we need the raw IP socket */ +unsigned short my_udp; /* the UDP port to use (network byte order) */ +char ttydevice[PATH_MAX]; /* the tty device for serial comms */ +int ttyspeed; /* The baud rate on the tty device */ +unsigned char mycallsign[7]; /* My callsign, shifted ASCII with SSID */ +unsigned char mycallsign2[7]; /* My seconds port callsign, shifted ASCII with SSID */ +unsigned char myalias[7]; /* An alias to use */ +unsigned char myalias2[7]; /* An alias for second port */ +char bc_text[128]; /* The text for beacon messages */ +int bc_interval; /* The interval, in seconds, between beacons */ +int bc_every; /* true=every, false=after */ +int digi; /* True if we are connected to a TNC */ +int loglevel; /* Verbosity level */ + +int dual_port; /* addition for dual port flag */ + +static jmp_buf restart_env; /* Prototypes */ void hupper(int); -int opt_version; -int opt_loglevel; -int opt_nofork; -int opt_help; -char opt_configfile[PATH_MAX]; -char opt_ttydevice[PATH_MAX]; +static int opt_version; +static int opt_loglevel; +static int opt_nofork; +static int opt_help; +static char opt_configfile[PATH_MAX]; +static char opt_ttydevice[PATH_MAX]; -struct option options[] = { +static struct option options[] = { {"version", 0, NULL, 'v'}, {"loglevel", 1, NULL, 'l'}, {"help", 0, NULL, 'h'}, diff --git a/ax25ipd/ax25ipd.h b/ax25ipd/ax25ipd.h index 841df0a..37e3a7a 100644 --- a/ax25ipd/ax25ipd.h +++ b/ax25ipd/ax25ipd.h @@ -70,24 +70,24 @@ #include <sys/types.h> #include <netax25/daemon.h> -int udp_mode; /* true if we need a UDP socket */ -int ip_mode; /* true if we need the raw IP socket */ -unsigned short my_udp; /* the UDP port to use (network byte order) */ -char ttydevice[PATH_MAX]; /* the tty device for serial comms */ -int ttyspeed; /* The baud rate on the tty device */ -unsigned char mycallsign[7]; /* My callsign, shifted ASCII with SSID */ -unsigned char mycallsign2[7]; /* My seconds port callsign, shifted ASCII with SSID */ -unsigned char myalias[7]; /* An alias to use */ -unsigned char myalias2[7]; /* An alias for second port */ -char bc_text[128]; /* The text for beacon messages */ -int bc_interval; /* The interval, in seconds, between beacons */ -int bc_every; /* true=every, false=after */ -int digi; /* True if we are connected to a TNC */ -int loglevel; /* Verbosity level */ +extern int udp_mode; /* true if we need a UDP socket */ +extern int ip_mode; /* true if we need the raw IP socket */ +extern unsigned short my_udp; /* the UDP port to use (network byte order) */ +extern char ttydevice[PATH_MAX]; /* the tty device for serial comms */ +extern int ttyspeed; /* The baud rate on the tty device */ +extern unsigned char mycallsign[7]; /* My callsign, shifted ASCII with SSID */ +extern unsigned char mycallsign2[7]; /* My seconds port callsign, shifted ASCII with SSID */ +extern unsigned char myalias[7]; /* An alias to use */ +extern unsigned char myalias2[7]; /* An alias for second port */ +extern char bc_text[128]; /* The text for beacon messages */ +extern int bc_interval; /* The interval, in seconds, between beacons */ +extern int bc_every; /* true=every, false=after */ +extern int digi; /* True if we are connected to a TNC */ +extern int loglevel; /* Verbosity level */ /* addition for dual port flag */ -int dual_port; +extern int dual_port; -struct { +static struct { int kiss_in; /* # packets received */ int kiss_toobig; /* packet too large */ int kiss_badtype; /* control byte non-zero */ @@ -184,6 +184,7 @@ void term_handler(int); /* io.c */ extern int ttyfd_bpq; +extern int ttyfd; /* bpqether.c */ int send_bpq(unsigned char *buf, int len); diff --git a/ax25ipd/bpqether.c b/ax25ipd/bpqether.c index e1a0d25..21596ca 100644 --- a/ax25ipd/bpqether.c +++ b/ax25ipd/bpqether.c @@ -1,4 +1,3 @@ -extern int ttyfd; /* * this is a port of wampes ethertap whith my extension for bpqether * @@ -55,7 +54,7 @@ struct ethertap_packet { char data[MAX_FRAME]; }; -unsigned char hwaddr_remote[6]; +static unsigned char hwaddr_remote[6]; static int ethertap_header_len; diff --git a/ax25ipd/io.c b/ax25ipd/io.c index 26d3e96..bb2cbe0 100644 --- a/ax25ipd/io.c +++ b/ax25ipd/io.c @@ -43,31 +43,31 @@ #ifdef USE_TERMIOS #include <sys/termios.h> -struct termios nterm; +static struct termios nterm; #endif #ifdef USE_TERMIO #include <termio.h> -struct termio nterm; +static struct termio nterm; #endif #ifdef USE_SGTTY #include <sys/ioctl.h> -struct sgttyb nterm; +static struct sgttyb nterm; #endif int ttyfd = -1; -int udpsock = -1; -int sock = -1; +static int udpsock = -1; +static int sock = -1; #ifdef USE_ICMP -int icmpsock = -1; +static int icmpsock = -1; #endif -struct sockaddr_in udpbind; -struct sockaddr_in to; -struct sockaddr_in from; -socklen_t fromlen; +static struct sockaddr_in udpbind; +static struct sockaddr_in to; +static struct sockaddr_in from; +static socklen_t fromlen; -time_t last_bc_time; +static time_t last_bc_time; int ttyfd_bpq = 0; diff --git a/ax25ipd/kiss.c b/ax25ipd/kiss.c index fded84c..f07db22 100644 --- a/ax25ipd/kiss.c +++ b/ax25ipd/kiss.c @@ -21,23 +21,23 @@ #define TFEND 0xdc #define TFESC 0xdd -unsigned char iframe[MAX_FRAME]; -unsigned char *ifptr; -int ifcount; -int iescaped; +static unsigned char iframe[MAX_FRAME]; +static unsigned char *ifptr; +static int ifcount; +static int iescaped; -unsigned char oframe[MAX_FRAME]; -unsigned char *ofptr; -int ofcount; +static unsigned char oframe[MAX_FRAME]; +static unsigned char *ofptr; +static int ofcount; #define PTABLE_SIZE 10 -struct param_table_entry { +static struct param_table_entry { unsigned char parameter; unsigned char value; } param_tbl[PTABLE_SIZE]; -int param_tbl_top; +static int param_tbl_top; /* diff --git a/ax25ipd/routing.c b/ax25ipd/routing.c index 2ba5a9c..6fd5db4 100644 --- a/ax25ipd/routing.c +++ b/ax25ipd/routing.c @@ -29,8 +29,8 @@ struct route_table_entry { struct route_table_entry *next; }; -struct route_table_entry *route_tbl; -struct route_table_entry *default_route; +static struct route_table_entry *route_tbl; +static struct route_table_entry *default_route; /* The Broadcast address structure is not visible outside this module either */ @@ -39,7 +39,7 @@ struct bcast_table_entry { struct bcast_table_entry *next; }; -struct bcast_table_entry *bcast_tbl; +static struct bcast_table_entry *bcast_tbl; /* Initialize the routing module */ void route_init(void) diff --git a/ax25mond/ax25mond.c b/ax25mond/ax25mond.c index 6388af9..5530bf5 100644 --- a/ax25mond/ax25mond.c +++ b/ax25mond/ax25mond.c @@ -63,22 +63,22 @@ static union { /*--------------------------------------------------------------------------*/ -int sock_list[MAX_SOCKETS]; -char sock_monmode[MAX_SOCKETS]; -char sock_filename[MAX_SOCKETS][100]; -int sock_num = 0; -int conn_list[MAX_CONNECTS]; -struct sockaddr conn_addr[MAX_CONNECTS]; -socklen_t conn_addrlen[MAX_CONNECTS]; -char conn_monmode[MAX_CONNECTS]; -int conn_num = 0; -int highest_sock_fd; -int end = 0; +static int sock_list[MAX_SOCKETS]; +static char sock_monmode[MAX_SOCKETS]; +static char sock_filename[MAX_SOCKETS][100]; +static int sock_num = 0; +static int conn_list[MAX_CONNECTS]; +static struct sockaddr conn_addr[MAX_CONNECTS]; +static socklen_t conn_addrlen[MAX_CONNECTS]; +static char conn_monmode[MAX_CONNECTS]; +static int conn_num = 0; +static int highest_sock_fd; +static int end = 0; /*--------------------------------------------------------------------------*/ /* from buildsaddr.c */ -struct sockaddr *build_sockaddr(const char *name, int *addrlen) +static struct sockaddr *build_sockaddr(const char *name, int *addrlen) { char *host_name; char *serv_name; @@ -134,7 +134,7 @@ struct sockaddr *build_sockaddr(const char *name, int *addrlen) /*--------------------------------------------------------------------------*/ -void add_socket(char *sockname, char monmode) +static void add_socket(char *sockname, char monmode) { struct sockaddr *saddr; int saddrlen; @@ -190,7 +190,7 @@ void add_socket(char *sockname, char monmode) /*--------------------------------------------------------------------------*/ -void close_sockets(void) +static void close_sockets(void) { int i; @@ -204,7 +204,7 @@ void close_sockets(void) /*--------------------------------------------------------------------------*/ -void quit_handler(int dummy) +static void quit_handler(int dummy) { end = 1; } diff --git a/ax25rtd/ax25rtd.c b/ax25rtd/ax25rtd.c index b0b288c..a40cffe 100644 --- a/ax25rtd/ax25rtd.c +++ b/ax25rtd/ax25rtd.c @@ -93,13 +93,13 @@ config *port_get_config(char *port) return NULL; } -void sig_reload(int d) +static void sig_reload(int d) { reload = 1; signal(SIGHUP, sig_reload); } -void sig_debug(int d) +static void sig_debug(int d) { fprintf(stderr, "config:\n"); dump_config(2); @@ -110,7 +110,7 @@ void sig_debug(int d) signal(SIGUSR1, sig_debug); } -void sig_term(int d) +static void sig_term(int d) { save_cache(); daemon_shutdown(0); diff --git a/ax25rtd/cache_ctl.c b/ax25rtd/cache_ctl.c index 444fc08..6882a24 100644 --- a/ax25rtd/cache_ctl.c +++ b/ax25rtd/cache_ctl.c @@ -216,7 +216,7 @@ ax25_rt_entry *update_ax25_route(config * config, ax25_address * call, return bp; } -ip_rt_entry *remove_ip_route(ip_rt_entry * bp) +static ip_rt_entry *remove_ip_route(ip_rt_entry * bp) { ip_rt_entry *bp2; @@ -235,7 +235,7 @@ ip_rt_entry *remove_ip_route(ip_rt_entry * bp) return bp2; } -ax25_rt_entry *remove_ax25_route(ax25_rt_entry * bp) +static ax25_rt_entry *remove_ax25_route(ax25_rt_entry * bp) { ax25_rt_entry *bp2; ip_rt_entry *iprt; diff --git a/ax25rtd/config.c b/ax25rtd/config.c index c85b2b2..272da80 100644 --- a/ax25rtd/config.c +++ b/ax25rtd/config.c @@ -45,7 +45,7 @@ #include "../pathnames.h" #include "ax25rtd.h" -ax25_address *asc2ax(char *call) +static ax25_address *asc2ax(char *call) { static ax25_address callsign; @@ -65,7 +65,7 @@ static long asc2ip(char *s) } -char *prepare_cmdline(char *buf) +static char *prepare_cmdline(char *buf) { char *p; for (p = buf; *p; p++) { @@ -87,7 +87,7 @@ char *prepare_cmdline(char *buf) return buf; } -char *get_next_arg(char **p) +static char *get_next_arg(char **p) { char *p2; @@ -140,7 +140,7 @@ static ax25_address *get_mycall(char *port) } -void load_ports(void) +static void load_ports(void) { config *config, *cfg, *ncfg; char buf[1024]; @@ -218,7 +218,7 @@ void load_ports(void) } } -void load_listeners(void) +static void load_listeners(void) { config *config; char buf[1024], device[14], call[10], dcall[10]; diff --git a/ax25rtd/listener.c b/ax25rtd/listener.c index 47431a2..1d9aa1f 100644 --- a/ax25rtd/listener.c +++ b/ax25rtd/listener.c @@ -169,7 +169,7 @@ int set_arp(config * config, long ip, ax25_address * call) */ #define RT_DEL 0 #define RT_ADD 1 -int iproute2(long ip, char *dev, int what) +static int iproute2(long ip, char *dev, int what) { char buffer[256]; char ipa[32]; diff --git a/call/call.c b/call/call.c index 7e96663..022f6a3 100644 --- a/call/call.c +++ b/call/call.c @@ -92,12 +92,12 @@ volatile int interrupted = FALSE; static int sigwinchsignal; int paclen; int fd; -int curson = 1; +static int curson = 1; -int wait_for_remote_disconnect = FALSE; +static int wait_for_remote_disconnect = FALSE; static struct timespec inactivity_timeout; -int inactivity_timeout_is_set = FALSE; -int remote_commands_enabled = TRUE; +static int inactivity_timeout_is_set = FALSE; +static int remote_commands_enabled = TRUE; #define GP_FILENAME_SIZE 255 typedef struct { @@ -817,7 +817,7 @@ static void cmd_intr(int sig) interrupted = TRUE; } -WINDOW *opnstatw(int mode, wint * wintab, char *s, int lines, int cols) +static WINDOW *opnstatw(int mode, wint * wintab, char *s, int lines, int cols) { WINDOW *win; @@ -835,7 +835,7 @@ WINDOW *opnstatw(int mode, wint * wintab, char *s, int lines, int cols) return win; } -void wrdstatw(WINDOW * win, char s[]) +static void wrdstatw(WINDOW * win, char s[]) { int y; @@ -850,7 +850,7 @@ void wrdstatw(WINDOW * win, char s[]) wrefresh(win); } -void dupdstatw(WINDOW * win, char *s, int add) +static void dupdstatw(WINDOW * win, char *s, int add) { static char infostr[80]; static int y, x; @@ -898,7 +898,7 @@ void dupdstatw(WINDOW * win, char *s, int add) oldlen = strlen(s); } -int start_ab_download(int mode, WINDOW ** swin, wint * wintab, +static int start_ab_download(int mode, WINDOW ** swin, wint * wintab, char parms[], int parmsbytes, char buf[], int bytes, t_gp * gp, char *address[]) { @@ -1069,8 +1069,8 @@ int start_ab_download(int mode, WINDOW ** swin, wint * wintab, return 0; } -int ab_down(int mode, WINDOW * swin, wint * wintab, char buf[], int *bytes, - t_gp * gp) +static int ab_down(int mode, WINDOW * swin, wint * wintab, char buf[], + int *bytes, t_gp * gp) { unsigned long extrach = 0; char s[80]; @@ -1153,7 +1153,7 @@ int ab_down(int mode, WINDOW * swin, wint * wintab, char buf[], int *bytes, return 0; } -int start_screen(char *call[]) +static int start_screen(char *call[]) { int cnt; char idString[12]; @@ -1186,7 +1186,7 @@ int start_screen(char *call[]) return 0; } -int start_slave_mode(wint * wintab, t_win * win_in, t_win * win_out) +static int start_slave_mode(wint * wintab, t_win * win_in, t_win * win_out) { win_in->max_y = LINES - 2; win_in->max_x = COLS; @@ -1208,7 +1208,7 @@ int start_slave_mode(wint * wintab, t_win * win_in, t_win * win_out) return 0; } -int start_talk_mode(wint * wintab, t_win * win_in, t_win * win_out) +static int start_talk_mode(wint * wintab, t_win * win_in, t_win * win_out) { int cnt; WINDOW *win; @@ -1248,8 +1248,8 @@ int start_talk_mode(wint * wintab, t_win * win_in, t_win * win_out) return 0; } -int change_mode(int oldmode, int newmode, wint * wintab, t_win * win_in, - t_win * win_out, char *call[]) +static int change_mode(int oldmode, int newmode, wint * wintab, + t_win * win_in, t_win * win_out, char *call[]) { switch (oldmode) { case RAWMODE: @@ -1762,7 +1762,8 @@ static int readoutg(t_win * win_out, wint * wintab, menuitem * top, char buf[], return 0; } -void remotecommand(char buf[], int bytes) +#if 0 +static void remotecommand(char buf[], int bytes) { int firstchar; if (bytes == 0) @@ -1785,6 +1786,7 @@ void remotecommand(char buf[], int bytes) write(fd, "Unknown command\r", 16); } } +#endif static int compstr(const char st1[], char st2[], int maxbytes) { @@ -7,6 +7,8 @@ updated: Mark Wahl DL4YBG 94/01/17 */ +#include "crc.h" + static int crcbit[8] = { 0x9188, 0x48c4, 0x2462, 0x1231, 0x8108, 0x4084, 0x2042, 0x1021 }; diff --git a/call/dostime.c b/call/dostime.c index 4eb34c9..6e6e173 100644 --- a/call/dostime.c +++ b/call/dostime.c @@ -3,6 +3,8 @@ #include <stdlib.h> #include <stdio.h> +#include "call.h" + /* MS-DOS time/date conversion routines derived from: */ @@ -21,7 +23,7 @@ static int day_n[] = /* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */ -int date_dos2unix(unsigned short time, unsigned short date) +static int date_dos2unix(unsigned short time, unsigned short date) { int month, year, secs; diff --git a/listen/listen.c b/listen/listen.c index 1e311fb..e317e22 100644 --- a/listen/listen.c +++ b/listen/listen.c @@ -26,9 +26,9 @@ #include <config.h> #include "listen.h" -struct timeval t_recv; -int tflag = 0; -int32_t thiszone; /* seconds offset from gmt to local time */ +static struct timeval t_recv; +static int tflag = 0; +static int32_t thiszone; /* seconds offset from gmt to local time */ static int sigint; static int sock; @@ -47,8 +47,7 @@ static void display_port(char *dev) /* * Format the timestamp */ -char * -ts_format(register int sec, register int usec) +static char * ts_format(register int sec, register int usec) { static char buf[sizeof("00:00:00.000000")]; (void)snprintf(buf, sizeof(buf), "%02d:%02d:%02d.%06u", @@ -60,8 +59,7 @@ ts_format(register int sec, register int usec) /* * Print the timestamp */ -void -ts_print(register const struct timeval *tvp) +static void ts_print(register const struct timeval *tvp) { register int s; struct tm *tm; @@ -132,7 +130,7 @@ void display_timestamp(void) /* from tcpdump gmtlocal.c */ -int32_t gmt2local(time_t t) +static int32_t gmt2local(time_t t) { register int dt, dir; register struct tm *gmt, *loc; diff --git a/listen/opentracdump.c b/listen/opentracdump.c index 128cb9a..1b0bc26 100644 --- a/listen/opentracdump.c +++ b/listen/opentracdump.c @@ -11,23 +11,26 @@ #define MAX_UNIT_INDEX 28 -const char *units[]={"Volts","Amperes","Watts","Kelvins","Meters","Seconds", - "Meters/Second","Liters","Kilograms","Bits/Second","Bytes","Radians", - "Radians/Second","Square Meters","Joules","Newtons","Pascals","Hertz", - "Meters/Sec^2","Grays","Lumens","Cubic Meters/Second", - "Pascal Seconds","Kilograms/Meter^3","Radians/Second^2","Coulombs", - "Farads","Siemens","Count"}; +static const char *units[] ={ + "Volts","Amperes","Watts","Kelvins","Meters","Seconds", + "Meters/Second","Liters","Kilograms","Bits/Second","Bytes","Radians", + "Radians/Second","Square Meters","Joules","Newtons","Pascals","Hertz", + "Meters/Sec^2","Grays","Lumens","Cubic Meters/Second", + "Pascal Seconds","Kilograms/Meter^3","Radians/Second^2","Coulombs", + "Farads","Siemens","Count" +}; -char origin_call[7]; /* Who's talking */ -unsigned char origin_ssid; -char entity_call[7]; /* What they're talking about */ -unsigned char entity_ssid; -unsigned int entity_serial; -unsigned int entity_sequence; +static char origin_call[7]; /* Who's talking */ +static unsigned char origin_ssid; +static char entity_call[7]; /* What they're talking about */ +static unsigned char entity_ssid; +static unsigned int entity_serial; +static unsigned int entity_sequence; -int extract_ssid(char *call) { +static int extract_ssid(char *call) +{ /* Strip the SSID from the callsign and return it */ int c, ssid; @@ -39,12 +42,10 @@ int extract_ssid(char *call) { return ssid; } -int decode_units(unsigned int unitnum, unsigned char *element, int element_len); - - /* Return values: 0 = OK, -1 = Couldn't Decode, -2 = Invalid Data */ -int decode_sequence(unsigned char *element, int element_len) { +static int decode_sequence(unsigned char *element, int element_len) +{ /* 0x00 Sequence number - 16 bit integer */ if (element_len != 2 && element_len != 0) return -1; @@ -60,7 +61,8 @@ int decode_sequence(unsigned char *element, int element_len) { return 0; } -int decode_origination(unsigned char *element, int element_len) { +static int decode_origination(unsigned char *element, int element_len) +{ /* 0x01 Originating Station - Callsign, SSID, and Sequence */ memcpy(origin_call, element, 6); origin_call[6]=0; @@ -75,7 +77,8 @@ int decode_origination(unsigned char *element, int element_len) { return 0; } -int decode_entityid(unsigned char *element, int element_len) { +static int decode_entityid(unsigned char *element, int element_len) +{ /* 0x02 Entity ID */ if (element_len > 5) { memcpy(entity_call, element, 6); @@ -119,7 +122,8 @@ int decode_entityid(unsigned char *element, int element_len) { return 0; } -int decode_position(unsigned char *element, int element_len) { +static int decode_position(unsigned char *element, int element_len) +{ /* * 0x10 Position Report - Lat/Lon/<Alt> * Lat/Lon is WGS84, 180/2^31 degrees, Alt is 1/100 meter @@ -143,7 +147,8 @@ int decode_position(unsigned char *element, int element_len) { return 0; } -int decode_timestamp(unsigned char *element, int element_len) { +static int decode_timestamp(unsigned char *element, int element_len) +{ /* 0x11 Timestamp - Unix format time (unsigned) */ long rawtime = 0; @@ -152,7 +157,8 @@ int decode_timestamp(unsigned char *element, int element_len) { return 0; } -int decode_comment(unsigned char *element, int element_len) { +static int decode_comment(unsigned char *element, int element_len) +{ /* 0x12 Freeform Comment - ASCII text */ char comment[127]; @@ -163,7 +169,8 @@ int decode_comment(unsigned char *element, int element_len) { return 0; } -int decode_courseandspeed(unsigned char *element, int element_len) { +static int decode_courseandspeed(unsigned char *element, int element_len) +{ /* 0x13 Course and Speed - Course in degrees, speed in 1/50 m/s */ unsigned int course; unsigned int rawspeed; @@ -178,7 +185,8 @@ int decode_courseandspeed(unsigned char *element, int element_len) { return 0; } -int decode_ambiguity(unsigned char *element, int element_len) { +static int decode_ambiguity(unsigned char *element, int element_len) +{ /* 0x14 Positional Ambiguity - 16 bits, in meters */ int ambiguity; @@ -187,7 +195,8 @@ int decode_ambiguity(unsigned char *element, int element_len) { return 0; } -int decode_country(unsigned char *element, int element_len) { +static int decode_country(unsigned char *element, int element_len) +{ /* 0x15 Country Code - ISO 3166-1 and optionally -2 */ char country[3]; char subdivision[4]; @@ -205,7 +214,8 @@ int decode_country(unsigned char *element, int element_len) { return 0; } -int decode_displayname(unsigned char *element, int element_len) { +static int decode_displayname(unsigned char *element, int element_len) +{ char displayname[31]; /* 0x16 - Display Name (UTF-8 text) */ strncpy(displayname, (char *)element, element_len); @@ -215,7 +225,8 @@ int decode_displayname(unsigned char *element, int element_len) { return 0; } -int decode_waypoint(unsigned char *element, int element_len) { +static int decode_waypoint(unsigned char *element, int element_len) +{ char waypoint[7]; /* 0x17 - Waypoint Name (up to 6 chars, uppercase) */ strncpy(waypoint, (char *)element, element_len); @@ -225,7 +236,8 @@ int decode_waypoint(unsigned char *element, int element_len) { return 0; } -int decode_symbol(unsigned char *element, int element_len) { +static int decode_symbol(unsigned char *element, int element_len) +{ int c; /* 0x18 Map Symbol - Packed 4-bit integers */ lprintf(T_OPENTRAC, "Symbol: "); @@ -239,7 +251,8 @@ int decode_symbol(unsigned char *element, int element_len) { return 0; } -int decode_pathtrace(unsigned char *element, int element_len) { +static int decode_pathtrace(unsigned char *element, int element_len) +{ char callsign[7]; /* 0x20 Path Trace - Call/SSID, Network */ int ssid, c, network; @@ -261,7 +274,8 @@ int decode_pathtrace(unsigned char *element, int element_len) { return 0; } -int decode_heardby(unsigned char *element, int element_len) { +static int decode_heardby(unsigned char *element, int element_len) +{ int c; /* 0x21 Heard-By List */ lprintf(T_OPENTRAC, "Heard By:"); @@ -273,7 +287,8 @@ int decode_heardby(unsigned char *element, int element_len) { return 0; } -int decode_availablenets(unsigned char *element, int element_len) { +static int decode_availablenets(unsigned char *element, int element_len) +{ int c; /* 0x22 Available Networks */ lprintf(T_OPENTRAC, "Available Networks:"); @@ -285,7 +300,8 @@ int decode_availablenets(unsigned char *element, int element_len) { return 0; } -int decode_gpsquality(unsigned char *element, int element_len) { +static int decode_gpsquality(unsigned char *element, int element_len) +{ /* 0x34 GPS Data Quality - Fix, Validity, Sats, PDOP, HDOP, VDOP */ int fixtype, validity, sats; const char *fixstr[] = {"Unknown Fix", "No Fix", "2D Fix", "3D Fix"}; @@ -309,7 +325,8 @@ int decode_gpsquality(unsigned char *element, int element_len) { } -int decode_acreg(unsigned char *element, int element_len) { +static int decode_acreg(unsigned char *element, int element_len) +{ char nnumber[9]; /* 0x35 Aircraft Registration - ASCII text */ strncpy(nnumber, (char *)element, element_len); @@ -319,7 +336,8 @@ int decode_acreg(unsigned char *element, int element_len) { return 0; } -int decode_rivergauge(unsigned char *element, int element_len) { +static int decode_rivergauge(unsigned char *element, int element_len) +{ unsigned int flow; /* 0x42 River Flow Gauge - 1/64 m^3/sec */ unsigned int height; /* centimeters */ float flowm; @@ -336,7 +354,9 @@ int decode_rivergauge(unsigned char *element, int element_len) { } -int decode_units(unsigned int unitnum, unsigned char *element, int element_len) { +static int decode_units(unsigned int unitnum, unsigned char *element, + int element_len) +{ /* * 0x0500 to 0x05ff Generic Measurement Elements * Values may be 8-bit int, 16-bit int, single float, or double float @@ -371,19 +391,22 @@ int decode_units(unsigned int unitnum, unsigned char *element, int element_len) return 0; } -int flag_emergency(unsigned char *element, int element_len) { +static int flag_emergency(unsigned char *element, int element_len) +{ /* 0x0100 - Emergency / Distress Call */ lprintf(T_ERROR, "* * * EMERGENCY * * *\r\n"); return 0; } -int flag_attention(unsigned char *element, int element_len) { +static int flag_attention(unsigned char *element, int element_len) +{ /* 0x0101 - Attention / Ident */ lprintf(T_PROTOCOL, " - ATTENTION - \r\n"); return 0; } -int decode_hazmat(unsigned char *element, int element_len) { +static int decode_hazmat(unsigned char *element, int element_len) +{ /* 0x0300 - HAZMAT (UN ID in lower 14 bits) */ int un_id; @@ -397,7 +420,8 @@ int decode_hazmat(unsigned char *element, int element_len) { return 0; } -int decode_maidenhead(unsigned char *element, int element_len) { +static int decode_maidenhead(unsigned char *element, int element_len) +{ /* 0x32 - Maidenhead Locator (4 or 6 chars) */ char maidenhead[7]; @@ -411,7 +435,7 @@ int decode_maidenhead(unsigned char *element, int element_len) { } -struct { +static struct { unsigned int element_id; unsigned char min_size; unsigned char max_size; diff --git a/listen/utils.c b/listen/utils.c index f5b3b08..aa4d9e2 100644 --- a/listen/utils.c +++ b/listen/utils.c @@ -23,7 +23,7 @@ int ibmhack = 0; /* IBM mapping? */ * (158 and 159 are mapped to space) */ -unsigned char ibm_map[32] = { +static unsigned char ibm_map[32] = { 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197, 201, 230, 198, 244, 246, 242, 251, 249, |