treewide: align function naming
authorHans Dedecker <dedeckeh@gmail.com>
Fri, 13 Oct 2017 10:09:28 +0000 (12:09 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Fri, 13 Oct 2017 12:44:33 +0000 (14:44 +0200)
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/config.c
src/dhcpv4.c
src/dhcpv6-ia.c
src/dhcpv6.c
src/dhcpv6.h
src/ndp.c
src/odhcpd.c
src/odhcpd.h
src/router.c
src/ubus.c

index 2c35aab..597d5c5 100644 (file)
@@ -236,10 +236,10 @@ static void close_interface(struct interface *iface)
        if (iface->head.next)
                list_del(&iface->head);
 
-       setup_router_interface(iface, false);
-       setup_dhcpv6_interface(iface, false);
-       setup_ndp_interface(iface, false);
-       setup_dhcpv4_interface(iface, false);
+       router_setup_interface(iface, false);
+       dhcpv6_setup_interface(iface, false);
+       ndp_setup_interface(iface, false);
+       dhcpv4_setup_interface(iface, false);
 
        clean_interface(iface);
        free(iface->addr4);
@@ -843,10 +843,10 @@ void odhcpd_reload(void)
                                i->ndp = (master && master->ndp == MODE_RELAY) ?
                                                MODE_RELAY : MODE_DISABLED;
 
-                       setup_router_interface(i, !i->ignore || i->ra != MODE_DISABLED);
-                       setup_dhcpv6_interface(i, !i->ignore || i->dhcpv6 != MODE_DISABLED);
-                       setup_ndp_interface(i, !i->ignore || i->ndp != MODE_DISABLED);
-                       setup_dhcpv4_interface(i, !i->ignore || i->dhcpv4 != MODE_DISABLED);
+                       router_setup_interface(i, !i->ignore || i->ra != MODE_DISABLED);
+                       dhcpv6_setup_interface(i, !i->ignore || i->dhcpv6 != MODE_DISABLED);
+                       ndp_setup_interface(i, !i->ignore || i->ndp != MODE_DISABLED);
+                       dhcpv4_setup_interface(i, !i->ignore || i->dhcpv4 != MODE_DISABLED);
                } else
                        close_interface(i);
        }
@@ -887,7 +887,7 @@ void odhcpd_run(void)
        signal(SIGHUP, handle_signal);
 
 #ifdef WITH_UBUS
-       while (init_ubus())
+       while (ubus_init())
                sleep(1);
 #endif
 
index 6b3d782..bfe70cb 100644 (file)
@@ -58,13 +58,13 @@ struct odhcpd_ref_ip {
 };
 
 /* Create socket and register events */
-int init_dhcpv4(void)
+int dhcpv4_init(void)
 {
        uloop_timeout_set(&valid_until_timeout, 1000);
        return 0;
 }
 
