Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
opt.c File Reference
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <syslog.h>
#include <libgen.h>
#include <sys/stat.h>
#include <uuid/uuid.h>
#include "config/config.h"
#include "utils/utils.h"
#include "config/conf.h"
#include "daemon.h"
#include "ev_mgr.h"

Functions

void opt_usage (char *app_name, int app_argc, char **app_argv)
 Read command line options. More...
 
char ** ksnet_optRead (int argc, char **argv, teonet_cfg *conf, int app_argc, char **app_argv, char **app_argv_descr, int show_arg)
 Read configuration and command line options. More...
 
void ksnet_optSetApp (teonet_cfg *conf, const char *app_name, const char *app_prompt, const char *app_description)
 Set application name. More...
 

Function Documentation

char** ksnet_optRead ( int  argc,
char **  argv,
teonet_cfg conf,
int  app_argc,
char **  app_argv,
char **  app_argv_descr,
int  show_arg 
)

Read configuration and command line options.

This function should be called to read configuration and command line options

Parameters
argcNumber of command line arguments
argvString array with command line arguments
confPointer to teonet_cfg structure to read configuration and command line parameters to
app_argcNumber of application arguments
app_argvString array with application arguments names
app_argv_descrString array with application arguments descriptions
show_argShow arguments
Returns
Entered application arguments

References teonet_cfg::app_description, teonet_cfg::app_name, teonet_cfg::auth_secret, teonet_cfg::block_cli_input_f, teonet_cfg::color_output_disable_f, teonet_cfg::dflag, teonet_cfg::extended_l0_log_f, teonet_cfg::filter, free(), getDataPath(), teonet_cfg::host_name, teonet_cfg::hot_keys_f, teonet_cfg::kflag, KSN_BUFFER_SM_SIZE, KSN_MAX_HOST_NAME, ksnet_formatMessage(), ksnet_sformatMessage(), teonet_cfg::l0_allow_f, teonet_cfg::l0_public_ipv4, teonet_cfg::l0_public_ipv6, teonet_cfg::l0_tcp_ip_remote, teonet_cfg::l0_tcp_port, teonet_cfg::log_disable_f, teonet_cfg::log_priority, teonet_cfg::logging_f, teonet_cfg::net_key, teonet_cfg::network, teonet_cfg::no_multi_thread_f, opt_usage(), PACKAGE_NAME, teonet_cfg::port, teonet_cfg::port_inc_f, teonet_cfg::r_host_addr_opt, teonet_cfg::r_port, teonet_cfg::r_tcp_f, teonet_cfg::r_tcp_port, resolveDnsName(), teonet_cfg::send_ack_event_f, teonet_cfg::send_all_logs_f, teonet_cfg::show_connect_f, teonet_cfg::show_debug_f, teonet_cfg::show_debug_vv_f, teonet_cfg::show_debug_vvv_f, SHOW_PEER_CONTINUOSLY, teonet_cfg::show_peers_f, teonet_cfg::show_tr_udp_f, teonet_cfg::sig_segv_f, start_stop_daemon(), teonet_cfg::statsd_ip, teonet_cfg::statsd_peers_f, teonet_cfg::statsd_port, teonet_cfg::tcp_allow_f, teonet_cfg::tcp_port, VERSION, teonet_cfg::vpn_connect_f, teonet_cfg::vpn_ip, and teonet_cfg::vpn_mtu.

Referenced by ksnetEvMgrInitPort().

void ksnet_optSetApp ( teonet_cfg conf,
const char *  app_name,
const char *  app_prompt,
const char *  app_description 
)

Set application name.

Set application name, prompt and description (use it before ksnet_optRead)

References teonet_cfg::app_description, teonet_cfg::app_name, teonet_cfg::app_prompt, and KSN_BUFFER_SM_SIZE.

Referenced by ksnetEvMgrInitPort().

void opt_usage ( char *  app_name,
int  app_argc,
char **  app_argv 
)

Read command line options.

Show online parameters usage help.

References DEBUG_KSNET, free(), KSN_BUFFER_SIZE, KSNET_PORT_DEFAULT, M_ENAMBE_LOGGING_CLIENT, M_ENAMBE_LOGGING_SERVER, and M_ENAMBE_VPN.

Referenced by ksnet_optRead().