diff options
author | Brian Cully <bjc@kublai.com> | 2008-04-14 21:52:55 -0400 |
---|---|---|
committer | Brian Cully <github.20.shmit@spamgourmet.com> | 2008-04-14 21:52:55 -0400 |
commit | 6ba98a9f9f48e13738d9736cba9c45b5e94f42f2 (patch) | |
tree | 86d7c281bcdbf67eb53cee064aa905e740ec5ccf /include/.svn/text-base | |
download | nastd-6ba98a9f9f48e13738d9736cba9c45b5e94f42f2.tar.gz nastd-6ba98a9f9f48e13738d9736cba9c45b5e94f42f2.zip |
Initial import
Diffstat (limited to 'include/.svn/text-base')
-rw-r--r-- | include/.svn/text-base/compat.h.svn-base | 83 | ||||
-rw-r--r-- | include/.svn/text-base/conf.h.svn-base | 16 | ||||
-rw-r--r-- | include/.svn/text-base/config.h.svn-base | 40 | ||||
-rw-r--r-- | include/.svn/text-base/nastd.h.svn-base | 85 | ||||
-rw-r--r-- | include/.svn/text-base/nastipc.h.svn-base | 69 | ||||
-rw-r--r-- | include/.svn/text-base/version.h.svn-base | 8 |
6 files changed, 301 insertions, 0 deletions
diff --git a/include/.svn/text-base/compat.h.svn-base b/include/.svn/text-base/compat.h.svn-base new file mode 100644 index 0000000..3d1e3e6 --- /dev/null +++ b/include/.svn/text-base/compat.h.svn-base @@ -0,0 +1,83 @@ +/* $Id: compat.h,v 1.4 2000/03/21 19:06:58 shmit Exp $ */ + +#ifndef COMPAT_H +# define COMPAT_H + +#include <netdb.h> +#include <syslog.h> +#include <sys/param.h> +#include <sys/types.h> +#include <netinet/in.h> + +#if __GNUC__ +#define RCSID(x) static const char rcsid[] __attribute__((__unused__)) = x +#else +#define RCSID(x) static const char rcsid[] = x +#endif + +#if OS_SOLARIS +#define NEED_SNPRINTF 1 +#define NEED_SHADOW 1 +#define NEED_CRYPT 1 +#define NEED_SETPROCTITLE 1 +#define NEED_STRINGS 1 + +#if SOLARIS_55 +#define NEED_CRYPT 1 +#include <pthread.h> +#endif +#endif /* OS_SOLARIS */ + +#if OS_FREEBSD +#include <libutil.h> + +#if FREEBSD_2 +typedef u_int32_t uint32_t; +#endif /* FREEBSD_2 */ +#endif /* OS_FREEBSD */ + +#if OS_LINUX +#define NEED_SETPROCTITLE 1 +#endif /* OS_LINUX */ + +#ifndef LOG_PERROR +#define LOG_PERROR 0 +#endif + +#ifndef IPPORT_HIFIRSTAUTO +#define IPPORT_HIFIRSTAUTO 49152 +#endif + +#ifndef IPPORT_HILASTAUTO +#define IPPORT_HILASTAUTO 65535 +#endif + +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 1024 +#endif + +#if NEED_SETPROCTITLE +void setproctitle(const char *fmt, ...); +#endif + +#if NEED_SNPRINTF +int snprintf(char *str, size_t size, const char *fmt, ...); +#endif + +#if NEED_MEMCPY +void *memcpy(void *dst, const void *src, size_t len); +#endif + +#if NEED_MEMSET +void *memcpy(void *dst, char c, size_t len); +#endif + +#if NEED_SETPROCTITLE +void setproctitle(const char *fmt, ...); +#endif + +#endif diff --git a/include/.svn/text-base/conf.h.svn-base b/include/.svn/text-base/conf.h.svn-base new file mode 100644 index 0000000..1b6ed37 --- /dev/null +++ b/include/.svn/text-base/conf.h.svn-base @@ -0,0 +1,16 @@ +/* $Id: conf.h,v 1.6 2000/11/15 20:20:50 shmit Exp $ */ + +#ifndef CONF_H +#define CONF_H + +#include <compat.h> +#include <version.h> + +#define PERIODICITY 30 /* How many seconds between + periodic functions. */ + +#ifndef DATADIR +#define DATADIR "/home/shmit/libdata/nastd" +#endif + +#endif diff --git a/include/.svn/text-base/config.h.svn-base b/include/.svn/text-base/config.h.svn-base new file mode 100644 index 0000000..36d3611 --- /dev/null +++ b/include/.svn/text-base/config.h.svn-base @@ -0,0 +1,40 @@ +/* $Id: config.h,v 1.3 2001/11/09 15:54:37 shmit Exp $ */ + +#ifndef CONFIG_H +# define CONFIG_H + +enum data_type { NUMBER, STRING, ARRAY, DICTIONARY }; + +struct conf_entry { + char *name; + void *data; + int namelen, datalen; + enum data_type type; + int num_entries; +}; +typedef struct conf_entry conf_entry_t; + +struct nast_config { + char *description; + char *nast_dir; + char *nast_sock; + char *nast_cdb_file; + char *mysql_host; + char *mysql_user; + char *mysql_pass; + int nofork_flag; + int null_cache_timeout; + int tcp_port; +}; + +extern struct nast_config config; + +int config_init(); +void config_delete(); +void config_setdefaults(); +void *config_find(void *root_node, const char *name, enum data_type *type); +void *config_arrayitemat(void *array, int index, enum data_type *type); +void *config_dictitemat(void *dict, const char *name, enum data_type *type); +void *getdata(void *itemref, void *dst, enum data_type want_type); + +#endif diff --git a/include/.svn/text-base/nastd.h.svn-base b/include/.svn/text-base/nastd.h.svn-base new file mode 100644 index 0000000..b1fbaa4 --- /dev/null +++ b/include/.svn/text-base/nastd.h.svn-base @@ -0,0 +1,85 @@ +/* $Id: nastd.h,v 1.7 2001/10/29 11:17:12 shmit Exp $ */ + +#ifndef NASTD_H +#define NASTD_H + +enum _nast_bool { NASTFALSE = 0, NASTTRUE = 1 }; +typedef enum _nast_bool nast_bool; + +enum _errcodes { + NAST_OK = 0, + NAST_SERVER_GONE = 1, + NAST_NOMEM = 2, + NAST_UNKNOWN_RESPONSE = 3, + NAST_TIMEDOUT = 4, + NAST_UNKNOWN_OPT = 5, + NAST_SERVER_ERR +}; +typedef enum _errcodes errcodes; + +struct _nast_options { + nast_bool use_qcache; + nast_bool use_localdb; + nast_bool fallthrough_async; + nast_bool always_fallthrough; + nast_bool fail_once; + nast_bool no_fallthrough; +}; +typedef struct _nast_options nast_options; + +struct _nast_string_t { + char *strdata; + int strlen; +}; +typedef struct _nast_string_t nast_string_t; + +struct _nast_array { + int nitems; + nast_string_t **items; +}; +typedef struct _nast_array nast_array; + +struct _nast_response { + char *buffer; + char *errmsg; + errcodes errcode; + short bufflen; + unsigned short reqid; +}; +typedef struct _nast_response nast_response; + +struct _nast_sphincter { + nast_response **responses; + void *lock; + int socket; + int nthreads; +}; +typedef struct _nast_sphincter nasth; + +nasth *nast_sphincter_new(const char *sock_path); +int nast_sphincter_connect(nasth *sphincter, const char *hostname, + unsigned short port, const char *username, + const char *password); +void nast_sphincter_close(nasth *sphincter); + +nast_array *nast_get_result(nasth *sphincter); +void nast_free_result(nast_array *result); + +nast_array *nast_array_new(); +int nast_array_add(nast_array *array, short len, const char *data); +void nast_array_delete(nast_array *array); + +int nast_options_set(nasth *sphincter, nast_options *opts); +int nast_options_get(nasth *sphincter, nast_options *opts); + +int nast_add(nasth *sphincter, const char *query); +int nast_del(nasth *sphincter, const char *query); +int nast_get(nasth *sphincter, const char *query); +int nast_upd(nasth *sphincter, const char *key, nast_array *valarray); + +int nast_stats(nasth *sphincter); + +errcodes nast_geterr(nasth *sphincter); +char *nast_errmsg(nasth *sphincter); + +#endif diff --git a/include/.svn/text-base/nastipc.h.svn-base b/include/.svn/text-base/nastipc.h.svn-base new file mode 100644 index 0000000..7309e8b --- /dev/null +++ b/include/.svn/text-base/nastipc.h.svn-base @@ -0,0 +1,69 @@ +/* $Id: nastipc.h,v 1.3 2001/01/19 00:29:26 shmit Exp $ */ + +#ifndef NASTIPC_H +#define NASTIPC_H + +#define NASTHOLE "/tmp/nastd.sock" + +/* Protocol section */ + +/* + * Send NASTESC to start a new command. The next byte specifies the + * type of command. + */ +#define NASTCMD '\xff' + +/* + * Commands, prefixed by NASTCMD. + */ +#define NASTADD '\x01' +#define NASTDEL '\x02' +#define NASTUPD '\x03' +#define NASTGET '\x04' +#define NASTDIE '\x0f' + +/* Commands for server options. */ +#define NASTOPTGET '\x10' +#define NASTOPTSET '\x11' + +/* Command to get stats. */ +#define NASTSTATS '\x20' + +/* Server -> client responses. These can be postfixed with a string. */ +#define NASTOK '\xf1' +#define NASTERR '\xf2' +#define NASTARG '\xe0' + +/* The quote character, for globbing multiple strings together. */ +#define NASTQUOTE '\xfe' + +/* + * The escape character, to send binary that may be interpereted + * incorrectly. + */ +#define NASTESC '\xfd' + +/* Item seperator, for returning multiple items in one response. */ +#define NASTSEP '\xfc' + +/* + * The options. Ass more get added to the protocol, just add them here. + * Do not dupe option numbers. That'd be bad. + * Use these after the NASTCMD NASTOPTGET sequence. All options require + * an argument. Most are true/false, but some will require other types. + * Check nastd.h for option types. + * (e.g.: NASTCMD NASTOPTGET OPTQCACHE OPTFALSE - don't use the query cache) + * (e.g.: NASTCMD NASTOPTGET OPTNTHREADS 0x10 - allocate 16 threads) + */ +#define OPTFALSE '\x00' +#define OPTTRUE '\x01' + +#define OPTQCACHE '\x01' +#define OPTLOCALDB '\x02' +#define OPTFALLASYNC '\x03' +#define OPTALWAYSFALL '\x04' +#define OPTFAILONCE '\x05' +#define OPTNTHREADS '\x06' +#define OPTNOFALLTHROUGH '\x07' + +#endif diff --git a/include/.svn/text-base/version.h.svn-base b/include/.svn/text-base/version.h.svn-base new file mode 100644 index 0000000..efd9441 --- /dev/null +++ b/include/.svn/text-base/version.h.svn-base @@ -0,0 +1,8 @@ +/* $Id: version.h,v 1.5 2001/05/30 21:00:12 shmit Exp $ */ + +#ifndef VERSION_H +#define VERSION_H + +#define VERSION "nast 1.2.0-devel $Date: 2001/05/30 21:00:12 $" + +#endif |