Skip to content

Commit

Permalink
Factor out ifvc headers into separate header file
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
  • Loading branch information
troglobit committed Apr 17, 2017
1 parent 066dfc1 commit 9ce6125
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 25 deletions.
2 changes: 2 additions & 0 deletions ifvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <ifaddrs.h>

#include "ifvc.h"
#include "mclab.h"

static unsigned int num_ifaces = 0, num_ifaces_alloc = 0;
Expand Down
22 changes: 22 additions & 0 deletions ifvc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Physical and virtual interface API */
#ifndef SMCROUTE_IFVC_H_
#define SMCROUTE_IFVC_H_

void iface_init (void);
void iface_exit (void);
struct iface *iface_find_by_name (const char *ifname);
struct iface *iface_find_by_index (unsigned int ifindex);
struct iface *iface_find_by_vif (int vif);
int iface_get_vif (struct iface *iface);
int iface_get_mif (struct iface *iface);
int iface_get_vif_by_name (const char *ifname);
int iface_get_mif_by_name (const char *ifname);

#endif /* SMCROUTE_IFVC_H_ */

/**
* Local Variables:
* indent-tabs-mode: t
* c-file-style: "linux"
* End:
*/
1 change: 1 addition & 0 deletions mcgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "ifvc.h"
#include "mclab.h"

static int mcgroup4_socket = -1;
Expand Down
11 changes: 0 additions & 11 deletions mclab.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,6 @@ struct iface {

extern int do_vifs;

/* ifvc.c */
void iface_init (void);
void iface_exit (void);
struct iface *iface_find_by_name (const char *ifname);
struct iface *iface_find_by_index (unsigned int ifindex);
struct iface *iface_find_by_vif (int vif);
int iface_get_vif (struct iface *iface);
int iface_get_mif (struct iface *iface);
int iface_get_vif_by_name (const char *ifname);
int iface_get_mif_by_name (const char *ifname);

/* mroute-api.c */

/*
Expand Down
2 changes: 2 additions & 0 deletions mroute-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <unistd.h>
#include <arpa/inet.h>
#include "config.h"

#include "ifvc.h"
#include "mclab.h"

#ifdef HAVE_NETINET6_IP6_MROUTE_H
Expand Down
1 change: 1 addition & 0 deletions msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <arpa/inet.h>

#include "msg.h"
#include "ifvc.h"
#include "mclab.h"

/* -j/-l eth0 [1.1.1.1] 239.1.1.1
Expand Down
16 changes: 2 additions & 14 deletions parse-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#ifndef UNITTEST

#include "ifvc.h"
#include "mclab.h"
#endif

#define MAX_LINE_LEN 512
#define WARN(fmt, args...) \
Expand Down Expand Up @@ -400,18 +400,6 @@ int parse_conf_file(const char *file)
return 0;
}

#ifdef UNITTEST
int main(int argc, char *argv[])
{
if (argc < 2) {
printf("Missing file argument.\n");
return 1;
}

return parse_conf_file(argv[1]);
}
#endif /* UNITTEST */

/**
* Local Variables:
* indent-tabs-mode: t
Expand Down
1 change: 1 addition & 0 deletions smcrouted.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include "ipc.h"
#include "msg.h"
#include "ifvc.h"
#include "mclab.h"

#define SMCROUTE_SYSTEM_CONF "/etc/smcroute.conf"
Expand Down

0 comments on commit 9ce6125

Please sign in to comment.