Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
conf.c File Reference
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <sys/stat.h>
#include <confuse.h>
#include "config/conf.h"
#include "config/config.h"
#include "utils/utils.h"

Macros

#define save_conf_back()
 

Functions

void set_defaults (teonet_cfg *teo_cfg)
 Set default configuration parameters. More...
 
void ksnet_configInit (teonet_cfg *teo_cfg, void *ke)
 Get configuration parameters. More...
 
void read_config (teonet_cfg *conf, int port_param)
 Read configuration parameters from file. More...
 
char * uconfigFileName (char *buf, const int BUF_SIZE, const int type, const int port, const char *network)
 Create unique port configuration file name. More...
 

Variables

const char * localhost
 KSNet mesh core module. More...
 
const char * null_str
 

Detailed Description

Author
Kirill Scherba

Created on April 11, 2015, 6:10 AM

Teonet configuration parameters module

Macro Definition Documentation

#define save_conf_back ( )
Value:
strncpy(conf->net_key, net_key, KSN_BUFFER_SM_SIZE/2); \
strncpy(conf->auth_secret, auth_secret, KSN_BUFFER_SM_SIZE/2); \
strncpy(conf->host_name, host_name, KSN_MAX_HOST_NAME); \
strncpy(conf->r_host_addr, r_host_addr, KSN_BUFFER_SM_SIZE/2); \
strncpy(conf->vpn_ip, vpn_ip, KSN_MAX_HOST_NAME); \
strncpy(conf->statsd_ip, statsd_ip, KSN_BUFFER_SM_SIZE/2); \
strncpy(conf->vpn_dev_name, vpn_dev_name, KSN_MAX_HOST_NAME); \
strncpy(conf->vpn_dev_hwaddr, vpn_dev_hwaddr, KSN_MAX_HOST_NAME); \
strncpy(conf->l0_tcp_ip_remote, l0_tcp_ip_remote, KSN_BUFFER_SM_SIZE/2); \
strncpy(conf->filter, filter, KSN_BUFFER_SM_SIZE/2); \
strncpy(conf->l0_public_ipv4, l0_public_ipv4, KSN_BUFFER_SM_SIZE/2); \
strncpy(conf->l0_public_ipv6, l0_public_ipv6, KSN_BUFFER_SM_SIZE/2)
#define KSN_BUFFER_SM_SIZE
Size of small buffer for string.
Definition: conf.h:16
#define KSN_MAX_HOST_NAME
Definition: conf.h:20

Referenced by read_config().

Function Documentation

void ksnet_configInit ( teonet_cfg teo_cfg,
void *  ke 
)

Get configuration parameters.

Todo:
: Set port param

References ke, teonet_cfg::ke, and set_defaults().

Referenced by ksnetEvMgrInitPort().

void read_config ( teonet_cfg conf,
int  port_param 
)
char* uconfigFileName ( char *  buf,
const int  BUF_SIZE,
const int  type,
const int  port,
const char *  network 
)

Create unique port configuration file name.

Parameters
bufBuffer to create file name
BUF_SIZESize of buffer
typeConfiguration file type: 0 - system; 1 - local
portPort number
networkNetwork name
Returns

References free(), getDataPath(), ksnet_formatMessage(), and ksnet_getSysConfigDir().

Variable Documentation

const char* localhost

KSNet mesh core module.

Examples:
teotun.c.

Referenced by ksnetArpAddHost().

const char * null_str

Referenced by event_cb(), and ksnetArpShowStr().