Skip to content

Commit

Permalink
2005-10-26 Paul Jakma <paul.jakma@sun.com>
Browse files Browse the repository at this point in the history
	* (general) static/extern functions and definitions.
	* rip_interface.h: new file, export the public functions from
	  rip_interface.c
  • Loading branch information
paul committed Oct 25, 2005
1 parent e029d44 commit dc63bfd
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 233 deletions.
6 changes: 6 additions & 0 deletions ripd/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
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

2005-10-17 Vincent Jardin <vincent.jardin@6wind.com>

* ripd.c: rip_create_socket() for each packet, it does not bind to the
Expand Down
6 changes: 3 additions & 3 deletions ripd/rip_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ struct cmd_node debug_node =
1
};

int
static int
config_write_debug (struct vty *vty)
{
int write = 0;
Expand Down Expand Up @@ -251,15 +251,15 @@ config_write_debug (struct vty *vty)
}

void
rip_debug_reset ()
rip_debug_reset (void)
{
rip_debug_event = 0;
rip_debug_packet = 0;
rip_debug_zebra = 0;
}

void
rip_debug_init ()
rip_debug_init (void)
{
rip_debug_event = 0;
rip_debug_packet = 0;
Expand Down
4 changes: 2 additions & 2 deletions ripd/rip_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extern unsigned long rip_debug_event;
extern unsigned long rip_debug_packet;
extern unsigned long rip_debug_zebra;

void rip_debug_init ();
void rip_debug_reset ();
extern void rip_debug_init (void);
extern void rip_debug_reset (void);

#endif /* _ZEBRA_RIP_DEBUG_H */
90 changes: 46 additions & 44 deletions ripd/rip_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@

#include "ripd/ripd.h"
#include "ripd/rip_debug.h"

void rip_enable_apply (struct interface *);
void rip_passive_interface_apply (struct interface *);
int rip_if_down(struct interface *ifp);
int rip_enable_if_lookup (const char *ifname);
int rip_enable_network_lookup2 (struct connected *connected);
void rip_enable_apply_all ();


#include "ripd/rip_interface.h"

/* static prototypes */
static void rip_enable_apply (struct interface *);
static void rip_passive_interface_apply (struct interface *);
static int rip_if_down(struct interface *ifp);
static int rip_enable_if_lookup (const char *ifname);
static int rip_enable_network_lookup2 (struct connected *connected);
static void rip_enable_apply_all (void);

struct message ri_version_msg[] =
{
{RI_RIP_VERSION_1, "1"},
Expand All @@ -70,7 +71,7 @@ static int passive_default; /* are we in passive-interface default mode? */
vector Vrip_passive_nondefault;

/* Join to the RIP version 2 multicast group. */
int
static int
ipv4_multicast_join (int sock,
struct in_addr group,
struct in_addr ifa,
Expand All @@ -92,7 +93,7 @@ ipv4_multicast_join (int sock,
}

/* Leave from the RIP version 2 multicast group. */
int
static int
ipv4_multicast_leave (int sock,
struct in_addr group,
struct in_addr ifa,
Expand All @@ -113,8 +114,8 @@ ipv4_multicast_leave (int sock,
}

/* Allocate new RIP's interface configuration. */
struct rip_interface *
rip_interface_new ()
static struct rip_interface *
rip_interface_new (void)
{
struct rip_interface *ri;

Expand Down Expand Up @@ -164,7 +165,7 @@ rip_interface_multicast_set (int sock, struct connected *connected)
}

/* Send RIP request packet to specified interface. */
void
static void
rip_request_interface_send (struct interface *ifp, u_char version)
{
struct sockaddr_in to;
Expand Down Expand Up @@ -214,7 +215,7 @@ rip_request_interface_send (struct interface *ifp, u_char version)
}

/* This will be executed when interface goes up. */
void
static void
rip_request_interface (struct interface *ifp)
{
struct rip_interface *ri;
Expand Down Expand Up @@ -244,7 +245,7 @@ rip_request_interface (struct interface *ifp)
}

/* Send RIP request to the neighbor. */
void
static void
rip_request_neighbor (struct in_addr addr)
{
struct sockaddr_in to;
Expand All @@ -257,8 +258,8 @@ rip_request_neighbor (struct in_addr addr)
}

/* Request routes at all interfaces. */
void
rip_request_neighbor_all ()
static void
rip_request_neighbor_all (void)
{
struct route_node *rp;

Expand All @@ -275,7 +276,7 @@ rip_request_neighbor_all ()
}

/* Multicast packet receive socket. */
int
static int
rip_multicast_join (struct interface *ifp, int sock)
{
struct listnode *cnode;
Expand Down Expand Up @@ -307,7 +308,7 @@ rip_multicast_join (struct interface *ifp, int sock)
}

/* Leave from multicast group. */
void
static void
rip_multicast_leave (struct interface *ifp, int sock)
{
struct listnode *cnode;
Expand Down Expand Up @@ -336,7 +337,7 @@ rip_multicast_leave (struct interface *ifp, int sock)
}

/* Is there and address on interface that I could use ? */
int
static int
rip_if_ipv4_address_check (struct interface *ifp)
{
struct listnode *nn;
Expand Down Expand Up @@ -553,7 +554,7 @@ rip_interface_delete (int command, struct zclient *zclient,
}

void
rip_interface_clean ()
rip_interface_clean (void)
{
struct listnode *node;
struct interface *ifp;
Expand All @@ -576,7 +577,7 @@ rip_interface_clean ()
}

void
rip_interface_reset ()
rip_interface_reset (void)
{
struct listnode *node;
struct interface *ifp;
Expand Down Expand Up @@ -694,7 +695,8 @@ rip_if_down_all ()
}

static void
rip_apply_address_add (struct connected *ifc) {
rip_apply_address_add (struct connected *ifc)
{
struct prefix_ipv4 address;
struct prefix *p;

Expand Down Expand Up @@ -815,7 +817,7 @@ rip_interface_address_delete (int command, struct zclient *zclient,
/* Check interface is enabled by network statement. */
/* Check wether the interface has at least a connected prefix that
* is within the ripng_enable_network table. */
int
static int
rip_enable_network_lookup_if (struct interface *ifp)
{
struct listnode *node, *nnode;
Expand Down Expand Up @@ -876,7 +878,7 @@ rip_enable_network_lookup2 (struct connected *connected)
return -1;
}
/* Add RIP enable network. */
int
static int
rip_enable_network_add (struct prefix *p)
{
struct route_node *node;
Expand All @@ -898,7 +900,7 @@ rip_enable_network_add (struct prefix *p)
}

/* Delete RIP enable network. */
int
static int
rip_enable_network_delete (struct prefix *p)
{
struct route_node *node;
Expand All @@ -923,7 +925,7 @@ rip_enable_network_delete (struct prefix *p)
}

/* Check interface is enabled by ifname statement. */
int
static int
rip_enable_if_lookup (const char *ifname)
{
unsigned int i;
Expand All @@ -937,7 +939,7 @@ rip_enable_if_lookup (const char *ifname)
}

/* Add interface to rip_enable_if. */
int
static int
rip_enable_if_add (const char *ifname)
{
int ret;
Expand All @@ -954,7 +956,7 @@ rip_enable_if_add (const char *ifname)
}

/* Delete interface from rip_enable_if. */
int
static int
rip_enable_if_delete (const char *ifname)
{
int index;
Expand All @@ -974,7 +976,7 @@ rip_enable_if_delete (const char *ifname)
}

/* Join to multicast group and send request to the interface. */
int
static int
rip_interface_wakeup (struct thread *t)
{
struct interface *ifp;
Expand Down Expand Up @@ -1004,7 +1006,7 @@ rip_interface_wakeup (struct thread *t)

int rip_redistribute_check (int);

void
static void
rip_connect_set (struct interface *ifp, int set)
{
struct listnode *node, *nnode;
Expand Down Expand Up @@ -1140,7 +1142,7 @@ rip_neighbor_lookup (struct sockaddr_in *from)
}

/* Add new RIP neighbor to the neighbor tree. */
int
static int
rip_neighbor_add (struct prefix_ipv4 *p)
{
struct route_node *node;
Expand All @@ -1156,7 +1158,7 @@ rip_neighbor_add (struct prefix_ipv4 *p)
}

/* Delete RIP neighbor from the neighbor tree. */
int
static int
rip_neighbor_delete (struct prefix_ipv4 *p)
{
struct route_node *node;
Expand Down Expand Up @@ -1203,7 +1205,7 @@ rip_clean_network ()
}

/* Utility function for looking up passive interface settings. */
int
static int
rip_passive_nondefault_lookup (const char *ifname)
{
unsigned int i;
Expand All @@ -1230,8 +1232,8 @@ rip_passive_interface_apply (struct interface *ifp)
zlog_debug ("interface %s: passive = %d",ifp->name,ri->passive);
}

void
rip_passive_interface_apply_all ()
static void
rip_passive_interface_apply_all (void)
{
struct interface *ifp;
struct listnode *node, *nnode;
Expand All @@ -1241,7 +1243,7 @@ rip_passive_interface_apply_all ()
}

/* Passive interface. */
int
static int
rip_passive_nondefault_set (struct vty *vty, const char *ifname)
{
if (rip_passive_nondefault_lookup (ifname) >= 0)
Expand All @@ -1254,7 +1256,7 @@ rip_passive_nondefault_set (struct vty *vty, const char *ifname)
return CMD_SUCCESS;
}

int
static int
rip_passive_nondefault_unset (struct vty *vty, const char *ifname)
{
int i;
Expand All @@ -1275,7 +1277,7 @@ rip_passive_nondefault_unset (struct vty *vty, const char *ifname)

/* Free all configured RIP passive-interface settings. */
void
rip_passive_nondefault_clean ()
rip_passive_nondefault_clean (void)
{
unsigned int i;
char *str;
Expand Down Expand Up @@ -1968,7 +1970,7 @@ DEFUN (no_rip_passive_interface,
}

/* Write rip configuration of each interface. */
int
static int
rip_interface_config_write (struct vty *vty)
{
struct listnode *node;
Expand Down Expand Up @@ -2109,15 +2111,15 @@ struct cmd_node interface_node =
};

/* Called when interface structure allocated. */
int
static int
rip_interface_new_hook (struct interface *ifp)
{
ifp->info = rip_interface_new ();
return 0;
}

/* Called when interface structure deleted. */
int
static int
rip_interface_delete_hook (struct interface *ifp)
{
XFREE (MTYPE_RIP_INTERFACE, ifp->info);
Expand All @@ -2127,7 +2129,7 @@ rip_interface_delete_hook (struct interface *ifp)

/* Allocate and initialize interface vector. */
void
rip_if_init ()
rip_if_init (void)
{
/* Default initial size of interface vector. */
if_init();
Expand Down
31 changes: 31 additions & 0 deletions ripd/rip_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* RIP interface routines
*
* This file is part of Quagga
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/

#ifndef _QUAGGA_RIP_INTERFACE_H
#define _QUAGGA_RIP_INTERFACE_H

extern int rip_interface_down (int , struct zclient *, zebra_size_t);
extern int rip_interface_up (int , struct zclient *, zebra_size_t);
extern int rip_interface_add (int , struct zclient *, zebra_size_t);
extern int rip_interface_delete (int , struct zclient *, zebra_size_t);
extern int rip_interface_address_add (int , struct zclient *, zebra_size_t);
extern int rip_interface_address_delete (int , struct zclient *, zebra_size_t);

#endif /* _QUAGGA_RIP_INTERFACE_H */
Loading

0 comments on commit dc63bfd

Please sign in to comment.