2005-10-26 Paul Jakma <paul.jakma@sun.com>
* (general) static/extern functions and definitions.
* rip_interface.h: new file, export the public functions from
rip_interface.c
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 3267e15..a7286d3 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -63,10 +63,11 @@
long rip_global_queries = 0;
/* Prototypes. */
-void rip_event (enum rip_event, int);
-
-void rip_output_process (struct connected *, struct sockaddr_in *, int, u_char);
-
+static void rip_event (enum rip_event, int);
+static void rip_output_process (struct connected *, struct sockaddr_in *, int, u_char);
+static int rip_triggered_update (struct thread *);
+static int rip_update_jitter (unsigned long);
+
/* RIP output routes type. */
enum
{
@@ -87,7 +88,7 @@
};
/* Utility function to set boradcast option to the socket. */
-int
+static int
sockopt_broadcast (int sock)
{
int ret;
@@ -102,13 +103,13 @@
return 0;
}
-int
+static int
rip_route_rte (struct rip_info *rinfo)
{
return (rinfo->type == ZEBRA_ROUTE_RIP && rinfo->sub_type == RIP_ROUTE_RTE);
}
-struct rip_info *
+static struct rip_info *
rip_info_new ()
{
struct rip_info *new;
@@ -125,7 +126,7 @@
}
/* RIP route garbage collect timer. */
-int
+static int
rip_garbage_collect (struct thread *t)
{
struct rip_info *rinfo;
@@ -151,7 +152,7 @@
}
/* Timeout RIP routes. */
-int
+static int
rip_timeout (struct thread *t)
{
struct rip_info *rinfo;
@@ -183,7 +184,7 @@
return 0;
}
-void
+static void
rip_timeout_update (struct rip_info *rinfo)
{
if (rinfo->metric != RIP_METRIC_INFINITY)
@@ -193,7 +194,7 @@
}
}
-int
+static int
rip_incoming_filter (struct prefix_ipv4 *p, struct rip_interface *ri)
{
struct distribute *dist;
@@ -264,7 +265,7 @@
return 0;
}
-int
+static int
rip_outgoing_filter (struct prefix_ipv4 *p, struct rip_interface *ri)
{
struct distribute *dist;
@@ -361,7 +362,7 @@
}
/* RIP add route to routing table. */
-void
+static void
rip_rte_process (struct rte *rte, struct sockaddr_in *from,
struct interface *ifp)
{
@@ -694,7 +695,7 @@
}
/* Dump RIP packet */
-void
+static void
rip_packet_dump (struct rip_packet *packet, int size, const char *sndrcv)
{
caddr_t lim;
@@ -785,7 +786,7 @@
/* Check if the destination address is valid (unicast; not net 0
or 127) (RFC2453 Section 3.9.2 - Page 26). But we don't
check net 0 because we accept default route. */
-int
+static int
rip_destination_check (struct in_addr addr)
{
u_int32_t destination;
@@ -812,7 +813,7 @@
}
/* RIP version 2 authentication. */
-int
+static int
rip_auth_simple_password (struct rte *rte, struct sockaddr_in *from,
struct interface *ifp)
{
@@ -854,7 +855,7 @@
}
/* RIP version 2 authentication with MD5. */
-int
+static int
rip_auth_md5 (struct rip_packet *packet, struct sockaddr_in *from,
int length, struct interface *ifp)
{
@@ -1105,7 +1106,7 @@
}
/* RIP routing information. */
-void
+static void
rip_response_process (struct rip_packet *packet, int size,
struct sockaddr_in *from, struct connected *ifc)
{
@@ -1409,7 +1410,7 @@
* by connected argument. NULL to argument denotes destination should be
* should be RIP multicast group
*/
-int
+static int
rip_send_packet (u_char * buf, int size, struct sockaddr_in *to,
struct connected *ifc)
{
@@ -1643,7 +1644,7 @@
}
/* Response to request called from rip_read ().*/
-void
+static void
rip_request_process (struct rip_packet *packet, int size,
struct sockaddr_in *from, struct connected *ifc)
{
@@ -1811,7 +1812,7 @@
#endif /* RIP_RECVMSG */
/* First entry point of RIP packet. */
-int
+static int
rip_read (struct thread *t)
{
int sock;
@@ -2101,7 +2102,7 @@
/* Write routing table entry to the stream and return next index of
the routing table entry in the stream. */
-int
+static int
rip_write_rte (int num, struct stream *s, struct prefix_ipv4 *p,
u_char version, struct rip_info *rinfo)
{
@@ -2149,7 +2150,7 @@
/* this might need to made dynamic if RIP ever supported auth methods
with larger key string sizes */
char auth_str[RIP_AUTH_SIMPLE_SIZE];
- size_t doff; /* offset of digest offset field */
+ size_t doff = 0; /* offset of digest offset field */
int num = 0;
int rtemax;
int subnetted = 0;
@@ -2427,7 +2428,7 @@
}
/* Send RIP packet to the interface. */
-void
+static void
rip_update_interface (struct connected *ifc, u_char version, int route_type)
{
struct sockaddr_in to;
@@ -2470,7 +2471,7 @@
}
/* Update send to all interface and neighbor. */
-void
+static void
rip_update_process (int route_type)
{
struct listnode *node;
@@ -2572,7 +2573,7 @@
}
/* RIP's periodical timer. */
-int
+static int
rip_update (struct thread *t)
{
/* Clear timer pointer. */
@@ -2600,7 +2601,7 @@
}
/* Walk down the RIP routing table then clear changed flag. */
-void
+static void
rip_clear_changed_flag ()
{
struct route_node *rp;
@@ -2613,7 +2614,7 @@
}
/* Triggered update interval timer. */
-int
+static int
rip_triggered_interval (struct thread *t)
{
int rip_triggered_update (struct thread *);
@@ -2629,7 +2630,7 @@
}
/* Execute triggered update. */
-int
+static int
rip_triggered_update (struct thread *t)
{
int interval;
@@ -2706,8 +2707,8 @@
}
/* Create new RIP instance and set it to global variable. */
-int
-rip_create ()
+static int
+rip_create (void)
{
rip = XMALLOC (MTYPE_RIP, sizeof (struct rip));
memset (rip, 0, sizeof (struct rip));
@@ -2787,7 +2788,7 @@
return sizeof (rip_packet);
}
-int
+static int
rip_update_jitter (unsigned long time)
{
#define JITTER_BOUND 4
@@ -2990,7 +2991,7 @@
return CMD_SUCCESS;
}
-void
+static void
rip_update_default_metric ()
{
struct route_node *np;
@@ -3126,7 +3127,7 @@
char *access_list;
};
-struct rip_distance *
+static struct rip_distance *
rip_distance_new ()
{
struct rip_distance *new;
@@ -3135,13 +3136,13 @@
return new;
}
-void
+static void
rip_distance_free (struct rip_distance *rdistance)
{
XFREE (MTYPE_RIP_DISTANCE, rdistance);
}
-int
+static int
rip_distance_set (struct vty *vty, const char *distance_str, const char *ip_str,
const char *access_list_str)
{
@@ -3188,7 +3189,7 @@
return CMD_SUCCESS;
}
-int
+static int
rip_distance_unset (struct vty *vty, const char *distance_str,
const char *ip_str, const char *access_list_str)
{
@@ -3227,7 +3228,7 @@
return CMD_SUCCESS;
}
-void
+static void
rip_distance_reset ()
{
struct route_node *rn;
@@ -3288,7 +3289,7 @@
return 0;
}
-void
+static void
rip_distance_show (struct vty *vty)
{
struct route_node *rn;
@@ -3387,7 +3388,7 @@
}
/* Print out routes update time. */
-void
+static void
rip_vty_out_uptime (struct vty *vty, struct rip_info *rinfo)
{
struct timeval timer_now;
@@ -3415,7 +3416,7 @@
}
}
-const char *
+static const char *
rip_route_type_print (int sub_type)
{
switch (sub_type)
@@ -3513,7 +3514,7 @@
}
/* Return next event time. */
-int
+static int
rip_next_thread_timer (struct thread *thread)
{
struct timeval timer_now;
@@ -3629,7 +3630,7 @@
}
/* RIP configuration write function. */
-int
+static int
config_write_rip (struct vty *vty)
{
int write = 0;
@@ -3722,7 +3723,7 @@
};
/* Distribute-list update functions. */
-void
+static void
rip_distribute_update (struct distribute *dist)
{
struct interface *ifp;
@@ -3796,7 +3797,7 @@
/* Update all interface's distribute list. */
/* ARGSUSED */
-void
+static void
rip_distribute_update_all (struct prefix_list *notused)
{
struct interface *ifp;
@@ -3806,7 +3807,7 @@
rip_distribute_update_interface (ifp);
}
/* ARGSUSED */
-void
+static void
rip_distribute_update_all_wrapper(struct access_list *notused)
{
rip_distribute_update_all(NULL);
@@ -3924,7 +3925,7 @@
rip_zclient_reset ();
}
-void
+static void
rip_if_rmap_update (struct if_rmap *if_rmap)
{
struct interface *ifp;
@@ -3970,7 +3971,7 @@
rip_if_rmap_update (if_rmap);
}
-void
+static void
rip_routemap_update_redistribute (void)
{
int i;
@@ -3987,7 +3988,7 @@
}
/* ARGSUSED */
-void
+static void
rip_routemap_update (const char *notused)
{
struct interface *ifp;
@@ -4001,7 +4002,7 @@
/* Allocate new rip structure and set default value. */
void
-rip_init ()
+rip_init (void)
{
/* Randomize for triggered update random(). */
srand (time (NULL));