From: Guus Sliepen Date: Sat, 4 Nov 2017 11:21:18 +0000 (+0100) Subject: Ensure all parameters have names in header files. X-Git-Tag: release-1.0.33~5 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=57bc9a1835bcb6a8df7963ee4ab04fde34f28eaf;p=tinc Ensure all parameters have names in header files. --- diff --git a/src/avl_tree.h b/src/avl_tree.h index 56aaf2e3..e8cefcf4 100644 --- a/src/avl_tree.h +++ b/src/avl_tree.h @@ -65,9 +65,9 @@ typedef struct avl_node_t { } avl_node_t; -typedef int (*avl_compare_t)(const void *, const void *); -typedef void (*avl_action_t)(const void *); -typedef void (*avl_action_node_t)(const avl_node_t *); +typedef int (*avl_compare_t)(const void *data1, const void *data2); +typedef void (*avl_action_t)(const void *data); +typedef void (*avl_action_node_t)(const avl_node_t *node); typedef struct avl_tree_t { @@ -87,56 +87,56 @@ typedef struct avl_tree_t { /* (De)constructors */ -extern avl_tree_t *avl_alloc_tree(avl_compare_t, avl_action_t); -extern void avl_free_tree(avl_tree_t *); +extern avl_tree_t *avl_alloc_tree(avl_compare_t compare, avl_action_t delete); +extern void avl_free_tree(avl_tree_t *tree); extern avl_node_t *avl_alloc_node(void); -extern void avl_free_node(avl_tree_t *tree, avl_node_t *); +extern void avl_free_node(avl_tree_t *tree, avl_node_t *node); /* Insertion and deletion */ -extern avl_node_t *avl_insert(avl_tree_t *, void *); -extern avl_node_t *avl_insert_node(avl_tree_t *, avl_node_t *); +extern avl_node_t *avl_insert(avl_tree_t *tree, void *data); +extern avl_node_t *avl_insert_node(avl_tree_t *tree, avl_node_t *node); -extern void avl_insert_top(avl_tree_t *, avl_node_t *); -extern void avl_insert_before(avl_tree_t *, avl_node_t *, avl_node_t *); -extern void avl_insert_after(avl_tree_t *, avl_node_t *, avl_node_t *); +extern void avl_insert_top(avl_tree_t *tree, avl_node_t *node); +extern void avl_insert_before(avl_tree_t *tree, avl_node_t *before, avl_node_t *node); +extern void avl_insert_after(avl_tree_t *tree, avl_node_t *after, avl_node_t *node); -extern avl_node_t *avl_unlink(avl_tree_t *, void *); -extern void avl_unlink_node(avl_tree_t *tree, avl_node_t *); -extern void avl_delete(avl_tree_t *, void *); -extern void avl_delete_node(avl_tree_t *, avl_node_t *); +extern avl_node_t *avl_unlink(avl_tree_t *tree, void *data); +extern void avl_unlink_node(avl_tree_t *tree, avl_node_t *node); +extern void avl_delete(avl_tree_t *tree, void *data); +extern void avl_delete_node(avl_tree_t *tree, avl_node_t *node); /* Fast tree cleanup */ -extern void avl_delete_tree(avl_tree_t *); +extern void avl_delete_tree(avl_tree_t *tree); /* Searching */ -extern void *avl_search(const avl_tree_t *, const void *); -extern void *avl_search_closest(const avl_tree_t *, const void *, int *); -extern void *avl_search_closest_smaller(const avl_tree_t *, const void *); -extern void *avl_search_closest_greater(const avl_tree_t *, const void *); +extern void *avl_search(const avl_tree_t *tree, const void *data); +extern void *avl_search_closest(const avl_tree_t *tree, const void *data, int *result); +extern void *avl_search_closest_smaller(const avl_tree_t *tree, const void *data); +extern void *avl_search_closest_greater(const avl_tree_t *tree, const void *data); -extern avl_node_t *avl_search_node(const avl_tree_t *, const void *); -extern avl_node_t *avl_search_closest_node(const avl_tree_t *, const void *, int *); -extern avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *, const void *); -extern avl_node_t *avl_search_closest_greater_node(const avl_tree_t *, const void *); +extern avl_node_t *avl_search_node(const avl_tree_t *tree, const void *data); +extern avl_node_t *avl_search_closest_node(const avl_tree_t *tree, const void *data, int *result); +extern avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *tree, const void *data); +extern avl_node_t *avl_search_closest_greater_node(const avl_tree_t *tree, const void *data); /* Tree walking */ -extern void avl_foreach(const avl_tree_t *, avl_action_t); -extern void avl_foreach_node(const avl_tree_t *, avl_action_t); +extern void avl_foreach(const avl_tree_t *tree, avl_action_t action); +extern void avl_foreach_node(const avl_tree_t *tree, avl_action_t action); /* Indexing */ #ifdef AVL_COUNT -extern unsigned int avl_count(const avl_tree_t *); -extern avl_node_t *avl_get_node(const avl_tree_t *, unsigned int); -extern unsigned int avl_index(const avl_node_t *); +extern unsigned int avl_count(const avl_tree_t *tree); +extern avl_node_t *avl_get_node(const avl_tree_t *tree, unsigned int index); +extern unsigned int avl_index(const avl_node_t *node); #endif #ifdef AVL_DEPTH -extern unsigned int avl_depth(const avl_tree_t *); +extern unsigned int avl_depth(const avl_tree_t *tree); #endif #endif diff --git a/src/conf.h b/src/conf.h index cef5d77b..770ada7f 100644 --- a/src/conf.h +++ b/src/conf.h @@ -44,25 +44,24 @@ extern char *confbase; extern char *netname; extern list_t *cmdline_conf; -extern void init_configuration(avl_tree_t **); -extern void exit_configuration(avl_tree_t **); +extern void init_configuration(avl_tree_t **config_tree); +extern void exit_configuration(avl_tree_t **config_tree); extern config_t *new_config(void) __attribute__((__malloc__)); -extern void free_config(config_t *); -extern void config_add(avl_tree_t *, config_t *); -extern config_t *lookup_config(const avl_tree_t *, char *); -extern config_t *lookup_config_next(const avl_tree_t *, const config_t *); -extern bool get_config_bool(const config_t *, bool *); -extern bool get_config_int(const config_t *, int *); -extern bool get_config_string(const config_t *, char **); -extern bool get_config_address(const config_t *, struct addrinfo **); -extern bool get_config_subnet(const config_t *, struct subnet_t **); +extern void free_config(config_t *cfg); +extern void config_add(avl_tree_t *config_tree, config_t *cfg); +extern config_t *lookup_config(const avl_tree_t *config_tree, char *variable); +extern config_t *lookup_config_next(const avl_tree_t *config_tree, const config_t *cfg); +extern bool get_config_bool(const config_t *cfg, bool *result); +extern bool get_config_int(const config_t *cfg, int *result); +extern bool get_config_string(const config_t *cfg, char **result); +extern bool get_config_address(const config_t *cfg, struct addrinfo **result); +extern bool get_config_subnet(const config_t *cfg, struct subnet_t **result); -extern config_t *parse_config_line(char *, const char *, int); -extern bool read_config_file(avl_tree_t *, const char *); -extern void read_config_options(avl_tree_t *, const char *); +extern config_t *parse_config_line(char *line, const char *fname, int lineno); +extern bool read_config_file(avl_tree_t *config_tree, const char *fname); +extern void read_config_options(avl_tree_t *config_tree, const char *prefix); extern bool read_server_config(void); -extern bool read_connection_config(struct connection_t *); -extern FILE *ask_and_open(const char *, const char *); -extern bool is_safe_path(const char *); +extern bool read_connection_config(struct connection_t *c); +extern FILE *ask_and_open(const char *fname, const char *what); #endif diff --git a/src/connection.h b/src/connection.h index 30a645ad..8c2d9f3f 100644 --- a/src/connection.h +++ b/src/connection.h @@ -109,10 +109,10 @@ extern connection_t *everyone; extern void init_connections(void); extern void exit_connections(void); extern connection_t *new_connection(void) __attribute__((__malloc__)); -extern void free_connection(connection_t *); -extern void free_connection_partially(connection_t *); -extern void connection_add(connection_t *); -extern void connection_del(connection_t *); +extern void free_connection(connection_t *c); +extern void free_connection_partially(connection_t *c); +extern void connection_add(connection_t *c); +extern void connection_del(connection_t *c); extern void dump_connections(void); #endif diff --git a/src/device.h b/src/device.h index bf502e01..6bfc44de 100644 --- a/src/device.h +++ b/src/device.h @@ -31,8 +31,8 @@ extern char *iface; typedef struct devops_t { bool (*setup)(void); void (*close)(void); - bool (*read)(struct vpn_packet_t *); - bool (*write)(struct vpn_packet_t *); + bool (*read)(struct vpn_packet_t *packet); + bool (*write)(struct vpn_packet_t *packet); void (*dump_stats)(void); } devops_t; diff --git a/src/dropin.h b/src/dropin.h index e2d5304f..012099b4 100644 --- a/src/dropin.h +++ b/src/dropin.h @@ -25,7 +25,7 @@ #include "fake-getnameinfo.h" #ifndef HAVE_DAEMON -extern int daemon(int, int); +extern int daemon(int nochdir, int noclose); #endif #ifndef HAVE_GET_CURRENT_DIR_NAME @@ -33,16 +33,16 @@ extern char *get_current_dir_name(void); #endif #ifndef HAVE_ASPRINTF -extern int asprintf(char **, const char *, ...); -extern int vasprintf(char **, const char *, va_list ap); +extern int asprintf(char **buf, const char *fmt, ...); +extern int vasprintf(char **buf, const char *fmt, va_list ap); #endif #ifndef HAVE_GETTIMEOFDAY -extern int gettimeofday(struct timeval *, void *); +extern int gettimeofday(struct timeval *tv, void *tz); #endif #ifndef HAVE_USLEEP -extern int usleep(long long); +extern int usleep(long long usec); #endif #endif diff --git a/src/edge.h b/src/edge.h index e2f3b3b7..a7a6302d 100644 --- a/src/edge.h +++ b/src/edge.h @@ -43,12 +43,12 @@ extern avl_tree_t *edge_weight_tree; /* Tree with all known edges sorted on extern void init_edges(void); extern void exit_edges(void); extern edge_t *new_edge(void) __attribute__((__malloc__)); -extern void free_edge(edge_t *); +extern void free_edge(edge_t *e); extern avl_tree_t *new_edge_tree(void) __attribute__((__malloc__)); -extern void free_edge_tree(avl_tree_t *); -extern void edge_add(edge_t *); -extern void edge_del(edge_t *); -extern edge_t *lookup_edge(struct node_t *, struct node_t *); +extern void free_edge_tree(avl_tree_t *edge_tree); +extern void edge_add(edge_t *e); +extern void edge_del(edge_t *e); +extern edge_t *lookup_edge(struct node_t *from, struct node_t *to); extern void dump_edges(void); #endif diff --git a/src/event.h b/src/event.h index c6bd2078..6d521bb5 100644 --- a/src/event.h +++ b/src/event.h @@ -38,9 +38,9 @@ extern void init_events(void); extern void exit_events(void); extern void expire_events(void); extern event_t *new_event(void) __attribute__((__malloc__)); -extern void free_event(event_t *); -extern void event_add(event_t *); -extern void event_del(event_t *); +extern void free_event(event_t *event); +extern void event_add(event_t *event); +extern void event_del(event_t *event); extern event_t *get_expired_event(void); extern event_t *peek_next_event(void); diff --git a/src/list.h b/src/list.h index 69d1ff4c..b2a9b3df 100644 --- a/src/list.h +++ b/src/list.h @@ -46,33 +46,33 @@ typedef struct list_t { /* (De)constructors */ extern list_t *list_alloc(list_action_t) __attribute__((__malloc__)); -extern void list_free(list_t *); +extern void list_free(list_t *list); extern list_node_t *list_alloc_node(void); -extern void list_free_node(list_t *, list_node_t *); +extern void list_free_node(list_t *list, list_node_t *node); /* Insertion and deletion */ -extern list_node_t *list_insert_head(list_t *, void *); -extern list_node_t *list_insert_tail(list_t *, void *); +extern list_node_t *list_insert_head(list_t *list, void *data); +extern list_node_t *list_insert_tail(list_t *list, void *data); -extern void list_unlink_node(list_t *, list_node_t *); -extern void list_delete_node(list_t *, list_node_t *); +extern void list_unlink_node(list_t *list, list_node_t *node); +extern void list_delete_node(list_t *list, list_node_t *node); -extern void list_delete_head(list_t *); -extern void list_delete_tail(list_t *); +extern void list_delete_head(list_t *list); +extern void list_delete_tail(list_t *list); /* Head/tail lookup */ -extern void *list_get_head(list_t *); -extern void *list_get_tail(list_t *); +extern void *list_get_head(list_t *list); +extern void *list_get_tail(list_t *list); /* Fast list deletion */ -extern void list_delete_list(list_t *); +extern void list_delete_list(list_t *list); /* Traversing */ -extern void list_foreach(list_t *, list_action_t); -extern void list_foreach_node(list_t *, list_action_node_t); +extern void list_foreach(list_t *list, list_action_t action); +extern void list_foreach_node(list_t *list, list_action_node_t action); #endif diff --git a/src/logger.h b/src/logger.h index 562d3795..5a17ffbd 100644 --- a/src/logger.h +++ b/src/logger.h @@ -65,9 +65,9 @@ enum { #endif extern debug_t debug_level; -extern void openlogger(const char *, logmode_t); +extern void openlogger(const char *ident, logmode_t mode); extern void reopenlogger(void); -extern void logger(int, const char *, ...) __attribute__((__format__(printf, 2, 3))); +extern void logger(int priority, const char *format, ...) __attribute__((__format__(printf, 2, 3))); extern void closelogger(void); #define ifdebug(l) if(debug_level >= DEBUG_##l) diff --git a/src/meta.h b/src/meta.h index c049b0b9..36914f13 100644 --- a/src/meta.h +++ b/src/meta.h @@ -23,9 +23,9 @@ #include "connection.h" -extern bool send_meta(struct connection_t *, const char *, int); -extern void broadcast_meta(struct connection_t *, const char *, int); -extern bool flush_meta(struct connection_t *); -extern bool receive_meta(struct connection_t *); +extern bool send_meta(struct connection_t *c, const char *buffer, int length); +extern void broadcast_meta(struct connection_t *c, const char *buffer, int length); +extern bool flush_meta(struct connection_t *c); +extern bool receive_meta(struct connection_t *c); #endif diff --git a/src/net.h b/src/net.h index 62907187..a73cb047 100644 --- a/src/net.h +++ b/src/net.h @@ -129,26 +129,26 @@ extern volatile bool running; #include "connection.h" #include "node.h" -extern void retry_outgoing(outgoing_t *); -extern void handle_incoming_vpn_data(int); -extern void finish_connecting(struct connection_t *); -extern void do_outgoing_connection(struct connection_t *); -extern bool handle_new_meta_connection(int); -extern int setup_listen_socket(const sockaddr_t *); -extern int setup_vpn_in_socket(const sockaddr_t *); -extern void send_packet(const struct node_t *, vpn_packet_t *); -extern void receive_tcppacket(struct connection_t *, const char *, length_t); -extern void broadcast_packet(const struct node_t *, vpn_packet_t *); +extern void retry_outgoing(outgoing_t *outgoing); +extern void handle_incoming_vpn_data(int sock); +extern void finish_connecting(struct connection_t *c); +extern void do_outgoing_connection(struct connection_t *c); +extern bool handle_new_meta_connection(int sock); +extern int setup_listen_socket(const sockaddr_t *sa); +extern int setup_vpn_in_socket(const sockaddr_t *sa); +extern void send_packet(const struct node_t *n, vpn_packet_t *packet); +extern void receive_tcppacket(struct connection_t *c, const char *buffer, length_t len); +extern void broadcast_packet(const struct node_t *, vpn_packet_t *packet); extern char *get_name(void); extern bool setup_network(void); -extern void setup_outgoing_connection(struct outgoing_t *); +extern void setup_outgoing_connection(struct outgoing_t *outgoing); extern void try_outgoing_connections(void); extern void close_network_connections(void); extern int main_loop(void); -extern void terminate_connection(struct connection_t *, bool); -extern void flush_queue(struct node_t *); -extern bool read_rsa_public_key(struct connection_t *); -extern void send_mtu_probe(struct node_t *); +extern void terminate_connection(struct connection_t *c, bool report); +extern void flush_queue(struct node_t *n); +extern bool read_rsa_public_key(struct connection_t *c); +extern void send_mtu_probe(struct node_t *n); extern void load_all_subnets(void); #ifndef HAVE_MINGW diff --git a/src/netutl.h b/src/netutl.h index c445dfd3..cc3ccabb 100644 --- a/src/netutl.h +++ b/src/netutl.h @@ -25,19 +25,19 @@ extern bool hostnames; -extern struct addrinfo *str2addrinfo(const char *, const char *, int); -extern sockaddr_t str2sockaddr(const char *, const char *); -extern void sockaddr2str(const sockaddr_t *, char **, char **); -extern char *sockaddr2hostname(const sockaddr_t *); -extern int sockaddrcmp(const sockaddr_t *, const sockaddr_t *); -extern int sockaddrcmp_noport(const sockaddr_t *, const sockaddr_t *); -extern void sockaddrunmap(sockaddr_t *); -extern void sockaddrfree(sockaddr_t *); -extern void sockaddrcpy(sockaddr_t *, const sockaddr_t *); -extern void sockaddr_setport(sockaddr_t *, const char *); -extern int maskcmp(const void *, const void *, int); -extern void maskcpy(void *, const void *, int, int); -extern void mask(void *, int, int); -extern bool maskcheck(const void *, int, int); +extern struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype); +extern sockaddr_t str2sockaddr(const char *address, const char *port); +extern void sockaddr2str(const sockaddr_t *sa, char **addrstr, char **portstr); +extern char *sockaddr2hostname(const sockaddr_t *sa); +extern int sockaddrcmp(const sockaddr_t *a, const sockaddr_t *b); +extern int sockaddrcmp_noport(const sockaddr_t *a, const sockaddr_t *b); +extern void sockaddrunmap(sockaddr_t *sa); +extern void sockaddrfree(sockaddr_t *sa); +extern void sockaddrcpy(sockaddr_t *dest, const sockaddr_t *src); +extern void sockaddr_setport(sockaddr_t *sa, const char *port); +extern int maskcmp(const void *a, const void *b, int masklen); +extern void maskcpy(void *dest, const void *src, int masklen, int len); +extern void mask(void *mask, int masklen, int len); +extern bool maskcheck(const void *mask, int masklen, int len); #endif diff --git a/src/node.h b/src/node.h index c5b7d9f6..b360fe5b 100644 --- a/src/node.h +++ b/src/node.h @@ -95,12 +95,12 @@ extern avl_tree_t *node_udp_tree; extern void init_nodes(void); extern void exit_nodes(void); extern node_t *new_node(void) __attribute__((__malloc__)); -extern void free_node(node_t *); -extern void node_add(node_t *); -extern void node_del(node_t *); -extern node_t *lookup_node(char *); -extern node_t *lookup_node_udp(const sockaddr_t *); -extern void update_node_udp(node_t *, const sockaddr_t *); +extern void free_node(node_t *n); +extern void node_add(node_t *n); +extern void node_del(node_t *n); +extern node_t *lookup_node(char *name); +extern node_t *lookup_node_udp(const sockaddr_t *sa); +extern void update_node_udp(node_t *n, const sockaddr_t *sa); extern void dump_nodes(void); #endif diff --git a/src/process.h b/src/process.h index c0fc80fa..e775ac35 100644 --- a/src/process.h +++ b/src/process.h @@ -26,9 +26,9 @@ extern bool sighup; extern bool sigalrm; extern void setup_signals(void); -extern bool execute_script(const char *, char **); +extern bool execute_script(const char *name, char **envp); extern bool detach(void); -extern bool kill_other(int); +extern bool kill_other(int signal); #ifdef HAVE_MINGW extern bool init_service(void); diff --git a/src/protocol.h b/src/protocol.h index ad3d31e9..a055f28a 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -71,53 +71,50 @@ extern bool strictsubnets; /* Basic functions */ -extern bool send_request(struct connection_t *, const char *, ...) __attribute__((__format__(printf, 2, 3))); -extern void forward_request(struct connection_t *); -extern bool receive_request(struct connection_t *); -extern bool check_id(const char *); +extern bool send_request(struct connection_t *c, const char *format, ...) __attribute__((__format__(printf, 2, 3))); +extern void forward_request(struct connection_t *c); +extern bool receive_request(struct connection_t *c); +extern bool check_id(const char *name); extern void init_requests(void); extern void exit_requests(void); -extern bool seen_request(char *); +extern bool seen_request(char *request); extern void age_past_requests(void); /* Requests */ -extern bool send_id(struct connection_t *); -extern bool send_metakey(struct connection_t *); -extern bool send_challenge(struct connection_t *); -extern bool send_chal_reply(struct connection_t *); -extern bool send_ack(struct connection_t *); -extern bool send_ping(struct connection_t *); -extern bool send_pong(struct connection_t *); -extern bool send_add_subnet(struct connection_t *, const struct subnet_t *); -extern bool send_del_subnet(struct connection_t *, const struct subnet_t *); -extern bool send_add_edge(struct connection_t *, const struct edge_t *); -extern bool send_del_edge(struct connection_t *, const struct edge_t *); +extern bool send_id(struct connection_t *c); +extern bool send_metakey(struct connection_t *c); +extern bool send_challenge(struct connection_t *c); +extern bool send_chal_reply(struct connection_t *c); +extern bool send_ack(struct connection_t *c); +extern bool send_ping(struct connection_t *c); +extern bool send_pong(struct connection_t *c); +extern bool send_add_subnet(struct connection_t *c, const struct subnet_t *subnet); +extern bool send_del_subnet(struct connection_t *c, const struct subnet_t *subnet); +extern bool send_add_edge(struct connection_t *c, const struct edge_t *e); +extern bool send_del_edge(struct connection_t *c, const struct edge_t *e); extern void send_key_changed(void); -extern bool send_req_key(struct node_t *); -extern bool send_ans_key(struct node_t *); -extern bool send_tcppacket(struct connection_t *, const struct vpn_packet_t *); +extern bool send_req_key(struct node_t *n); +extern bool send_ans_key(struct node_t *n); +extern bool send_tcppacket(struct connection_t *c, const struct vpn_packet_t *packet); /* Request handlers */ -extern bool id_h(struct connection_t *); -extern bool metakey_h(struct connection_t *); -extern bool challenge_h(struct connection_t *); -extern bool chal_reply_h(struct connection_t *); -extern bool ack_h(struct connection_t *); -extern bool status_h(struct connection_t *); -extern bool error_h(struct connection_t *); -extern bool termreq_h(struct connection_t *); -extern bool ping_h(struct connection_t *); -extern bool pong_h(struct connection_t *); -extern bool add_subnet_h(struct connection_t *); -extern bool del_subnet_h(struct connection_t *); -extern bool add_edge_h(struct connection_t *); -extern bool del_edge_h(struct connection_t *); -extern bool key_changed_h(struct connection_t *); -extern bool req_key_h(struct connection_t *); -extern bool ans_key_h(struct connection_t *); -extern bool tcppacket_h(struct connection_t *); +extern bool id_h(struct connection_t *c); +extern bool metakey_h(struct connection_t *c); +extern bool challenge_h(struct connection_t *c); +extern bool chal_reply_h(struct connection_t *c); +extern bool ack_h(struct connection_t *c); +extern bool ping_h(struct connection_t *c); +extern bool pong_h(struct connection_t *c); +extern bool add_subnet_h(struct connection_t *c); +extern bool del_subnet_h(struct connection_t *c); +extern bool add_edge_h(struct connection_t *c); +extern bool del_edge_h(struct connection_t *c); +extern bool key_changed_h(struct connection_t *c); +extern bool req_key_h(struct connection_t *c); +extern bool ans_key_h(struct connection_t *c); +extern bool tcppacket_h(struct connection_t *c); #endif diff --git a/src/route.h b/src/route.h index 86812883..5b9e8084 100644 --- a/src/route.h +++ b/src/route.h @@ -54,6 +54,6 @@ extern int macexpire; extern mac_t mymac; extern void age_subnets(void); -extern void route(struct node_t *, struct vpn_packet_t *); +extern void route(struct node_t *source, struct vpn_packet_t *packet); #endif diff --git a/src/subnet.h b/src/subnet.h index d68677f1..6fecca3b 100644 --- a/src/subnet.h +++ b/src/subnet.h @@ -66,22 +66,21 @@ typedef struct subnet_t { extern avl_tree_t *subnet_tree; -extern int subnet_compare(const struct subnet_t *, const struct subnet_t *); extern subnet_t *new_subnet(void) __attribute__((__malloc__)); -extern void free_subnet(subnet_t *); +extern void free_subnet(subnet_t *subnet); extern void init_subnets(void); extern void exit_subnets(void); extern avl_tree_t *new_subnet_tree(void) __attribute__((__malloc__)); -extern void free_subnet_tree(avl_tree_t *); -extern void subnet_add(struct node_t *, subnet_t *); -extern void subnet_del(struct node_t *, subnet_t *); -extern void subnet_update(struct node_t *, subnet_t *, bool); -extern bool net2str(char *, int, const subnet_t *); -extern bool str2net(subnet_t *, const char *); -extern subnet_t *lookup_subnet(const struct node_t *, const subnet_t *); -extern subnet_t *lookup_subnet_mac(const struct node_t *, const mac_t *); -extern subnet_t *lookup_subnet_ipv4(const ipv4_t *); -extern subnet_t *lookup_subnet_ipv6(const ipv6_t *); +extern void free_subnet_tree(avl_tree_t *subnet_tree); +extern void subnet_add(struct node_t *owner, subnet_t *subnet); +extern void subnet_del(struct node_t *owner, subnet_t *subnet); +extern void subnet_update(struct node_t *owner, subnet_t *subnet, bool up); +extern bool net2str(char *netstr, int len, const subnet_t *subnet); +extern bool str2net(subnet_t *subnet, const char *netstr); +extern subnet_t *lookup_subnet(const struct node_t *owner, const subnet_t *subnet); +extern subnet_t *lookup_subnet_mac(const struct node_t *owner, const mac_t *address); +extern subnet_t *lookup_subnet_ipv4(const ipv4_t *address); +extern subnet_t *lookup_subnet_ipv6(const ipv6_t *address); extern void dump_subnets(void); extern void subnet_cache_flush(void);