DTS Application Library
0.2.3
Application library containing referenced objects and interfaces to common libraries
|
A Collection of helper functions and wrapped up interfaces to other libraries. More...
Modules | |
Referenced Lockable Objects | |
Utilities for managing referenced lockable objects. | |
Posix thread interface | |
Functions for starting and managing threads. | |
Network socket interface | |
Allocate and initialise a socket for use as a client or server. | |
Linux network interface functions | |
Implement various interface routines from libnetlink. | |
INI Style config file Interface | |
Reads a ini config file into grouped hashed buckets. | |
Radius client interface | |
Simple implementation of experimental radius client. | |
Micelaneous utilities. | |
Utilities commonly used. | |
IPv4 and IPv6 functions | |
Helper functions for various calculations. | |
File utility functions | |
Convinece wrappers arround stat. | |
Openldap/SASL Interface | |
Functions to interface with a LDAP server. | |
XML Interface | |
Utilities for managing XML documents. | |
CURL Url interface. | |
Interface to libCURL. | |
Zlib Interface | |
Simplified implementation of zlib functions. | |
Burtle Bob hash algorythim. | |
lookup3.c, by Bob Jenkins, May 2006, Public Domain (Original Documentation) | |
IPv6 Nat Mapping | |
Implementation of RFC6296. | |
Windows Support | |
Support for building with mingw32 (Requires XP SP1+) | |
Files | |
file | dtsapp.h |
DTS Application library API Include file. | |
file | main.c |
Application framework. | |
Macros | |
#define | FRAMEWORK_MAIN(progname, name, email, www, year, runfile, flags, sighfunc) |
A macro to replace main() with initilization and daemonization code. More... | |
#define | ALLOC_CONST(const_var, val) |
Macro to assign values to char const. More... | |
Typedefs | |
typedef int(* | frameworkfunc )(int, char **) |
Framework callback function. More... | |
typedef void(* | syssighandler )(int, siginfo_t *, void *) |
Callback to user supplied signal handler. More... | |
Enumerations | |
enum | framework_flags { FRAMEWORK_FLAG_DAEMON = 1 << 0, FRAMEWORK_FLAG_NOGNU = 1 << 1, FRAMEWORK_FLAG_DAEMONLOCK = 1 << 2 } |
Application control flags. More... | |
Functions | |
void | printgnu (const char *pname, int year, const char *dev, const char *email, const char *www) |
Print a brief GNU copyright notice on console. More... | |
void | daemonize () |
Daemonise the application using fork/exit. More... | |
int | lockpidfile (const char *runfile) |
Lock the run file in the framework application info. More... | |
void | framework_mkcore (char *progname, char *name, char *email, char *web, int year, char *runfile, int flags, syssighandler sigfunc) |
Initilise application data structure and return a reference. More... | |
int | framework_init (int argc, char *argv[], frameworkfunc callback) |
Initilise the application daemonise and join the manager thread. More... | |
A Collection of helper functions and wrapped up interfaces to other libraries.
#define ALLOC_CONST | ( | const_var, | |
val | |||
) |
Macro to assign values to char const.
Definition at line 959 of file dtsapp.h.
Referenced by add_radserver(), framework_mkcore(), ldap_addinit(), ldap_modifyinit(), ldap_saslbind(), xml_modify(), and xslt_addparam().
#define FRAMEWORK_MAIN | ( | progname, | |
name, | |||
email, | |||
www, | |||
year, | |||
runfile, | |||
flags, | |||
sighfunc | |||
) |
A macro to replace main() with initilization and daemonization code.
progname | Descriptive program name. |
name | Copyright holders name. |
Copyright holders email. | |
www | Web address. |
year | Copyright year. |
runfile | Application runfile. |
flags | Application flags. |
sighfunc | Signal handler function. |
typedef int(* frameworkfunc)(int, char **) |
typedef void(* syssighandler)(int, siginfo_t *, void *) |
enum framework_flags |
Application control flags.
Definition at line 310 of file dtsapp.h.
void daemonize | ( | ) |
Daemonise the application using fork/exit.
This should be run early before file descriptors and threads are started
Definition at line 94 of file main.c.
References framework_core::flags, framework_core::flock, FRAMEWORK_FLAG_DAEMONLOCK, lockpidfile(), objunref(), and framework_core::runfile.
Referenced by framework_init(), and FRAMEWORK_MAIN().
int framework_init | ( | int | argc, |
char * | argv[], | ||
frameworkfunc | callback | ||
) |
Initilise the application daemonise and join the manager thread.
argc | Argument count argv[0] will be program name. |
argv | Argument array. |
callback | Function to pass control too. |
Definition at line 260 of file main.c.
References daemonize(), framework_core::developer, framework_core::email, framework_core::flags, framework_core::flock, FRAMEWORK_FLAG_DAEMON, FRAMEWORK_FLAG_DAEMONLOCK, FRAMEWORK_FLAG_NOGNU, lockpidfile(), objref(), objunref(), printgnu(), framework_core::progname, framework_core::runfile, framework_core::sa, seedrand(), sslstartup(), stopthreads(), unrefconfigfiles(), framework_core::www, and framework_core::year.
void framework_mkcore | ( | char * | progname, |
char * | name, | ||
char * | email, | ||
char * | web, | ||
int | year, | ||
char * | runfile, | ||
int | flags, | ||
syssighandler | sigfunc | ||
) |
Initilise application data structure and return a reference.
progname | Descrioptive program name. |
name | Copyright holder. |
Copyright email address. | |
web | Website address. |
year | Copyright year. |
runfile | Run file that will store the pid and be locked (flock). |
flags | Application flags. |
sigfunc | Signal handler. |
Definition at line 221 of file main.c.
References ALLOC_CONST, framework_core::developer, framework_core::email, framework_core::flags, objalloc(), objunref(), framework_core::progname, framework_core::runfile, framework_core::sa, framework_core::sig_handler, framework_core::www, and framework_core::year.
int lockpidfile | ( | const char * | runfile | ) |
Lock the run file in the framework application info.
This can be delayed till running daemonize in the user function loop setting flag FRAMEWORK_FLAG_DAEMONLOCK
runfile | File to write pid to and lock. |
Definition at line 135 of file main.c.
References framework_core::flock.
Referenced by daemonize(), and framework_init().
void printgnu | ( | const char * | pname, |
int | year, | ||
const char * | dev, | ||
const char * | email, | ||
const char * | www | ||
) |
Print a brief GNU copyright notice on console.
pname | Detailed application name. |
year | Copyright year. |
dev | Programer / copyright holder name. |
Email address. | |
www | HTTP URL. |
Definition at line 78 of file main.c.
Referenced by framework_init().