From 5d9e40bbd3c5b278a93ac55ebcdda1f793c8bcdd Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Fri, 1 Jan 2016 01:45:23 -0500 Subject: Unify function comment style Use doxygen java-style function comments already used in log.[c|h]. --- .../bootstrap_daemon/src/command_line_arguments.c | 4 ++- .../bootstrap_daemon/src/command_line_arguments.h | 13 +++++++--- other/bootstrap_daemon/src/config.c | 29 +++++++++++---------- other/bootstrap_daemon/src/config.h | 30 ++++++++++++---------- 4 files changed, 45 insertions(+), 31 deletions(-) (limited to 'other/bootstrap_daemon/src') diff --git a/other/bootstrap_daemon/src/command_line_arguments.c b/other/bootstrap_daemon/src/command_line_arguments.c index d364d329..d5f301ee 100644 --- a/other/bootstrap_daemon/src/command_line_arguments.c +++ b/other/bootstrap_daemon/src/command_line_arguments.c @@ -31,8 +31,10 @@ #include #include -// Prints --help message +/** + * Prints --help message + */ void print_help() { // 2 space ident diff --git a/other/bootstrap_daemon/src/command_line_arguments.h b/other/bootstrap_daemon/src/command_line_arguments.h index c96e8eaa..c73cd15e 100644 --- a/other/bootstrap_daemon/src/command_line_arguments.h +++ b/other/bootstrap_daemon/src/command_line_arguments.h @@ -27,9 +27,16 @@ #include "log.h" -// Handles command line arguments, setting cfg_file_path and log_backend. -// Terminates the application if incorrect arguments are specified. - +/** + * Handles command line arguments, setting cfg_file_path and log_backend. + * Terminates the application if incorrect arguments are specified. + * + * @param argc Argc passed into main(). + * @param argv Argv passed into main(). + * @param cfg_file_path Sets to the provided by the user config file path. + * @param log_backend Sets to the provided by the user log backend option. + * @param run_in_foreground Sets to the provided by the user foreground option. + */ void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, LOG_BACKEND *log_backend, bool *run_in_foreground); #endif // COMMAND_LINE_ARGUMENTS_H diff --git a/other/bootstrap_daemon/src/config.c b/other/bootstrap_daemon/src/config.c index 84e18a69..861a3803 100644 --- a/other/bootstrap_daemon/src/config.c +++ b/other/bootstrap_daemon/src/config.c @@ -35,12 +35,13 @@ #include "../../bootstrap_node_packets.h" -// Parses tcp relay ports from `cfg` and puts them into `tcp_relay_ports` array -// -// Supposed to be called from get_general_config only -// -// Important: iff `tcp_relay_port_count` > 0, then you are responsible for freeing `tcp_relay_ports` - +/** + * Parses tcp relay ports from `cfg` and puts them into `tcp_relay_ports` array. + * + * Supposed to be called from get_general_config only. + * + * Important: iff `tcp_relay_port_count` > 0, then you are responsible for freeing `tcp_relay_ports`. + */ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int *tcp_relay_port_count) { const char *NAME_TCP_RELAY_PORTS = "tcp_relay_ports"; @@ -294,13 +295,15 @@ int get_general_config(const char *cfg_file_path, char **pid_file_path, char **k return 1; } -// Converts a hex string with even number of characters into binary -// -// You are responsible for freeing the return value! -// -// Returns binary on success, -// NULL on failure - +/** + * + * Converts a hex string with even number of characters into binary. + * + * Important: You are responsible for freeing the return value. + * + * @return binary on success, + * NULL on failure. + */ uint8_t *hex_string_to_bin(char *hex_string) { if (strlen(hex_string) % 2 != 0) { diff --git a/other/bootstrap_daemon/src/config.h b/other/bootstrap_daemon/src/config.h index 91f9c43f..13cf929a 100644 --- a/other/bootstrap_daemon/src/config.h +++ b/other/bootstrap_daemon/src/config.h @@ -27,24 +27,26 @@ #include "../../../toxcore/DHT.h" -// Gets general config options -// -// Important: you are responsible for freeing `pid_file_path` and `keys_file_path` -// also, iff `tcp_relay_ports_count` > 0, then you are responsible for freeing `tcp_relay_ports` -// and also `motd` iff `enable_motd` is set -// -// returns 1 on success -// 0 on failure, doesn't modify any data pointed by arguments - +/** + * Gets general config options from the config file. + * + * Important: You are responsible for freeing `pid_file_path` and `keys_file_path` + * also, iff `tcp_relay_ports_count` > 0, then you are responsible for freeing `tcp_relay_ports` + * and also `motd` iff `enable_motd` is set. + * + * @return 1 on success, + * 0 on failure, doesn't modify any data pointed by arguments. + */ int get_general_config(const char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port, int *enable_ipv6, int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay, uint16_t **tcp_relay_ports, int *tcp_relay_port_count, int *enable_motd, char **motd); -// Bootstraps nodes listed in the config file -// -// returns 1 on success, some or no bootstrap nodes were added -// 0 on failure, a error accured while parsing config file - +/** + * Bootstraps off nodes listed in the config file. + * + * @return 1 on success, some or no bootstrap nodes were added + * 0 on failure, a error accured while parsing config file. + */ int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6); #endif // CONFIG_H -- cgit v1.2.3