-int setup_dhcpv4_interface(struct interface *iface, bool enable)
+int dhcpv4_setup_interface(struct interface *iface, bool enable)
 {
        if (iface->dhcpv4_event.uloop.fd > 0) {
                uloop_fd_delete(&iface->dhcpv4_event.uloop);
index dd549e6..1a584c5 100644 (file)
@@ -53,7 +53,7 @@ int dhcpv6_ia_init(void)
        return 0;
 }
 
-int setup_dhcpv6_ia_interface(struct interface *iface, bool enable)
+int dhcpv6_setup_ia_interface(struct interface *iface, bool enable)
 {
        if (!enable && iface->ia_assignments.next) {
                struct dhcpv6_assignment *c;
index 902bdbf..b94e84d 100644 (file)
@@ -34,16 +34,14 @@ static void handle_client_request(void *addr, void *data, size_t len,
                struct interface *iface, void *dest_addr);
 
 
-
 // Create socket and register events
-int init_dhcpv6(void)
+int dhcpv6_init(void)
 {
        dhcpv6_ia_init();
        return 0;
 }
 
-
-int setup_dhcpv6_interface(struct interface *iface, bool enable)
+int dhcpv6_setup_interface(struct interface *iface, bool enable)
 {
        if (iface->dhcpv6_event.uloop.fd > 0) {
                uloop_fd_delete(&iface->dhcpv6_event.uloop);
@@ -95,7 +93,7 @@ int setup_dhcpv6_interface(struct interface *iface, bool enable)
                odhcpd_register(&iface->dhcpv6_event);
        }
 
-       return setup_dhcpv6_ia_interface(iface, enable);
+       return dhcpv6_setup_ia_interface(iface, enable);
 }
 
 enum {
index de815cf..fe05ae5 100644 (file)
@@ -192,7 +192,7 @@ int dhcpv6_init_ia(struct interface *iface, int socket);
 ssize_t dhcpv6_handle_ia(uint8_t *buf, size_t buflen, struct interface *iface,
                const struct sockaddr_in6 *addr, const void *data, const uint8_t *end);
 int dhcpv6_ia_init(void);
-int setup_dhcpv6_ia_interface(struct interface *iface, bool enable);
+int dhcpv6_setup_ia_interface(struct interface *iface, bool enable);
 void dhcpv6_enum_ia_addrs(struct interface *iface, struct dhcpv6_assignment *c, time_t now,
                                dhcpv6_binding_cb_handler_t func, void *arg);
 void dhcpv6_write_statefile(void);
index 8ecc79b..22a9106 100644 (file)
--- a/src/ndp.c
+++ b/src/ndp.c
@@ -74,7 +74,7 @@ static const struct sock_fprog bpf_prog = {sizeof(bpf) / sizeof(*bpf), bpf};
 
 
 // Initialize NDP-proxy
-int init_ndp(void)
+int ndp_init(void)
 {
        int val = 2;
 
@@ -168,7 +168,7 @@ static void dump_addr_table(bool v6)
        nlmsg_free(msg);
 }
 
-int setup_ndp_interface(struct interface *iface, bool enable)
+int ndp_setup_interface(struct interface *iface, bool enable)
 {
        int ret = 0, procfd;
        bool dump_neigh = false;
index f59d5a8..259b623 100644 (file)
@@ -108,16 +108,16 @@ int main(int argc, char **argv)
        signal(SIGINT, sighandler);
        signal(SIGTERM, sighandler);
 
-       if (init_router())
+       if (router_init())
                return 4;
 
-       if (init_dhcpv6())
+       if (dhcpv6_init())
                return 4;
 
-       if (init_ndp())
+       if (ndp_init())
                return 4;
 
-       if (init_dhcpv4())
+       if (dhcpv4_init())
                return 4;
 
        odhcpd_run();
index 3d8f254..2d9e474 100644 (file)
@@ -265,7 +265,7 @@ int config_parse_interface(void *data, size_t len, const char *iname, bool overw
 void dhcpv4_addr_update(struct interface *iface);
 
 #ifdef WITH_UBUS
-int init_ubus(void);
+int ubus_init(void);
 const char* ubus_get_ifname(const char *name);
 void ubus_apply_network(void);
 bool ubus_has_prefix(const char *name, const char *ifname);
@@ -273,14 +273,14 @@ bool ubus_has_prefix(const char *name, const char *ifname);
 
 
 // Exported module initializers
-int init_router(void);
-int init_dhcpv6(void);
-int init_dhcpv4(void);
-int init_ndp(void);
-
-int setup_router_interface(struct interface *iface, bool enable);
-int setup_dhcpv6_interface(struct interface *iface, bool enable);
-int setup_ndp_interface(struct interface *iface, bool enable);
-int setup_dhcpv4_interface(struct interface *iface, bool enable);
+int router_init(void);
+int dhcpv6_init(void);
+int dhcpv4_init(void);
+int ndp_init(void);
+
+int router_setup_interface(struct interface *iface, bool enable);
+int dhcpv6_setup_interface(struct interface *iface, bool enable);
+int ndp_setup_interface(struct interface *iface, bool enable);
+int dhcpv4_setup_interface(struct interface *iface, bool enable);
 
 void odhcpd_reload(void);
index 30f1609..b50df3a 100644 (file)
@@ -41,7 +41,7 @@ static FILE *fp_route = NULL;
 
 #define TIME_LEFT(t1, now) ((t1) != UINT32_MAX ? (t1) - (now) : UINT32_MAX)
 
-int init_router(void)
+int router_init(void)
 {
        // Open ICMPv6 socket
        int sock = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_ICMPV6);
@@ -88,7 +88,7 @@ int init_router(void)
 }
 
 
-int setup_router_interface(struct interface *iface, bool enable)
+int router_setup_interface(struct interface *iface, bool enable)
 {
        if (!fp_route || router_event.uloop.fd < 0)
                return -1;
index 6fbb98f..95eeff7 100644 (file)
@@ -390,7 +390,7 @@ bool ubus_has_prefix(const char *name, const char *ifname)
 }
 
 
-int init_ubus(void)
+int ubus_init(void)
 {
        if (!(ubus = ubus_connect(NULL))) {
                syslog(LOG_ERR, "Unable to connect to ubus: %s", strerror(errno));