diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-11 00:12:35 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-06-11 00:12:35 +0000 |
commit | a5e941b56ea72044c4dadd9bdb8221cb919bea85 (patch) | |
tree | 938a7378ae06da558d7c6b35c4597db2a14162cf /include | |
parent | 894fdbaf3ff8e922f2872750383d2f3b34914ba0 (diff) |
Merge res_odbc and res_config
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3186 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-x | include/asterisk/config_pvt.h | 88 | ||||
-rwxr-xr-x | include/asterisk/res_odbc.h | 51 |
2 files changed, 139 insertions, 0 deletions
diff --git a/include/asterisk/config_pvt.h b/include/asterisk/config_pvt.h new file mode 100755 index 000000000..f87189d31 --- /dev/null +++ b/include/asterisk/config_pvt.h @@ -0,0 +1,88 @@ +#ifndef _ASTERISK_CONFIG_PVT_H +#define _ASTERISK_CONFIG_PVT_H +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#define CONFIG_KEYWORD_STRLEN 128 +#define CONFIG_KEYWORD_ARRAYLEN 512 +#include <asterisk/config.h> + +#define MAX_INCLUDE_LEVEL 10 + +struct ast_category { + char name[80]; + struct ast_variable *root; + struct ast_category *next; +#ifdef PRESERVE_COMMENTS + struct ast_comment *precomments; + struct ast_comment *sameline; +#endif +}; + +struct ast_config { + /* Maybe this structure isn't necessary but we'll keep it + for now */ + struct ast_category *root; + struct ast_category *prev; +#ifdef PRESERVE_COMMENTS + struct ast_comment *trailingcomments; +#endif +}; + +#ifdef PRESERVE_COMMENTS +struct ast_comment_struct +{ + struct ast_comment *root; + struct ast_comment *prev; +}; +#endif + +struct ast_category; + +struct ast_config_reg { + char name[CONFIG_KEYWORD_STRLEN]; + struct ast_config *(*func)(char *, struct ast_config *,struct ast_category **,struct ast_variable **,int +#ifdef PRESERVE_COMMENTS +,struct ast_comment_struct * +#endif +); + char keywords[CONFIG_KEYWORD_STRLEN][CONFIG_KEYWORD_ARRAYLEN]; + int keycount; + struct ast_config_reg *next; +}; + + + +int ast_config_register(struct ast_config_reg *new); +int ast_config_deregister(struct ast_config_reg *del); +void ast_cust_config_on(void); +void ast_cust_config_off(void); +int ast_cust_config_active(void); +struct ast_config_reg *get_config_registrations(void); +struct ast_config_reg *get_ast_cust_config(char *name); +struct ast_config_reg *get_ast_cust_config_keyword(char *name); +void ast_config_destroy_all(void); + + +int ast_category_delete(struct ast_config *cfg, char *category); +int ast_variable_delete(struct ast_config *cfg, char *category, char *variable, char *value); +int ast_save(char *filename, struct ast_config *cfg, char *generator); + +struct ast_config *ast_new_config(void); +struct ast_category *ast_new_category(char *name); +struct ast_variable *ast_new_variable(char *name,char *value); +int ast_cust_config_register(struct ast_config_reg *new); +int ast_cust_config_deregister(struct ast_config_reg *new); +int register_config_cli(void); +int read_ast_cust_config(void); + + + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + + +#endif diff --git a/include/asterisk/res_odbc.h b/include/asterisk/res_odbc.h new file mode 100755 index 000000000..1a68acb98 --- /dev/null +++ b/include/asterisk/res_odbc.h @@ -0,0 +1,51 @@ +/* + * Asterisk -- A telephony toolkit for Linux. + * + * Copyright (C) 1999, Mark Spencer + * + * Mark Spencer <markster@linux-support.net> + * + * res_odbc.h <ODBC resource manager> + * Copyright (C) 2004 Anthony Minessale II <anthmct@yahoo.com> + */ + +#ifndef _RES_ODBC_H +#define _RES_ODBC_H + +#include <sql.h> +#include <sqlext.h> +#include <sqltypes.h> + + + + +typedef struct odbc_obj odbc_obj; + +typedef enum { ODBC_SUCCESS=0,ODBC_FAIL=-1} odbc_status; + +struct odbc_obj { + char *name; + char *dsn; + char *username; + char *password; + SQLHENV env; /* ODBC Environment */ + SQLHDBC con; /* ODBC Connection Handle */ + SQLHSTMT stmt; /* ODBC Statement Handle */ + ast_mutex_t lock; + int up; + +}; + + + + +/* functions */ +odbc_obj *new_odbc_obj(char *name,char *dsn,char *username, char *password); +odbc_status odbc_obj_connect(odbc_obj *obj); +odbc_status odbc_obj_disconnect(odbc_obj *obj); +void destroy_obdc_obj(odbc_obj **obj); +int register_odbc_obj(char *name,odbc_obj *obj); +odbc_obj *fetch_odbc_obj(char *name); +int odbc_dump_fd(int fd,odbc_obj *obj); + +#endif |