Unify function comment style

Use doxygen java-style function comments already used in log.[c|h].
This commit is contained in:
Maxim Biro 2016-01-01 01:45:23 -05:00
parent 232488816e
commit 5d9e40bbd3
4 changed files with 45 additions and 31 deletions

View File

@ -31,8 +31,10 @@
#include <stdlib.h>
#include <string.h>
// Prints --help message
/**
* Prints --help message
*/
void print_help()
{
// 2 space ident

View File

@ -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

View File

@ -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) {

View File

@ -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