DTS Application Library
0.2.3
Application library containing referenced objects and interfaces to common libraries
|
DTS Application library API Include file. More...
#include <signal.h>
#include <arpa/inet.h>
#include <linux/un.h>
Go to the source code of this file.
Data Structures | |
union | sockstruct |
Socket union describing all address types. More... | |
struct | fwsocket |
Socket data structure. More... | |
struct | config_entry |
Configuration category entry. More... | |
struct | zobj |
Zlib buffer used for compression and decompression. More... | |
struct | ifinfo |
Data structure containing interface information. More... | |
struct | framework_core |
Application framework data. More... | |
struct | xml_attr |
XML attribute name value pair. More... | |
struct | xml_node |
Reference to a XML Node. More... | |
struct | ldap_rdn |
LDAP Relative distingushed name linked list. More... | |
struct | ldap_attrval |
LDAP attribute value. More... | |
struct | ldap_attr |
LDAP attirbute. More... | |
struct | ldap_entry |
LDAP entry. More... | |
struct | ldap_results |
LDAP results. More... | |
struct | basic_auth |
Basic authentification structure. More... | |
struct | curlbuf |
Buffer containing the result of a curl transaction. More... | |
Macros | |
#define | RAD_AUTH_HDR_LEN 20 |
Authentification header length. More... | |
#define | RAD_AUTH_PACKET_LEN 4096 |
Auth packet length. More... | |
#define | RAD_AUTH_TOKEN_LEN 16 |
Auth token length. More... | |
#define | RAD_MAX_PASS_LEN 128 |
Auth max password length. More... | |
#define | RAD_ATTR_USER_NAME 1 /*string*/ |
Radius attribute username. More... | |
#define | RAD_ATTR_USER_PASSWORD 2 /*passwd*/ |
Radius attribute password. More... | |
#define | RAD_ATTR_NAS_IP_ADDR 4 /*ip*/ |
Radius attribute server IP. More... | |
#define | RAD_ATTR_NAS_PORT 5 /*int*/ |
Radius attribute server port. More... | |
#define | RAD_ATTR_SERVICE_TYPE 6 /*int*/ |
Radius attribute service type. More... | |
#define | RAD_ATTR_ACCTID 44 |
Radius attribute account id. More... | |
#define | RAD_ATTR_PORT_TYPE 61 /*int*/ |
Radius attribute port type. More... | |
#define | RAD_ATTR_EAP 79 /*oct*/ |
Radius attribute EAP. More... | |
#define | RAD_ATTR_MESSAGE 80 /*oct*/ |
Radius attribute message. More... | |
#define | JHASH_INITVAL 0xdeadbeef |
Default init value for hash functioneaster egg copied from <linux/jhash.h> More... | |
#define | jenhash(key, length, initval) hashlittle(key, length, (initval) ? initval : JHASH_INITVAL); |
Define jenhash as hashlittle on big endian it should be hashbig. More... | |
#define | clearflag(obj, flag) |
Atomically clear a flag in the flags field of a referenced object. More... | |
#define | setflag(obj, flag) |
Atomically set a flag in the flags field of a referenced object. More... | |
#define | testflag(obj, flag) (objlock(obj) | (obj->flags & flag) | objunlock(obj)) |
Atomically test a flag in the flags field of a referenced object. More... | |
#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... | |
#define | DTS_OJBREF_CLASS(classtype) |
Add this macro to a C++ class to add refobj support. More... | |
Typedefs | |
typedef struct ssldata | ssldata |
Forward decleration of structure. More... | |
typedef struct natmap | natmap |
Forward decleration of structure. More... | |
typedef struct radius_packet | radius_packet |
Forward decleration of structure. More... | |
typedef struct nfq_queue | nfq_queue |
Forward decleration of structure. More... | |
typedef struct nfq_data | nfq_data |
Forward decleration of structure. More... | |
typedef struct nfct_struct | nfct_struct |
Forward decleration of structure. More... | |
typedef struct nfqnl_msg_packet_hdr | nfqnl_msg_packet_hdr |
Forward decleration of structure. More... | |
typedef int(* | frameworkfunc )(int, char **) |
Framework callback function. More... | |
typedef void(* | syssighandler )(int, siginfo_t *, void *) |
Callback to user supplied signal handler. More... | |
typedef void(* | threadcleanup )(void *) |
Function called after thread termination. More... | |
typedef void *(* | threadfunc )(void *) |
Thread function. More... | |
typedef int(* | threadsighandler )(int, void *) |
Thread signal handler function. More... | |
typedef void(* | socketrecv )(struct fwsocket *, void *) |
Callback function to register with a socket that will be called when there is data available. More... | |
typedef void(* | objdestroy )(void *) |
Callback used to clean data of a reference object when it is to be freed. More... | |
typedef int32_t(* | blisthash )(const void *, int) |
Callback used to calculate the hash of a structure. More... | |
typedef void(* | blist_cb )(void *, void *) |
This callback is run on each entry in a list. More... | |
typedef void(* | config_filecb )(struct bucket_list *, const char *, const char *) |
Calback used when processing config files. More... | |
typedef void(* | config_catcb )(struct bucket_list *, const char *) |
Calback used when processing a category. More... | |
typedef void(* | config_entrycb )(const char *, const char *) |
Callback used when processing a entry. More... | |
typedef uint32_t(* | nfqueue_cb )(struct nfq_data *, struct nfqnl_msg_packet_hdr *, char *, uint32_t, void *, uint32_t *, void **) |
typedef void(* | radius_cb )(struct radius_packet *, void *) |
Callback to call when response arrives. More... | |
typedef struct xml_node | xml_node |
Forward decleration of structure. More... | |
typedef struct xml_search | xml_search |
Forward decleration of structure. More... | |
typedef struct xml_doc | xml_doc |
Forward decleration of structure. More... | |
typedef struct xslt_doc | xslt_doc |
Forward decleration of structure. More... | |
typedef struct ldap_conn | ldap_conn |
Forward decleration of structure. More... | |
typedef struct ldap_modify | ldap_modify |
Forward decleration of structure. More... | |
typedef struct ldap_add | ldap_add |
Forward decleration of structure. More... | |
typedef struct curl_post | curl_post |
Forward decleration of structure. More... | |
typedef struct basic_auth *(* | curl_authcb )(const char *, const char *, void *) |
Callback to set the authentification ie on error 401. More... | |
typedef int(* | curl_progress_func )(void *, double, double, double, double) |
CURL callback function called when there is progress (CURLOPT_PROGRESSFUNCTION). More... | |
typedef void(* | curl_progress_pause )(void *, int) |
Callback function to control the progress bar. More... | |
typedef void *(* | curl_progress_newdata )(void *) |
Create a new progress data structure. More... | |
Enumerations | |
enum | sock_flags { SOCK_FLAG_BIND = 1 << 0, SOCK_FLAG_CLOSE = 1 << 1, SOCK_FLAG_SSL = 1 << 2, SOCK_FLAG_UNIX = 1 << 3, SOCK_FLAG_MCAST = 1 << 4 } |
Socket flags controling a socket. More... | |
enum | thread_option_flags { THREAD_OPTION_CANCEL = 1 << 0, THREAD_OPTION_JOINABLE = 1 << 1, THREAD_OPTION_RETURN = 1 << 2 } |
Options supplied to framework_mkthread all defaults are unset. More... | |
enum | framework_flags { FRAMEWORK_FLAG_DAEMON = 1 << 0, FRAMEWORK_FLAG_NOGNU = 1 << 1, FRAMEWORK_FLAG_DAEMONLOCK = 1 << 2 } |
Application control flags. More... | |
enum | RADIUS_CODE { RAD_CODE_AUTHREQUEST = 1, RAD_CODE_AUTHACCEPT = 2, RAD_CODE_AUTHREJECT = 3, RAD_CODE_ACCTREQUEST = 4, RAD_CODE_ACCTRESPONSE = 5, RAD_CODE_AUTHCHALLENGE = 11 } |
Radius packet codes. More... | |
enum | ldap_starttls { LDAP_STARTTLS_NONE, LDAP_STARTTLS_ATTEMPT, LDAP_STARTTLS_ENFORCE } |
SSL connection requirements. More... | |
enum | ldap_attrtype { LDAP_ATTRTYPE_CHAR, LDAP_ATTRTYPE_B64, LDAP_ATTRTYPE_OCTET } |
LDAP attribute types. More... | |
Functions | |
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... | |
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... | |
struct thread_pvt * | framework_mkthread (threadfunc, threadcleanup, threadsighandler, void *data, int flags) |
create a thread result must be unreferenced More... | |
struct fwsocket * | unixsocket_server (const char *sock, int protocol, int mask, socketrecv read, void *data) |
Create and run UNIX server socket thread. More... | |
struct fwsocket * | unixsocket_client (const char *sock, int protocol, socketrecv read, void *data) |
Create a client thread on the socket. More... | |
int | framework_threadok (void) |
let threads check there status. More... | |
int | startthreads (void) |
Initialise the threadlist and start manager thread. More... | |
void | stopthreads (int join) |
Signal manager to stop and cancel all running threads. More... | |
int | thread_signal (int sig) |
Handle signal if its for me. More... | |
int | objlock (void *data) |
Lock the reference. More... | |
int | objtrylock (void *data) |
Try lock a reference. More... | |
int | objunlock (void *data) |
Unlock a reference. More... | |
int | objcnt (void *data) |
Return current reference count. More... | |
int | objsize (void *data) |
Size requested for data. More... | |
int | objunref (void *data) |
Drop reference held. More... | |
int | objref (void *data) |
Reference a object. More... | |
void * | objalloc (int size, objdestroy) |
Allocate a referenced lockable object. More... | |
void * | objchar (const char *orig) |
Return a reference to copy of a buffer. More... | |
void * | create_bucketlist (int bitmask, blisthash hash_function) |
int | addtobucket (struct bucket_list *blist, void *data) |
Add a reference to the bucketlist. More... | |
void | remove_bucket_item (struct bucket_list *blist, void *data) |
Remove and unreference a item from the list. More... | |
int | bucket_list_cnt (struct bucket_list *blist) |
Return number of items in the list. More... | |
void * | bucket_list_find_key (struct bucket_list *list, const void *key) |
Find and return a reference to a item matching supplied key. More... | |
void | bucketlist_callback (struct bucket_list *blist, blist_cb callback, void *data2) |
Run a callback function on all items in the list. More... | |
struct bucket_loop * | init_bucket_loop (struct bucket_list *blist) |
Create a bucket list iterator to safely iterate the list. More... | |
void * | next_bucket_loop (struct bucket_loop *bloop) |
Return a reference to the next item in the list this could be the first item. More... | |
void | remove_bucket_loop (struct bucket_loop *bloop) |
Safely remove a item from a list while iterating in a loop. More... | |
uint32_t | hashlittle (const void *key, size_t length, uint32_t initval) |
hash a variable-length key into a 32-bit value (Little Endian) More... | |
void | seedrand (void) |
Seed openssl random number generator. More... | |
int | genrand (void *buf, int len) |
Generate random sequence. More... | |
void | sha512sum (unsigned char *buff, const void *data, unsigned long len) |
Calculate the SHA2-512 hash. More... | |
void | sha256sum (unsigned char *buff, const void *data, unsigned long len) |
Calculate the SHA2-256 hash. More... | |
void | sha1sum (unsigned char *buff, const void *data, unsigned long len) |
Calculate the SHA1 hash. More... | |
void | md5sum (unsigned char *buff, const void *data, unsigned long len) |
Calculate the MD5 hash. More... | |
void | sha512sum2 (unsigned char *buff, const void *data, unsigned long len, const void *data2, unsigned long len2) |
Calculate the SHA2-512 hash accross 2 data chunks. More... | |
void | sha256sum2 (unsigned char *buff, const void *data, unsigned long len, const void *data2, unsigned long len2) |
Calculate the SHA2-256 hash accross 2 data chunks. More... | |
void | sha1sum2 (unsigned char *buff, const void *data, unsigned long len, const void *data2, unsigned long len2) |
Calculate the SHA1 hash accross 2 data chunks. More... | |
void | md5sum2 (unsigned char *buff, const void *data, unsigned long len, const void *data2, unsigned long len2) |
Calculate the MD5 hash accross 2 data chunks. More... | |
int | sha512cmp (unsigned char *digest1, unsigned char *digest2) |
Compare two SHA2-512 hashes. More... | |
int | sha256cmp (unsigned char *digest1, unsigned char *digest2) |
Compare two SHA2-256 hashes. More... | |
int | sha1cmp (unsigned char *digest1, unsigned char *digest2) |
Compare two SHA1 hashes. More... | |
int | md5cmp (unsigned char *digest1, unsigned char *digest2) |
Compare two md5 hashes. More... | |
void | sha512hmac (unsigned char *buff, const void *data, unsigned long len, const void *key, unsigned long klen) |
Hash Message Authentication Codes (HMAC) SHA2-512. More... | |
void | sha256hmac (unsigned char *buff, const void *data, unsigned long len, const void *key, unsigned long klen) |
Hash Message Authentication Codes (HMAC) SHA2-256. More... | |
void | sha1hmac (unsigned char *buff, const void *data, unsigned long len, const void *key, unsigned long klen) |
Hash Message Authentication Codes (HMAC) SHA1. More... | |
void | md5hmac (unsigned char *buff, const void *data, unsigned long len, const void *key, unsigned long klen) |
Hash Message Authentication Codes (HMAC) MD5. More... | |
int | strlenzero (const char *str) |
Check if a string is zero length. More... | |
char * | ltrim (char *str) |
Trim white space at the begining of a string. More... | |
char * | rtrim (const char *str) |
Trim white space at the end of a string. More... | |
char * | trim (const char *str) |
Trim whitesapce from the beggining and end of a string. More... | |
uint64_t | tvtontp64 (struct timeval *tv) |
Convert a timeval struct to 64bit NTP time. More... | |
uint16_t | checksum (const void *data, int len) |
Obtain the checksum for a buffer. More... | |
uint16_t | checksum_add (const uint16_t checksum, const void *data, int len) |
Obtain the checksum for a buffer adding a checksum. More... | |
uint16_t | verifysum (const void *data, int len, const uint16_t check) |
Verify a checksum. More... | |
struct zobj * | zcompress (uint8_t *buff, uint16_t len, uint8_t level) |
Allocate a buffer and return it with compressed data. More... | |
void | zuncompress (struct zobj *buff, uint8_t *obuff) |
Uncompress zobj buffer to buffer. More... | |
uint8_t * | gzinflatebuf (uint8_t *buf_in, int buf_size, uint32_t *len) |
Ungzip a buffer. More... | |
int | is_gzip (uint8_t *buf, int buf_size) |
check a buffer if it contains gzip magic More... | |
void | touch (const char *filename, uid_t user, gid_t group) |
Create a file and set user and group. More... | |
char * | b64enc (const char *message, int nonl) |
Base 64 encode a string. More... | |
char * | b64enc_buf (const char *message, uint32_t len, int nonl) |
Base 64 encode a buffer. More... | |
struct fwsocket * | make_socket (int family, int type, int proto, void *ssl) |
Allocate a socket structure and return reference. More... | |
struct fwsocket * | accept_socket (struct fwsocket *sock) |
Create and return a socket structure from accept() More... | |
struct fwsocket * | sockconnect (int family, int stype, int proto, const char *ipaddr, const char *port, void *ssl) |
Generic client socket. More... | |
struct fwsocket * | udpconnect (const char *ipaddr, const char *port, void *ssl) |
UDP Socket client. More... | |
struct fwsocket * | tcpconnect (const char *ipaddr, const char *port, void *ssl) |
TCP Socket client. More... | |
struct fwsocket * | sockbind (int family, int stype, int proto, const char *ipaddr, const char *port, void *ssl, int backlog) |
Generic server socket. More... | |
struct fwsocket * | udpbind (const char *ipaddr, const char *port, void *ssl) |
UDP server socket. More... | |
struct fwsocket * | tcpbind (const char *ipaddr, const char *port, void *ssl, int backlog) |
Generic server socket. More... | |
void | close_socket (struct fwsocket *sock) |
Mark the socket for closure and release the reference. More... | |
int | score_ipv4 (struct sockaddr_in *sa4, char *ipaddr, int iplen) |
Return a score for a IPv4 addrress. More... | |
int | score_ipv6 (struct sockaddr_in6 *sa6, char *ipaddr, int iplen) |
Return a score for a IPv6 addrress. More... | |
int | inet_lookup (int family, const char *host, void *addr, socklen_t len) |
Perform DNS lookup on a host/ip retun the IP address. More... | |
void | socketclient (struct fwsocket *sock, void *data, socketrecv read, threadcleanup cleanup) |
Create a server thread with a socket that has been created with sockbind udpbind or tcpbind. More... | |
void | socketserver (struct fwsocket *sock, socketrecv connectfunc, socketrecv acceptfunc, threadcleanup cleanup, void *data) |
Create a server thread with a socket that has been created with sockbind udpbind or tcpbind. More... | |
struct fwsocket * | mcast_socket (const char *iface, int family, const char *mcastip, const char *port, int flags) |
Create a multicast socket. More... | |
const char * | sockaddr2ip (union sockstruct *addr, char *buf, int len) |
Return the ip address of a sockstruct addr. More... | |
int | checkipv6mask (const char *ipaddr, const char *network, uint8_t bits) |
Check if ipaddr is in a network. More... | |
void | ipv4tcpchecksum (uint8_t *pkt) |
Update the TCP checksum of a IPv4 packet. More... | |
void | ipv4udpchecksum (uint8_t *pkt) |
Update the UDP checksum of a IPv4 packet. More... | |
void | ipv4icmpchecksum (uint8_t *pkt) |
Set the checksup of a IPv4 ICMP packet. More... | |
void | ipv4checksum (uint8_t *pkt) |
Set the checksup of a IPv4 Packet. More... | |
int | packetchecksumv4 (uint8_t *pkt) |
Update the checksum of a IPv4 packet. More... | |
int | packetchecksumv6 (uint8_t *pkt) |
Prototype to check checksup on packet. More... | |
int | packetchecksum (uint8_t *pkt) |
Generic IPv4 and IPv6 Checksum. More... | |
void | rfc6296_map (struct natmap *map, struct in6_addr *ipaddr, int out) |
Lookup and process a NAT transform as per RFC 6296. More... | |
int | rfc6296_map_add (char *intaddr, char *extaddr) |
Calculate and add a NAT map. More... | |
const char * | cidrtosn (int bitlen, char *buf, int size) |
Return the dotted quad notation subnet mask from a CIDR. More... | |
const char * | getnetaddr (const char *ipaddr, int cidr, char *buf, int size) |
Return the network address. More... | |
const char * | getbcaddr (const char *ipaddr, int cidr, char *buf, int size) |
Return broadcast address. More... | |
const char * | getfirstaddr (const char *ipaddr, int cidr, char *buf, int size) |
Get the first usable address. More... | |
const char * | getlastaddr (const char *ipaddr, int cidr, char *buf, int size) |
Get the last usable address. More... | |
uint32_t | cidrcnt (int bitlen) |
Return the number of IP addresses in a given bitmask. More... | |
int | reservedip (const char *ipaddr) |
Check IP against list of reserved IP's. More... | |
char * | ipv6to4prefix (const char *ipaddr) |
Return IPv6 to IPv4 Prefix fot the address. More... | |
int | check_ipv4 (const char *ip, int cidr, const char *test) |
Check if a IP address is in a network. More... | |
void | mcast4_ip (struct in_addr *addr) |
Randomally assign a SSM Multicast address. More... | |
void | mcast6_ip (struct in6_addr *addr) |
Randomally assign a SSM Multicast address.param addr Ip address structure to fill out. More... | |
struct nfq_queue * | nfqueue_attach (uint16_t pf, uint16_t num, uint8_t mode, uint32_t range, nfqueue_cb cb, void *data) |
uint16_t | snprintf_pkt (struct nfq_data *tb, struct nfqnl_msg_packet_hdr *ph, uint8_t *pkt, char *buff, uint16_t len) |
struct nf_conntrack * | nf_ctrack_buildct (uint8_t *pkt) |
uint8_t | nf_ctrack_delete (uint8_t *pkt) |
uint8_t | nf_ctrack_nat (uint8_t *pkt, uint32_t addr, uint16_t port, uint8_t dnat) |
void | nf_ctrack_dump (void) |
struct nfct_struct * | nf_ctrack_trace (void) |
void | nf_ctrack_endtrace (struct nfct_struct *nfct) |
uint8_t | nf_ctrack_init (void) |
void | nf_ctrack_close (void) |
int | delete_kernvlan (char *ifname, int vid) |
Delete a VLAN. More... | |
int | create_kernvlan (char *ifname, unsigned short vid) |
Create a VLAN on a interface. More... | |
int | delete_kernmac (char *macdev) |
Delete Kernel MAC VLAN. More... | |
int | create_kernmac (char *ifname, char *macdev, unsigned char *mac) |
Create a kernal MAC VLAN. More... | |
int | interface_bind (char *iface, int protocol) |
Bind to device fd may be a existing socket. More... | |
void | randhwaddr (unsigned char *addr) |
create random MAC address More... | |
int | create_tun (const char *ifname, const unsigned char *hwaddr, int flags) |
Create a tunnel device. More... | |
int | ifrename (const char *oldname, const char *newname) |
Rename interface helper. More... | |
int | ifdown (const char *ifname, int flags) |
Set interface down. More... | |
int | ifup (const char *ifname, int flags) |
Set interface up. More... | |
int | ifhwaddr (const char *ifname, unsigned char *hwaddr) |
Get MAC addr for interface. More... | |
int | set_interface_flags (int ifindex, int set, int clear) |
Alter interface flags. More... | |
int | get_iface_index (const char *ifname) |
Get the netlink interface for a named interface. More... | |
int | set_interface_addr (int ifindex, const unsigned char *hwaddr) |
Set interface MAC addr. More... | |
int | set_interface_name (int ifindex, const char *name) |
Rename interface. More... | |
int | set_interface_ipaddr (char *ifname, char *ipaddr) |
Set IP addr on interface. More... | |
int | get_ip6_addrprefix (const char *iface, unsigned char *prefix) |
Generate Unique Local IPv6 Unicast Addresses RFC 4193. More... | |
void | eui48to64 (unsigned char *mac48, unsigned char *eui64) |
Generate IPv6 address from mac address. More... | |
void | closenetlink (void) |
Close netlink socket on application termination. More... | |
const char * | get_ifipaddr (const char *iface, int family) |
Find best IP adress for a interface. More... | |
void | addradattrint (struct radius_packet *packet, char type, unsigned int val) |
Add a integer attribute too the packet. More... | |
void | addradattrip (struct radius_packet *packet, char type, char *ipaddr) |
Add a integer attribute too the packet. More... | |
void | addradattrstr (struct radius_packet *packet, char type, char *str) |
Add a integer attribute too the packet. More... | |
struct radius_packet * | new_radpacket (unsigned char code) |
Create a new radius packet. More... | |
int | send_radpacket (struct radius_packet *packet, const char *userpass, radius_cb read_cb, void *cb_data) |
Send radius packet. More... | |
void | add_radserver (const char *ipaddr, const char *auth, const char *acct, const char *secret, int timeout) |
Add new radius server to list of servers. More... | |
unsigned char * | radius_attr_first (struct radius_packet *packet) |
Return first packet attribute. More... | |
unsigned char * | radius_attr_next (struct radius_packet *packet, unsigned char *attr) |
Return next packet attribute. More... | |
void | sslstartup (void) |
Initialise SSL support this should be called at startup. More... | |
void * | tlsv1_init (const char *cacert, const char *cert, const char *key, int verify) |
Create a SSL structure for TLSv1. More... | |
void * | sslv2_init (const char *cacert, const char *cert, const char *key, int verify) |
Create a SSL structure for SSLv2 (If available) More... | |
void * | sslv3_init (const char *cacert, const char *cert, const char *key, int verify) |
Create a SSL structure for SSLv3. More... | |
void * | dtlsv1_init (const char *cacert, const char *cert, const char *key, int verify) |
Create a SSL structure for DTLSv1. More... | |
int | socketread (struct fwsocket *sock, void *buf, int num) |
Read from a socket into a buffer. More... | |
int | socketwrite (struct fwsocket *sock, const void *buf, int num) |
Write a buffer to a socket. More... | |
int | socketread_d (struct fwsocket *sock, void *buf, int num, union sockstruct *addr) |
Read from a socket into a buffer. More... | |
int | socketwrite_d (struct fwsocket *sock, const void *buf, int num, union sockstruct *addr) |
Write a buffer to a socket. More... | |
void | ssl_shutdown (void *ssl, int sock) |
Shutdown the SSL connection. More... | |
void | tlsaccept (struct fwsocket *sock, struct ssldata *orig) |
Create SSL session for new connection. More... | |
struct fwsocket * | dtls_listenssl (struct fwsocket *sock) |
Implementation of "listen" for DTLSv1. More... | |
void | startsslclient (struct fwsocket *sock) |
Start SSL on a client socket. More... | |
void | unrefconfigfiles (void) |
Empty out and unreference config files. More... | |
int | process_config (const char *configname, const char *configfile) |
Process a configfile into buckets. More... | |
struct bucket_loop * | get_category_loop (const char *configname) |
Return a bucket loop to allow iterating over categories. More... | |
struct bucket_list * | get_category_next (struct bucket_loop *cloop, char *name, int len) |
Iterate through categories returning the entries bucket. More... | |
struct bucket_list * | get_config_category (const char *configname, const char *category) |
Return a single category. More... | |
struct config_entry * | get_config_entry (struct bucket_list *categories, const char *item) |
Find the entry in a config file. More... | |
void | config_file_callback (config_filecb file_cb) |
Callback wrapper to iterate over all configfiles calling a callback on each file. More... | |
void | config_cat_callback (struct bucket_list *categories, config_catcb entry_cb) |
Callback wrapper that iterates through categories calling a callback on each category. More... | |
void | config_entry_callback (struct bucket_list *entries, config_entrycb entry_cb) |
Callback Wraper that iterates through all items calling a callback for each item. More... | |
struct xml_doc * | xml_loaddoc (const char *docfile, int validate) |
Load a XML file into XML document and return reference. More... | |
struct xml_doc * | xml_loadbuf (const uint8_t *buffer, uint32_t len, int validate) |
Load a buffer into XML document returning refereence. More... | |
struct xml_node * | xml_getfirstnode (struct xml_search *xpsearch, void **iter) |
Return reference to the first node optionally creating a iterator. More... | |
struct xml_node * | xml_getnextnode (void *iter) |
Return the next node. More... | |
struct bucket_list * | xml_getnodes (struct xml_search *xpsearch) |
Return reference to bucket list containing nodes. More... | |
struct xml_search * | xml_xpath (struct xml_doc *xmldata, const char *xpath, const char *attrkey) |
Return a reference to a xpath search result. More... | |
int | xml_nodecount (struct xml_search *xsearch) |
Return the number of nodes in the search path. More... | |
struct xml_node * | xml_getnode (struct xml_search *xsearch, const char *key) |
Return a node in the search matching key. More... | |
const char * | xml_getattr (struct xml_node *xnode, const char *attr) |
Return value of attribute. More... | |
void | xml_modify (struct xml_doc *xmldoc, struct xml_node *xnode, const char *value) |
Modify a XML node. More... | |
void | xml_setattr (struct xml_doc *xmldoc, struct xml_node *xnode, const char *name, const char *value) |
Modify a XML node attribute. More... | |
struct xml_node * | xml_addnode (struct xml_doc *xmldoc, const char *xpath, const char *name, const char *value, const char *attrkey, const char *keyval) |
Append a node to a path. More... | |
void | xml_appendnode (struct xml_doc *xmldoc, const char *xpath, struct xml_node *child) |
Append a node to a path. More... | |
void | xml_unlink (struct xml_node *xnode) |
Unlink a node from the document. More... | |
void | xml_delete (struct xml_node *xnode) |
Delete a node from document it is not unrefd and should be. More... | |
char * | xml_getbuffer (void *buffer) |
Return the buffer of a xml_buffer structure. More... | |
void * | xml_doctobuffer (struct xml_doc *xmldoc) |
Return a dump of a XML document. More... | |
const char * | xml_getrootname (struct xml_doc *xmldoc) |
Return the name of the root node. More... | |
struct xml_node * | xml_getrootnode (struct xml_doc *xmldoc) |
Return reference to the root node. More... | |
void | xml_savefile (struct xml_doc *xmldoc, const char *file, int format, int compress) |
Save XML document to a file. More... | |
void | xml_createpath (struct xml_doc *xmldoc, const char *xpath) |
Create a path in XML document. More... | |
void | xml_init () |
Initialise/Reference the XML library. More... | |
void | xml_close () |
Unreference the XML library. More... | |
struct xslt_doc * | xslt_open (const char *xsltfile) |
Open a XSLT file returning reference to it. More... | |
void | xslt_addparam (struct xslt_doc *xsltdoc, const char *param, const char *value) |
Add a parameter to the XSLT document. More... | |
void | xslt_apply (struct xml_doc *xmldoc, struct xslt_doc *xsltdoc, const char *filename, int comp) |
Apply XSLT document to a XML document. More... | |
void * | xslt_apply_buffer (struct xml_doc *xmldoc, struct xslt_doc *xsltdoc) |
Apply XSLT document to a XML document returning result in buffer. More... | |
void | xslt_init () |
Reference the XSLT parser. More... | |
void | xslt_close () |
Release reference to XSLT parser. More... | |
struct ldap_conn * | ldap_connect (const char *uri, enum ldap_starttls starttls, int timelimit, int limit, int debug, int *err) |
Connect to a LDAP server. More... | |
int | ldap_simplebind (struct ldap_conn *ld, const char *dn, const char *passwd) |
Bind to the connection with simple bind requireing a distingushed name and password. More... | |
int | ldap_saslbind (struct ldap_conn *ld, const char *mech, const char *realm, const char *authcid, const char *passwd, const char *authzid) |
Bind to the server with SASL. More... | |
int | ldap_simplerebind (struct ldap_conn *ld, const char *initialdn, const char *initialpw, const char *base, const char *filter, const char *uidrdn, const char *uid, const char *passwd) |
Bind to LDAP connection using rebind. More... | |
const char * | ldap_errmsg (int res) |
Return LDAP error for a ldap error. More... | |
struct ldap_results * | ldap_search_sub (struct ldap_conn *ld, const char *base, const char *filter, int b64enc, int *res,...) |
Search LDAP connection subtree. More... | |
struct ldap_results * | ldap_search_one (struct ldap_conn *ld, const char *base, const char *filter, int b64enc, int *res,...) |
Search LDAP connection one level. More... | |
struct ldap_results * | ldap_search_base (struct ldap_conn *ld, const char *base, const char *filter, int b64enc, int *res,...) |
Search LDAP connection base. More... | |
void | ldap_unref_entry (struct ldap_results *results, struct ldap_entry *entry) |
Remove a entry from a result. More... | |
void | ldap_unref_attr (struct ldap_entry *entry, struct ldap_attr *attr) |
Remove a attribute from a entry. More... | |
struct ldap_entry * | ldap_getentry (struct ldap_results *results, const char *dn) |
Find and return the entry from the results for a specific dn. More... | |
struct ldap_attr * | ldap_getattr (struct ldap_entry *entry, const char *attr) |
Find and return attribute in a entry. More... | |
struct ldap_modify * | ldap_modifyinit (const char *dn) |
Create a modification reference for a DN. More... | |
int | ldap_mod_del (struct ldap_modify *lmod, const char *attr,...) |
Delete values from a attribute. More... | |
int | ldap_mod_add (struct ldap_modify *lmod, const char *attr,...) |
Add values to a attribute. More... | |
int | ldap_mod_rep (struct ldap_modify *lmod, const char *attr,...) |
Replace a attribute. More... | |
int | ldap_domodify (struct ldap_conn *ld, struct ldap_modify *lmod) |
Apply the modification to the server. More... | |
int | ldap_mod_remattr (struct ldap_conn *ldap, const char *dn, const char *attr) |
Delete a attribute from a DN. More... | |
int | ldap_mod_delattr (struct ldap_conn *ldap, const char *dn, const char *attr, const char *value) |
Delete a value from a attribute in a DN. More... | |
int | ldap_mod_addattr (struct ldap_conn *ldap, const char *dn, const char *attr, const char *value) |
Add a value for a attribute in a DN. More... | |
int | ldap_mod_repattr (struct ldap_conn *ldap, const char *dn, const char *attr, const char *value) |
Replace the value of a attribute in a DN. More... | |
int | curlinit (void) |
Initilise the CURL library. More... | |
void | curlclose (void) |
Un reference CURL. This is required for each call to curlinit(). More... | |
struct basic_auth * | curl_newauth (const char *user, const char *passwd) |
Create a new auth structure with initial vallues. More... | |
struct curlbuf * | curl_geturl (const char *def_url, struct basic_auth *bauth, curl_authcb authcb, void *data) |
Fetch the URL using CURL (HTTP GET) More... | |
void | curl_setprogress (curl_progress_func cb, curl_progress_pause p_cb, curl_progress_newdata d_cb, void *data) |
Configure global progress handling. More... | |
void | curl_setauth_cb (curl_authcb auth_cb, void *data) |
Set global password callback. More... | |
struct curl_post * | curl_newpost (void) |
Create a HTTP Post data structure. More... | |
void | curl_postitem (struct curl_post *post, const char *name, const char *item) |
Add a item value pair to post structure. More... | |
struct curlbuf * | curl_posturl (const char *def_url, struct basic_auth *bauth, struct curl_post *post, curl_authcb authcb, void *data) |
Fetch the URL using CURL (HTTP POST) More... | |
struct curlbuf * | curl_ungzip (struct curlbuf *cbuf) |
If the buffer contains GZIP data uncompress it. More... | |
struct xml_doc * | curl_buf2xml (struct curlbuf *cbuf) |
Create a XML document from from buffer (application/xml) More... | |
char * | url_escape (char *url) |
Escape and return the url. More... | |
char * | url_unescape (char *url) |
UN escape and return the url. More... | |
int | is_file (const char *path) |
Determine if a file exists. More... | |
int | is_dir (const char *path) |
Determine if a path is a directory. More... | |
int | is_exec (const char *path) |
Determine if a file is executable. More... | |
int | mk_dir (const char *dir, mode_t mode, uid_t user, gid_t group) |
Create a directory. More... | |
DTS Application library API Include file.
The library foremostly implements reference counted objects and hashed bucket lists Referenced Lockable Objects these are then used to implement simpler API's to common tasks.
Definition in file dtsapp.h.