mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Unify function comment style
Use doxygen java-style function comments already used in log.[c|h].
This commit is contained in:
parent
232488816e
commit
5d9e40bbd3
|
@ -31,8 +31,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// Prints --help message
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints --help message
|
||||||
|
*/
|
||||||
void print_help()
|
void print_help()
|
||||||
{
|
{
|
||||||
// 2 space ident
|
// 2 space ident
|
||||||
|
|
|
@ -27,9 +27,16 @@
|
||||||
|
|
||||||
#include "log.h"
|
#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);
|
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
|
#endif // COMMAND_LINE_ARGUMENTS_H
|
||||||
|
|
|
@ -35,12 +35,13 @@
|
||||||
|
|
||||||
#include "../../bootstrap_node_packets.h"
|
#include "../../bootstrap_node_packets.h"
|
||||||
|
|
||||||
// Parses tcp relay ports from `cfg` and puts them into `tcp_relay_ports` array
|
/**
|
||||||
//
|
* Parses tcp relay ports from `cfg` and puts them into `tcp_relay_ports` array.
|
||||||
// Supposed to be called from get_general_config only
|
*
|
||||||
//
|
* 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`
|
*
|
||||||
|
* 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)
|
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";
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts a hex string with even number of characters into binary
|
/**
|
||||||
//
|
*
|
||||||
// You are responsible for freeing the return value!
|
* Converts a hex string with even number of characters into binary.
|
||||||
//
|
*
|
||||||
// Returns binary on success,
|
* Important: You are responsible for freeing the return value.
|
||||||
// NULL on failure
|
*
|
||||||
|
* @return binary on success,
|
||||||
|
* NULL on failure.
|
||||||
|
*/
|
||||||
uint8_t *hex_string_to_bin(char *hex_string)
|
uint8_t *hex_string_to_bin(char *hex_string)
|
||||||
{
|
{
|
||||||
if (strlen(hex_string) % 2 != 0) {
|
if (strlen(hex_string) % 2 != 0) {
|
||||||
|
|
|
@ -27,24 +27,26 @@
|
||||||
|
|
||||||
#include "../../../toxcore/DHT.h"
|
#include "../../../toxcore/DHT.h"
|
||||||
|
|
||||||
// Gets general config options
|
/**
|
||||||
//
|
* 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`
|
* Important: You are responsible for freeing `pid_file_path` and `keys_file_path`
|
||||||
// and also `motd` iff `enable_motd` is set
|
* 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
|
* @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 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 *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);
|
int *tcp_relay_port_count, int *enable_motd, char **motd);
|
||||||
|
|
||||||
// Bootstraps nodes listed in the config file
|
/**
|
||||||
//
|
* Bootstraps off 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
|
* @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);
|
int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6);
|
||||||
|
|
||||||
#endif // CONFIG_H
|
#endif // CONFIG_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user