Browse Source

Don't use implicit `extern` keyword and use `static`

pull/209/head
Felix Pojtinger 5 years ago
parent
commit
62815e61f8
  1. 34
      sn_utils.c

34
sn_utils.c

@ -4,44 +4,44 @@
#define N2N_SN_LPORT_DEFAULT 7654
#define N2N_SN_PKTBUF_SIZE 2048
extern int try_forward(n2n_sn_t *sss,
static int try_forward(n2n_sn_t *sss,
const n2n_common_t *cmn,
const n2n_mac_t dstMac,
const uint8_t *pktbuf,
size_t pktsize);
extern ssize_t sendto_sock(n2n_sn_t *sss,
static ssize_t sendto_sock(n2n_sn_t *sss,
const n2n_sock_t *sock,
const uint8_t *pktbuf,
size_t pktsize);
extern int try_broadcast(n2n_sn_t *sss,
static int try_broadcast(n2n_sn_t *sss,
const n2n_common_t *cmn,
const n2n_mac_t srcMac,
const uint8_t *pktbuf,
size_t pktsize);
extern uint16_t reg_lifetime(n2n_sn_t *sss);
static uint16_t reg_lifetime(n2n_sn_t *sss);
extern int update_edge(n2n_sn_t *sss,
static int update_edge(n2n_sn_t *sss,
const n2n_mac_t edgeMac,
struct sn_community *comm,
const n2n_sock_t *sender_sock,
time_t now);
extern int process_mgmt(n2n_sn_t *sss,
static int process_mgmt(n2n_sn_t *sss,
const struct sockaddr_in *sender_sock,
const uint8_t *mgmt_buf,
size_t mgmt_size,
time_t now);
extern int process_udp(n2n_sn_t *sss,
static int process_udp(n2n_sn_t *sss,
const struct sockaddr_in *sender_sock,
const uint8_t *udp_buf,
size_t udp_size,
time_t now);
extern int try_forward(n2n_sn_t *sss,
static int try_forward(n2n_sn_t *sss,
const n2n_common_t *cmn,
const n2n_mac_t dstMac,
const uint8_t *pktbuf,
@ -100,7 +100,7 @@ extern int try_forward(n2n_sn_t *sss,
*
* @return -1 on error otherwise number of bytes sent
*/
extern ssize_t sendto_sock(n2n_sn_t *sss,
static ssize_t sendto_sock(n2n_sn_t *sss,
const n2n_sock_t *sock,
const uint8_t *pktbuf,
size_t pktsize)
@ -135,7 +135,7 @@ extern ssize_t sendto_sock(n2n_sn_t *sss,
* This will send the exact same datagram to zero or more edges registered to
* the supernode.
*/
extern int try_broadcast(n2n_sn_t *sss,
static int try_broadcast(n2n_sn_t *sss,
const n2n_common_t *cmn,
const n2n_mac_t srcMac,
const uint8_t *pktbuf,
@ -189,7 +189,7 @@ extern int try_broadcast(n2n_sn_t *sss,
}
/** Initialise the supernode structure */
extern int sn_init(n2n_sn_t *sss)
int sn_init(n2n_sn_t *sss)
{
#ifdef WIN32
initWin32();
@ -206,7 +206,7 @@ extern int sn_init(n2n_sn_t *sss)
/** Deinitialise the supernode structure and deallocate any memory owned by
* it. */
extern void sn_term(n2n_sn_t *sss)
void sn_term(n2n_sn_t *sss)
{
struct sn_community *community, *tmp;
@ -235,7 +235,7 @@ extern void sn_term(n2n_sn_t *sss)
* If the supernode has been put into a pre-shutdown phase then this lifetime
* should not allow registrations to continue beyond the shutdown point.
*/
extern uint16_t reg_lifetime(n2n_sn_t *sss)
static uint16_t reg_lifetime(n2n_sn_t *sss)
{
/* NOTE: UDP firewalls usually have a 30 seconds timeout */
return 15;
@ -243,7 +243,7 @@ extern uint16_t reg_lifetime(n2n_sn_t *sss)
/** Update the edge table with the details of the edge which contacted the
* supernode. */
extern int update_edge(n2n_sn_t *sss,
static int update_edge(n2n_sn_t *sss,
const n2n_mac_t edgeMac,
struct sn_community *comm,
const n2n_sock_t *sender_sock,
@ -298,7 +298,7 @@ extern int update_edge(n2n_sn_t *sss,
return 0;
}
extern int process_mgmt(n2n_sn_t *sss,
static int process_mgmt(n2n_sn_t *sss,
const struct sockaddr_in *sender_sock,
const uint8_t *mgmt_buf,
size_t mgmt_size,
@ -370,7 +370,7 @@ extern int process_mgmt(n2n_sn_t *sss,
/** Examine a datagram and determine what to do with it.
*
*/
extern int process_udp(n2n_sn_t *sss,
static int process_udp(n2n_sn_t *sss,
const struct sockaddr_in *sender_sock,
const uint8_t *udp_buf,
size_t udp_size,
@ -675,7 +675,7 @@ extern int process_udp(n2n_sn_t *sss,
/** Long lived processing entry point. Split out from main to simply
* daemonisation on some platforms. */
extern int run_sn_loop(n2n_sn_t *sss, int *keep_running)
int run_sn_loop(n2n_sn_t *sss, int *keep_running)
{
uint8_t pktbuf[N2N_SN_PKTBUF_SIZE];
time_t last_purge_edges = 0;

Loading…
Cancel
Save