Functions | Variables

main.c File Reference

main file (init, daemonize, startup)Module: core More...

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
#include <netdb.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <sys/utsname.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <pwd.h>
#include <grp.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include "config.h"
#include "dprint.h"
#include "daemonize.h"
#include "route.h"
#include "udp_server.h"
#include "globals.h"
#include "mem/mem.h"
#include "sr_module.h"
#include "timer.h"
#include "parser/msg_parser.h"
#include "ip_addr.h"
#include "resolve.h"
#include "parser/parse_hname2.h"
#include "parser/digest/digest_parser.h"
#include "name_alias.h"
#include "hash_func.h"
#include "pt.h"
#include "script_cb.h"
#include "nonsip_hooks.h"
#include "ut.h"
#include "signals.h"
#include "usr_avp.h"
#include "rpc_lookup.h"
#include "core_cmd.h"
#include "flags.h"
#include "lock_ops_init.h"
#include "atomic_ops_init.h"
#include "rand/fastrand.h"
#include "stats.h"
#include "counters.h"
#include "cfg/cfg.h"
#include "cfg/cfg_struct.h"
#include "cfg_core.h"
#include "endianness.h"
#include "basex.h"
#include "pvapi.h"
#include "pv_core.h"
#include "ppcfg.h"
#include "sock_ut.h"
#include "ver.h"

Go to the source code of this file.

Functions

Variables


Detailed Description

Definition in file main.c.


Function Documentation

int fix_cfg_file ( void   ) 

The function updates the value of cfg_file global variable to contain full absolute pathname to the main configuration file of SER. The function uses CFG_FILE macro to determine the default path to the configuration file if the user did not specify one using the command line option. If cfg_file contains an absolute pathname then it is used unmodified, if it contains a relative pathanme than the value returned by getcwd function will be added at the beginning. This function must be run before SER changes its current working directory to / (in daemon mode).

Returns:
Zero on success, negative number on error.

Definition at line 1228 of file main.c.

int parse_phostport ( char *  s,
char **  host,
int *  hlen,
int *  port,
int *  proto 
)

parses [proto:]host[:port] or [proto:](host_1, host_2, ... host_n)[:port] where proto= udp|tcp|tls|sctp

Parameters:
s - string (like above)
host - will be filled with the host part Note: for multi-homing it wil contain all the addresses (e.g.: "sctp:(1.2.3.4, 5.6.7.8)" => host="(1.2.3.4, 5.6.7.8)")
hlen - will be filled with the length of the host part.
port - will be filled with the port if present or 0 if it's not.
proto - will be filled with the protocol if present or PROTO_NONE if it's not.
Returns:
fills proto, port, host and returns 0 on success and -1 on failure.

Definition at line 1107 of file main.c.

Referenced by dbrow2info(), dp_apply_policy(), get_all_db_ucontacts(), and parse_phostport_mh().

Here is the caller graph for this function:

static struct name_lst* parse_phostport_mh ( char *  s,
char **  host,
int *  hlen,
int *  port,
int *  proto 
) [static, read]

parses [proto:]host[:port] or [proto:](host_1, host_2, ... host_n)[:port] where proto= udp|tcp|tls|sctp

Parameters:
s - string (like above)
host - will be filled with the host part Note: for multi-homing it wil contain all the addresses (e.g.: "sctp:(1.2.3.4, 5.6.7.8)" => host="(1.2.3.4, 5.6.7.8)")
hlen - will be filled with the length of the host part.
port - will be filled with the port if present or 0 if it's not.
proto - will be filled with the protocol if present or PROTO_NONE if it's not.
Returns:
fills proto, port, host and returns list of addresses on success (pkg malloc'ed) and 0 on failure

Definition at line 1206 of file main.c.

References parse_phostport().

Here is the call graph for this function: