summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon/src
diff options
context:
space:
mode:
authorMaxim Biro <nurupo.contributions@gmail.com>2016-01-01 01:45:23 -0500
committerMaxim Biro <nurupo.contributions@gmail.com>2016-01-01 20:29:24 -0500
commit5d9e40bbd3c5b278a93ac55ebcdda1f793c8bcdd (patch)
tree955a264fe4a200947432be5062a310570e5b4f10 /other/bootstrap_daemon/src
parent232488816eb68d2306f95bf30f003d9a044a7863 (diff)
Unify function comment style
Use doxygen java-style function comments already used in log.[c|h].
Diffstat (limited to 'other/bootstrap_daemon/src')
-rw-r--r--other/bootstrap_daemon/src/command_line_arguments.c4
-rw-r--r--other/bootstrap_daemon/src/command_line_arguments.h13
-rw-r--r--other/bootstrap_daemon/src/config.c29
-rw-r--r--other/bootstrap_daemon/src/config.h30
4 files changed, 45 insertions, 31 deletions
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 @@
31#include <stdlib.h> 31#include <stdlib.h>
32#include <string.h> 32#include <string.h>
33 33
34// Prints --help message
35 34
35/**
36 * Prints --help message
37 */
36void print_help() 38void print_help()
37{ 39{
38 // 2 space ident 40 // 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 @@
27 27
28#include "log.h" 28#include "log.h"
29 29
30// Handles command line arguments, setting cfg_file_path and log_backend. 30/**
31// Terminates the application if incorrect arguments are specified. 31 * Handles command line arguments, setting cfg_file_path and log_backend.
32 32 * Terminates the application if incorrect arguments are specified.
33 *
34 * @param argc Argc passed into main().
35 * @param argv Argv passed into main().
36 * @param cfg_file_path Sets to the provided by the user config file path.
37 * @param log_backend Sets to the provided by the user log backend option.
38 * @param run_in_foreground Sets to the provided by the user foreground option.
39 */
33void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, LOG_BACKEND *log_backend, bool *run_in_foreground); 40void handle_command_line_arguments(int argc, char *argv[], char **cfg_file_path, LOG_BACKEND *log_backend, bool *run_in_foreground);
34 41
35#endif // COMMAND_LINE_ARGUMENTS_H 42#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 @@
35 35
36#include "../../bootstrap_node_packets.h" 36#include "../../bootstrap_node_packets.h"
37 37
38// Parses tcp relay ports from `cfg` and puts them into `tcp_relay_ports` array 38/**
39// 39 * Parses tcp relay ports from `cfg` and puts them into `tcp_relay_ports` array.
40// Supposed to be called from get_general_config only 40 *
41// 41 * Supposed to be called from get_general_config only.
42// Important: iff `tcp_relay_port_count` > 0, then you are responsible for freeing `tcp_relay_ports` 42 *
43 43 * Important: iff `tcp_relay_port_count` > 0, then you are responsible for freeing `tcp_relay_ports`.
44 */
44void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int *tcp_relay_port_count) 45void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int *tcp_relay_port_count)
45{ 46{
46 const char *NAME_TCP_RELAY_PORTS = "tcp_relay_ports"; 47 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
294 return 1; 295 return 1;
295} 296}
296 297
297// Converts a hex string with even number of characters into binary 298/**
298// 299 *
299// You are responsible for freeing the return value! 300 * Converts a hex string with even number of characters into binary.
300// 301 *
301// Returns binary on success, 302 * Important: You are responsible for freeing the return value.
302// NULL on failure 303 *
303 304 * @return binary on success,
305 * NULL on failure.
306 */
304uint8_t *hex_string_to_bin(char *hex_string) 307uint8_t *hex_string_to_bin(char *hex_string)
305{ 308{
306 if (strlen(hex_string) % 2 != 0) { 309 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 @@
27 27
28#include "../../../toxcore/DHT.h" 28#include "../../../toxcore/DHT.h"
29 29
30// Gets general config options 30/**
31// 31 * Gets general config options from the config file.
32// Important: you are responsible for freeing `pid_file_path` and `keys_file_path` 32 *
33// also, iff `tcp_relay_ports_count` > 0, then you are responsible for freeing `tcp_relay_ports` 33 * Important: You are responsible for freeing `pid_file_path` and `keys_file_path`
34// and also `motd` iff `enable_motd` is set 34 * also, iff `tcp_relay_ports_count` > 0, then you are responsible for freeing `tcp_relay_ports`
35// 35 * and also `motd` iff `enable_motd` is set.
36// returns 1 on success 36 *
37// 0 on failure, doesn't modify any data pointed by arguments 37 * @return 1 on success,
38 38 * 0 on failure, doesn't modify any data pointed by arguments.
39 */
39int get_general_config(const char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port, int *enable_ipv6, 40int get_general_config(const char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port, int *enable_ipv6,
40 int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay, uint16_t **tcp_relay_ports, 41 int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay, uint16_t **tcp_relay_ports,
41 int *tcp_relay_port_count, int *enable_motd, char **motd); 42 int *tcp_relay_port_count, int *enable_motd, char **motd);
42 43
43// Bootstraps nodes listed in the config file 44/**
44// 45 * Bootstraps off nodes listed in the config file.
45// returns 1 on success, some or no bootstrap nodes were added 46 *
46// 0 on failure, a error accured while parsing config file 47 * @return 1 on success, some or no bootstrap nodes were added
47 48 * 0 on failure, a error accured while parsing config file.
49 */
48int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6); 50int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6);
49 51
50#endif // CONFIG_H 52#endif // CONFIG_H