summaryrefslogtreecommitdiffstats
path: root/ax25ipd
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2017-01-31 11:32:49 +0100
committerRalf Baechle <ralf@linux-mips.org>2017-01-31 11:32:49 +0100
commit1de0ea4abd7153c6fcdbdbac6048a1e46f673fc2 (patch)
treec81a8d6c58fcee19cead9cce8122ec35342428b1 /ax25ipd
parentaa1bfde879f3c5885199d7bb4720efaabff67d8c (diff)
Sort out variable and function declarations.
- Make static what can be made static. - Add declaration where they were missing. - Don't define variables in headers. - Move declaations to the proper locations. - Pick up declarations from the proper headers. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'ax25ipd')
-rw-r--r--ax25ipd/ax25ipd.c33
-rw-r--r--ax25ipd/ax25ipd.h33
-rw-r--r--ax25ipd/bpqether.c3
-rw-r--r--ax25ipd/io.c22
-rw-r--r--ax25ipd/kiss.c18
-rw-r--r--ax25ipd/routing.c6
6 files changed, 66 insertions, 49 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)