From: Guus Sliepen Date: Mon, 6 Nov 2017 21:28:32 +0000 (+0100) Subject: Ensure all parameters have names in header files. X-Git-Tag: release-1.1pre16~54 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=42d2dff33306beae8ddbd9cc991ad80f135950a6;p=tinc Ensure all parameters have names in header files. --- diff --git a/src/cipher.h b/src/cipher.h index 8d794bb9..2845be8d 100644 --- a/src/cipher.h +++ b/src/cipher.h @@ -28,19 +28,18 @@ typedef struct cipher cipher_t; -extern cipher_t *cipher_open_by_name(const char *) __attribute__((__malloc__)); -extern cipher_t *cipher_open_by_nid(int) __attribute__((__malloc__)); -extern void cipher_close(cipher_t *); -extern size_t cipher_keylength(const cipher_t *); -extern size_t cipher_blocksize(const cipher_t *); -extern uint64_t cipher_budget(const cipher_t *); -extern void cipher_get_key(const cipher_t *, void *); -extern bool cipher_set_key(cipher_t *, void *, bool) __attribute__((__warn_unused_result__)); -extern bool cipher_set_key_from_rsa(cipher_t *, void *, size_t, bool) __attribute__((__warn_unused_result__)); -extern bool cipher_encrypt(cipher_t *, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) __attribute__((__warn_unused_result__)); -extern bool cipher_decrypt(cipher_t *, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) __attribute__((__warn_unused_result__)); -extern int cipher_get_nid(const cipher_t *); -extern bool cipher_active(const cipher_t *); +extern cipher_t *cipher_open_by_name(const char *name) __attribute__((__malloc__)); +extern cipher_t *cipher_open_by_nid(int nid) __attribute__((__malloc__)); +extern void cipher_close(cipher_t *cipher); +extern size_t cipher_keylength(const cipher_t *cipher); +extern size_t cipher_blocksize(const cipher_t *cipher); +extern uint64_t cipher_budget(const cipher_t *cipher); +extern bool cipher_set_key(cipher_t *cipher, void *key, bool encrypt) __attribute__((__warn_unused_result__)); +extern bool cipher_set_key_from_rsa(cipher_t *cipher, void *rsa, size_t len, bool encrypt) __attribute__((__warn_unused_result__)); +extern bool cipher_encrypt(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) __attribute__((__warn_unused_result__)); +extern bool cipher_decrypt(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen, bool oneshot) __attribute__((__warn_unused_result__)); +extern int cipher_get_nid(const cipher_t *cipher); +extern bool cipher_active(const cipher_t *cipher); #endif diff --git a/src/conf.h b/src/conf.h index 62204794..84571247 100644 --- a/src/conf.h +++ b/src/conf.h @@ -41,24 +41,24 @@ extern int maxtimeout; extern bool bypass_security; extern list_t *cmdline_conf; -extern void init_configuration(splay_tree_t **); -extern void exit_configuration(splay_tree_t **); +extern void init_configuration(splay_tree_t **config_tree); +extern void exit_configuration(splay_tree_t **config_tree); extern config_t *new_config(void) __attribute__((__malloc__)); -extern void free_config(config_t *); -extern void config_add(splay_tree_t *, config_t *); -extern config_t *lookup_config(splay_tree_t *, char *); -extern config_t *lookup_config_next(splay_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 *config); +extern void config_add(splay_tree_t *config_tree, config_t *config); +extern config_t *lookup_config(splay_tree_t *config_tree, char *variable); +extern config_t *lookup_config_next(splay_tree_t *config_tree, const config_t *config); +extern bool get_config_bool(const config_t *config, bool *result); +extern bool get_config_int(const config_t *config, int *result); +extern bool get_config_string(const config_t *config, char **result); +extern bool get_config_address(const config_t *config, struct addrinfo **result); +extern bool get_config_subnet(const config_t *config, struct subnet_t **result); -extern config_t *parse_config_line(char *, const char *, int); -extern bool read_config_file(splay_tree_t *, const char *, bool verbose); -extern void read_config_options(splay_tree_t *, const char *); +extern config_t *parse_config_line(char *line, const char *fname, int lineno); +extern bool read_config_file(splay_tree_t *config_tree, const char *filename, bool verbose); +extern void read_config_options(splay_tree_t *config_tree, const char *prefix); extern bool read_server_config(void); -extern bool read_host_config(splay_tree_t *, const char *, bool verbose); -extern bool append_config_file(const char *, const char *, const char *); +extern bool read_host_config(splay_tree_t *config_tree, const char *name, bool verbose); +extern bool append_config_file(const char *name, const char *key, const char *value); #endif diff --git a/src/connection.h b/src/connection.h index 78c7a5bf..48c839b5 100644 --- a/src/connection.h +++ b/src/connection.h @@ -113,9 +113,9 @@ 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 connection_add(connection_t *); -extern void connection_del(connection_t *); -extern bool dump_connections(struct connection_t *); +extern void free_connection(connection_t *c); +extern void connection_add(connection_t *c); +extern void connection_del(connection_t *c); +extern bool dump_connections(struct connection_t *c); #endif diff --git a/src/control.h b/src/control.h index 04fe3041..93984102 100644 --- a/src/control.h +++ b/src/control.h @@ -20,8 +20,8 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -extern bool init_control(); -extern void exit_control(); +extern bool init_control(void); +extern void exit_control(void); extern char controlcookie[]; #endif diff --git a/src/crypto.h b/src/crypto.h index c9abddd5..74bab1b0 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -20,8 +20,8 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -extern void crypto_init(); -extern void crypto_exit(); -extern void randomize(void *, size_t); +extern void crypto_init(void); +extern void crypto_exit(void); +extern void randomize(void *buf, size_t buflen); #endif diff --git a/src/digest.h b/src/digest.h index e74ed3f0..6d7cb417 100644 --- a/src/digest.h +++ b/src/digest.h @@ -28,14 +28,14 @@ typedef struct digest digest_t; extern digest_t *digest_open_by_name(const char *name, int maclength) __attribute__((__malloc__)); extern digest_t *digest_open_by_nid(int nid, int maclength) __attribute__((__malloc__)); -extern void digest_close(digest_t *); -extern bool digest_create(digest_t *, const void *indata, size_t inlen, void *outdata) __attribute__((__warn_unused_result__)); -extern bool digest_verify(digest_t *, const void *indata, size_t inlen, const void *digestdata) __attribute__((__warn_unused_result__)); -extern bool digest_set_key(digest_t *, const void *key, size_t len) __attribute__((__warn_unused_result__)); -extern int digest_get_nid(const digest_t *); -extern size_t digest_keylength(const digest_t *); -extern size_t digest_length(const digest_t *); -extern bool digest_active(const digest_t *); +extern void digest_close(digest_t *digest); +extern bool digest_create(digest_t *digest, const void *indata, size_t inlen, void *outdata) __attribute__((__warn_unused_result__)); +extern bool digest_verify(digest_t *digest, const void *indata, size_t inlen, const void *digestdata) __attribute__((__warn_unused_result__)); +extern bool digest_set_key(digest_t *digest, const void *key, size_t len) __attribute__((__warn_unused_result__)); +extern int digest_get_nid(const digest_t *digest); +extern size_t digest_keylength(const digest_t *digest); +extern size_t digest_length(const digest_t *digest); +extern bool digest_active(const digest_t *digest); #endif diff --git a/src/edge.h b/src/edge.h index 687c8eca..032acbc5 100644 --- a/src/edge.h +++ b/src/edge.h @@ -44,12 +44,12 @@ extern splay_tree_t *edge_weight_tree; /* Tree with all known edges sor 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 splay_tree_t *new_edge_tree(void) __attribute__((__malloc__)); -extern void free_edge_tree(splay_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 bool dump_edges(struct connection_t *); +extern void free_edge_tree(splay_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 bool dump_edges(struct connection_t *c); #endif diff --git a/src/list.h b/src/list.h index 5f4a4097..3806495c 100644 --- a/src/list.h +++ b/src/list.h @@ -30,8 +30,8 @@ typedef struct list_node_t { void *data; } list_node_t; -typedef void (*list_action_t)(const void *); -typedef void (*list_action_node_t)(const list_node_t *); +typedef void (*list_action_t)(const void *data); +typedef void (*list_action_node_t)(const list_node_t *node); typedef struct list_t { list_node_t *head; @@ -45,39 +45,39 @@ typedef struct list_t { /* (De)constructors */ -extern list_t *list_alloc(list_action_t) __attribute__((__malloc__)); -extern void list_free(list_t *); +extern list_t *list_alloc(list_action_t delete) __attribute__((__malloc__)); +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_after(list_t *, list_node_t *, void *); -extern list_node_t *list_insert_before(list_t *, list_node_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 list_node_t *list_insert_after(list_t *list, list_node_t *node, void *data); +extern list_node_t *list_insert_before(list_t *list, list_node_t *node, void *data); -extern void list_delete(list_t *, const void *); +extern void list_delete(list_t *list, const 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); /* Iterates over a list. diff --git a/src/logger.h b/src/logger.h index 0e06d193..611fe387 100644 --- a/src/logger.h +++ b/src/logger.h @@ -70,9 +70,9 @@ enum { extern int debug_level; extern bool logcontrol; extern int umbilical; -extern void openlogger(const char *, logmode_t); +extern void openlogger(const char *ident, logmode_t mode); extern void reopenlogger(void); -extern void logger(int, int, const char *, ...) __attribute__((__format__(printf, 3, 4))); +extern void logger(int level, int priority, const char *format, ...) __attribute__((__format__(printf, 3, 4))); extern void closelogger(void); #endif diff --git a/src/meta.h b/src/meta.h index 52da7530..1c134ff1 100644 --- a/src/meta.h +++ b/src/meta.h @@ -23,11 +23,11 @@ #include "connection.h" -extern bool send_meta(struct connection_t *, const char *, int); -extern void send_meta_raw(struct connection_t *, const char *, int); -extern bool send_meta_sptps(void *, uint8_t, const void *, size_t); -extern bool receive_meta_sptps(void *, uint8_t, const void *, uint16_t); -extern void broadcast_meta(struct connection_t *, const char *, int); -extern bool receive_meta(struct connection_t *); +extern bool send_meta(struct connection_t *c, const char *buffer, int length); +extern void send_meta_raw(struct connection_t *c, const char *buffer, int length); +extern bool send_meta_sptps(void *handle, uint8_t type, const void *data, size_t length); +extern bool receive_meta_sptps(void *handle, uint8_t type, const void *data, uint16_t length); +extern void broadcast_meta(struct connection_t *from, const char *buffer, int length); +extern bool receive_meta(struct connection_t *c); #endif diff --git a/src/net.h b/src/net.h index 73e82e05..a4346445 100644 --- a/src/net.h +++ b/src/net.h @@ -185,41 +185,41 @@ extern char *scriptextension; #include "connection.h" #include "node.h" -extern void retry_outgoing(outgoing_t *); -extern void handle_incoming_vpn_data(void *, int); -extern void finish_connecting(struct connection_t *); -extern bool do_outgoing_connection(struct outgoing_t *); -extern void handle_new_meta_connection(void *, int); -extern void handle_new_unix_connection(void *, int); -extern int setup_listen_socket(const sockaddr_t *); -extern int setup_vpn_in_socket(const sockaddr_t *); +extern void retry_outgoing(outgoing_t *outgoing); +extern void handle_incoming_vpn_data(void *data, int flags); +extern void finish_connecting(struct connection_t *c); +extern bool do_outgoing_connection(struct outgoing_t *outgoing); +extern void handle_new_meta_connection(void *data, int flags); +extern void handle_new_unix_connection(void *data, int flags); +extern int setup_listen_socket(const sockaddr_t *sa); +extern int setup_vpn_in_socket(const sockaddr_t *sa); extern bool send_sptps_data(node_t *to, node_t *from, int type, const void *data, size_t len); extern bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t len); -extern void send_packet(struct node_t *, vpn_packet_t *); -extern void receive_tcppacket(struct connection_t *, const char *, int); -extern bool receive_tcppacket_sptps(struct connection_t *, const char *, int); -extern void broadcast_packet(const struct node_t *, vpn_packet_t *); +extern void send_packet(struct node_t *n, vpn_packet_t *packet); +extern void receive_tcppacket(struct connection_t *c, const char *buffer, int length); +extern bool receive_tcppacket_sptps(struct connection_t *c, const char *buffer, int length); +extern void broadcast_packet(const struct node_t *n, vpn_packet_t *packet); extern char *get_name(void); extern void device_enable(void); extern void device_disable(void); extern bool setup_myself_reloadable(void); extern bool setup_network(void); -extern void setup_outgoing_connection(struct outgoing_t *, bool verbose); +extern void setup_outgoing_connection(struct outgoing_t *outgoing, bool verbose); 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 bool node_read_ecdsa_public_key(struct node_t *); -extern bool read_ecdsa_public_key(struct connection_t *); -extern bool read_rsa_public_key(struct connection_t *); -extern void handle_device_data(void *, int); -extern void handle_meta_connection_data(struct connection_t *); +extern void terminate_connection(struct connection_t *c, bool report); +extern bool node_read_ecdsa_public_key(struct node_t *n); +extern bool read_ecdsa_public_key(struct connection_t *c); +extern bool read_rsa_public_key(struct connection_t *c); +extern void handle_device_data(void *data, int flags); +extern void handle_meta_connection_data(struct connection_t *c); extern void regenerate_key(void); extern void purge(void); extern void retry(void); extern int reload_configuration(void); extern void load_all_nodes(void); -extern void try_tx(struct node_t *n, bool); +extern void try_tx(struct node_t *n, bool mtu); #ifndef HAVE_MINGW #define closesocket(s) close(s) diff --git a/src/netutl.h b/src/netutl.h index ca5466f5..4aa15425 100644 --- a/src/netutl.h +++ b/src/netutl.h @@ -25,15 +25,15 @@ extern bool hostnames; -extern struct addrinfo *str2addrinfo(const char *, const char *, int) __attribute__((__malloc__)); -extern sockaddr_t str2sockaddr(const char *, const char *); -extern void sockaddr2str(const sockaddr_t *, char **, char **); -extern char *sockaddr2hostname(const sockaddr_t *) __attribute__((__malloc__)); -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 struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) __attribute__((__malloc__)); +extern sockaddr_t str2sockaddr(const char *address, const char *port); +extern void sockaddr2str(const sockaddr_t *sa, char **address, char **port); +extern char *sockaddr2hostname(const sockaddr_t *sa) __attribute__((__malloc__)); +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); #endif diff --git a/src/node.h b/src/node.h index 153dc11f..daa0830a 100644 --- a/src/node.h +++ b/src/node.h @@ -118,14 +118,14 @@ extern splay_tree_t *node_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_id(const node_id_t *); -extern node_t *lookup_node_udp(const sockaddr_t *); -extern bool dump_nodes(struct connection_t *); -extern bool dump_traffic(struct connection_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_id(const node_id_t *id); +extern node_t *lookup_node_udp(const sockaddr_t *sa); +extern bool dump_nodes(struct connection_t *c); +extern bool dump_traffic(struct connection_t *c); +extern void update_node_udp(node_t *n, const sockaddr_t *sa); #endif diff --git a/src/protocol.h b/src/protocol.h index 3ffcfd5f..42981cca 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -80,60 +80,60 @@ extern ecdsa_t *invitation_key; /* Basic functions */ -extern bool send_request(struct connection_t *, const char *, ...) __attribute__((__format__(printf, 2, 3))); -extern void forward_request(struct connection_t *, const char *); -extern bool receive_request(struct connection_t *, 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, const char *request); +extern bool receive_request(struct connection_t *c, const char *request); extern void init_requests(void); extern void exit_requests(void); -extern bool seen_request(const char *); +extern bool seen_request(const char *request); /* Requests */ -extern bool send_id(struct connection_t *); -extern bool send_metakey(struct connection_t *); -extern bool send_metakey_ec(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_termreq(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_metakey_ec(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_termreq(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_sptps_tcppacket(struct connection_t *, const char *, int); -extern bool send_udp_info(struct node_t *, struct node_t *); -extern bool send_mtu_info(struct node_t *, struct node_t *, int); +extern bool send_req_key(struct node_t *to); +extern bool send_ans_key(struct node_t *to); +extern bool send_tcppacket(struct connection_t *c, const struct vpn_packet_t *packet); +extern bool send_sptps_tcppacket(struct connection_t *c, const char *packet, int len); +extern bool send_udp_info(struct node_t *from, struct node_t *to); +extern bool send_mtu_info(struct node_t *from, struct node_t *to, int mtu); /* Request handlers */ -extern bool id_h(struct connection_t *, const char *); -extern bool metakey_h(struct connection_t *, const char *); -extern bool challenge_h(struct connection_t *, const char *); -extern bool chal_reply_h(struct connection_t *, const char *); -extern bool ack_h(struct connection_t *, const char *); -extern bool status_h(struct connection_t *, const char *); -extern bool error_h(struct connection_t *, const char *); -extern bool termreq_h(struct connection_t *, const char *); -extern bool ping_h(struct connection_t *, const char *); -extern bool pong_h(struct connection_t *, const char *); -extern bool add_subnet_h(struct connection_t *, const char *); -extern bool del_subnet_h(struct connection_t *, const char *); -extern bool add_edge_h(struct connection_t *, const char *); -extern bool del_edge_h(struct connection_t *, const char *); -extern bool key_changed_h(struct connection_t *, const char *); -extern bool req_key_h(struct connection_t *, const char *); -extern bool ans_key_h(struct connection_t *, const char *); -extern bool tcppacket_h(struct connection_t *, const char *); -extern bool sptps_tcppacket_h(struct connection_t *, const char *); -extern bool control_h(struct connection_t *, const char *); -extern bool udp_info_h(struct connection_t *, const char *); -extern bool mtu_info_h(struct connection_t *, const char *); +extern bool id_h(struct connection_t *c, const char *request); +extern bool metakey_h(struct connection_t *c, const char *request); +extern bool challenge_h(struct connection_t *c, const char *request); +extern bool chal_reply_h(struct connection_t *c, const char *request); +extern bool ack_h(struct connection_t *c, const char *request); +extern bool status_h(struct connection_t *c, const char *request); +extern bool error_h(struct connection_t *c, const char *request); +extern bool termreq_h(struct connection_t *c, const char *request); +extern bool ping_h(struct connection_t *c, const char *request); +extern bool pong_h(struct connection_t *c, const char *request); +extern bool add_subnet_h(struct connection_t *c, const char *request); +extern bool del_subnet_h(struct connection_t *c, const char *request); +extern bool add_edge_h(struct connection_t *c, const char *request); +extern bool del_edge_h(struct connection_t *c, const char *request); +extern bool key_changed_h(struct connection_t *c, const char *request); +extern bool req_key_h(struct connection_t *c, const char *request); +extern bool ans_key_h(struct connection_t *c, const char *request); +extern bool tcppacket_h(struct connection_t *c, const char *request); +extern bool sptps_tcppacket_h(struct connection_t *c, const char *request); +extern bool control_h(struct connection_t *c, const char *request); +extern bool udp_info_h(struct connection_t *c, const char *request); +extern bool mtu_info_h(struct connection_t *c, const char *request); #endif diff --git a/src/route.h b/src/route.h index bb4f7686..095448a3 100644 --- a/src/route.h +++ b/src/route.h @@ -54,6 +54,6 @@ extern bool pcap; extern mac_t mymac; -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/splay_tree.h b/src/splay_tree.h index 9dd749d8..06367bf5 100644 --- a/src/splay_tree.h +++ b/src/splay_tree.h @@ -39,9 +39,9 @@ typedef struct splay_node_t { } splay_node_t; -typedef int (*splay_compare_t)(const void *, const void *); -typedef void (*splay_action_t)(const void *); -typedef void (*splay_action_node_t)(const splay_node_t *); +typedef int (*splay_compare_t)(const void *data1, const void *data2); +typedef void (*splay_action_t)(const void *data); +typedef void (*splay_action_node_t)(const splay_node_t *node); typedef struct splay_tree_t { @@ -63,47 +63,47 @@ typedef struct splay_tree_t { /* (De)constructors */ -extern splay_tree_t *splay_alloc_tree(splay_compare_t, splay_action_t) __attribute__((__malloc__)); -extern void splay_free_tree(splay_tree_t *); +extern splay_tree_t *splay_alloc_tree(splay_compare_t compare, splay_action_t delete) __attribute__((__malloc__)); +extern void splay_free_tree(splay_tree_t *tree); extern splay_node_t *splay_alloc_node(void) __attribute__((__malloc__)); -extern void splay_free_node(splay_tree_t *tree, splay_node_t *); +extern void splay_free_node(splay_tree_t *tree, splay_node_t *node); /* Insertion and deletion */ -extern splay_node_t *splay_insert(splay_tree_t *, void *); -extern splay_node_t *splay_insert_node(splay_tree_t *, splay_node_t *); +extern splay_node_t *splay_insert(splay_tree_t *tree, void *data); +extern splay_node_t *splay_insert_node(splay_tree_t *tree, splay_node_t *node); -extern void splay_insert_top(splay_tree_t *, splay_node_t *); -extern void splay_insert_before(splay_tree_t *, splay_node_t *, splay_node_t *); -extern void splay_insert_after(splay_tree_t *, splay_node_t *, splay_node_t *); +extern void splay_insert_top(splay_tree_t *tree, splay_node_t *node); +extern void splay_insert_before(splay_tree_t *tree, splay_node_t *before, splay_node_t *node); +extern void splay_insert_after(splay_tree_t *tree, splay_node_t *after, splay_node_t *node); -extern splay_node_t *splay_unlink(splay_tree_t *, void *); -extern void splay_unlink_node(splay_tree_t *tree, splay_node_t *); -extern void splay_delete(splay_tree_t *, void *); -extern void splay_delete_node(splay_tree_t *, splay_node_t *); +extern splay_node_t *splay_unlink(splay_tree_t *tree, void *data); +extern void splay_unlink_node(splay_tree_t *tree, splay_node_t *node); +extern void splay_delete(splay_tree_t *tree, void *data); +extern void splay_delete_node(splay_tree_t *tree, splay_node_t *node); /* Fast tree cleanup */ -extern void splay_delete_tree(splay_tree_t *); +extern void splay_delete_tree(splay_tree_t *tree); /* Searching */ -extern void *splay_search(splay_tree_t *, const void *); -extern void *splay_search_closest(splay_tree_t *, const void *, int *); -extern void *splay_search_closest_smaller(splay_tree_t *, const void *); -extern void *splay_search_closest_greater(splay_tree_t *, const void *); +extern void *splay_search(splay_tree_t *tree, const void *data); +extern void *splay_search_closest(splay_tree_t *tree, const void *data, int *result); +extern void *splay_search_closest_smaller(splay_tree_t *tree, const void *data); +extern void *splay_search_closest_greater(splay_tree_t *tree, const void *data); -extern splay_node_t *splay_search_node(splay_tree_t *, const void *); -extern splay_node_t *splay_search_closest_node(splay_tree_t *, const void *, int *); -extern splay_node_t *splay_search_closest_node_nosplay(const splay_tree_t *, const void *, int *); -extern splay_node_t *splay_search_closest_smaller_node(splay_tree_t *, const void *); -extern splay_node_t *splay_search_closest_greater_node(splay_tree_t *, const void *); +extern splay_node_t *splay_search_node(splay_tree_t *tree, const void *data); +extern splay_node_t *splay_search_closest_node(splay_tree_t *tree, const void *data, int *result); +extern splay_node_t *splay_search_closest_node_nosplay(const splay_tree_t *tree, const void *data, int *result); +extern splay_node_t *splay_search_closest_smaller_node(splay_tree_t *tree, const void *data); +extern splay_node_t *splay_search_closest_greater_node(splay_tree_t *tree, const void *data); /* Tree walking */ -extern void splay_foreach(const splay_tree_t *, splay_action_t); -extern void splay_foreach_node(const splay_tree_t *, splay_action_t); +extern void splay_foreach(const splay_tree_t *tree, splay_action_t action); +extern void splay_foreach_node(const splay_tree_t *tree, splay_action_t action); /* Iterates over a tree. diff --git a/src/subnet.h b/src/subnet.h index 4ba10e98..cfdf2d0b 100644 --- a/src/subnet.h +++ b/src/subnet.h @@ -65,27 +65,27 @@ typedef struct subnet_t { extern splay_tree_t *subnet_tree; -extern int subnet_compare(const struct subnet_t *, const struct subnet_t *); +extern int subnet_compare(const struct subnet_t *a, const struct subnet_t *b); 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 splay_tree_t *new_subnet_tree(void) __attribute__((__malloc__)); extern void free_subnet_tree(splay_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 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 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 bool dump_subnets(struct connection_t *); +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 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); +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 bool dump_subnets(struct connection_t *c); extern void subnet_cache_flush(void); #endif diff --git a/src/upnp.h b/src/upnp.h index 48573422..b611bc11 100644 --- a/src/upnp.h +++ b/src/upnp.h @@ -22,6 +22,6 @@ #include "system.h" -extern void upnp_init(bool, bool); +extern void upnp_init(bool tcp, bool udp); #endif diff --git a/src/utils.h b/src/utils.h index 7b16bc61..a0f64bb0 100644 --- a/src/utils.h +++ b/src/utils.h @@ -50,8 +50,8 @@ extern const char *winerror(int); extern unsigned int bitfield_to_int(const void *bitfield, size_t size); -extern bool check_id(const char *); -extern bool check_netname(const char *, bool strict); +extern bool check_id(const char *id); +extern bool check_netname(const char *netname, bool strict); char *replace_name(const char *name); #endif