Annotation of embedaddon/php/ext/dba/php_dba.h, revision 1.1

1.1     ! misho       1: /*
        !             2:    +----------------------------------------------------------------------+
        !             3:    | PHP Version 5                                                        |
        !             4:    +----------------------------------------------------------------------+
        !             5:    | Copyright (c) 1997-2012 The PHP Group                                |
        !             6:    +----------------------------------------------------------------------+
        !             7:    | This source file is subject to version 3.01 of the PHP license,      |
        !             8:    | that is bundled with this package in the file LICENSE, and is        |
        !             9:    | available through the world-wide-web at the following url:           |
        !            10:    | http://www.php.net/license/3_01.txt                                  |
        !            11:    | If you did not receive a copy of the PHP license and are unable to   |
        !            12:    | obtain it through the world-wide-web, please send a note to          |
        !            13:    | license@php.net so we can mail you a copy immediately.               |
        !            14:    +----------------------------------------------------------------------+
        !            15:    | Author: Sascha Schumann <sascha@schumann.cx>                         |
        !            16:    +----------------------------------------------------------------------+
        !            17:  */
        !            18: 
        !            19: /* $Id: php_dba.h 321634 2012-01-01 13:15:04Z felipe $ */
        !            20: 
        !            21: #ifndef PHP_DBA_H
        !            22: #define PHP_DBA_H
        !            23: 
        !            24: #if HAVE_DBA
        !            25: 
        !            26: typedef enum { 
        !            27:        /* do not allow 0 here */
        !            28:        DBA_READER = 1,
        !            29:        DBA_WRITER,
        !            30:        DBA_TRUNC,
        !            31:        DBA_CREAT
        !            32: } dba_mode_t;
        !            33: 
        !            34: typedef struct dba_lock {
        !            35:        php_stream *fp;
        !            36:        char *name;
        !            37:        int mode; /* LOCK_EX,LOCK_SH */
        !            38: } dba_lock;
        !            39: 
        !            40: typedef struct dba_info {
        !            41:        /* public */
        !            42:        void *dbf;               /* ptr to private data or whatever */
        !            43:        char *path;
        !            44:        dba_mode_t mode;
        !            45:        php_stream *fp;  /* this is the database stream for builtin handlers */
        !            46:        int fd;
        !            47:        /* arg[cv] are only available when the dba_open handler is called! */
        !            48:        int argc;
        !            49:        zval ***argv;
        !            50:        /* private */
        !            51:        int flags; /* whether and how dba did locking and other flags*/
        !            52:        struct dba_handler *hnd;        
        !            53:        dba_lock lock;
        !            54: } dba_info;
        !            55: 
        !            56: #define DBA_LOCK_READER  (0x0001)
        !            57: #define DBA_LOCK_WRITER  (0x0002)
        !            58: #define DBA_LOCK_CREAT   (0x0004)
        !            59: #define DBA_LOCK_TRUNC   (0x0008)
        !            60: 
        !            61: #define DBA_LOCK_EXT     (0)
        !            62: #define DBA_LOCK_ALL     (DBA_LOCK_READER|DBA_LOCK_WRITER|DBA_LOCK_CREAT|DBA_LOCK_TRUNC)
        !            63: #define DBA_LOCK_WCT     (DBA_LOCK_WRITER|DBA_LOCK_CREAT|DBA_LOCK_TRUNC)
        !            64: 
        !            65: #define DBA_STREAM_OPEN  (0x0010)
        !            66: #define DBA_PERSISTENT   (0x0020)
        !            67: 
        !            68: #define DBA_CAST_AS_FD   (0x0050)
        !            69: #define DBA_NO_APPEND    (0x00D0)
        !            70: 
        !            71: extern zend_module_entry dba_module_entry;
        !            72: #define dba_module_ptr &dba_module_entry
        !            73: 
        !            74: typedef struct dba_handler {
        !            75:        char *name; /* handler name */
        !            76:        int flags; /* whether and how dba does locking and other flags*/
        !            77:        int (*open)(dba_info *, char **error TSRMLS_DC);
        !            78:        void (*close)(dba_info * TSRMLS_DC);
        !            79:        char* (*fetch)(dba_info *, char *, int, int, int * TSRMLS_DC);
        !            80:        int (*update)(dba_info *, char *, int, char *, int, int TSRMLS_DC);
        !            81:        int (*exists)(dba_info *, char *, int TSRMLS_DC);
        !            82:        int (*delete)(dba_info *, char *, int TSRMLS_DC);
        !            83:        char* (*firstkey)(dba_info *, int * TSRMLS_DC);
        !            84:        char* (*nextkey)(dba_info *, int * TSRMLS_DC);
        !            85:        int (*optimize)(dba_info * TSRMLS_DC);
        !            86:        int (*sync)(dba_info * TSRMLS_DC);
        !            87:        char* (*info)(struct dba_handler *hnd, dba_info * TSRMLS_DC);
        !            88:                /* dba_info==NULL: Handler info, dba_info!=NULL: Database info */
        !            89: } dba_handler;
        !            90: 
        !            91: /* common prototypes which must be supplied by modules */
        !            92: 
        !            93: #define DBA_OPEN_FUNC(x) \
        !            94:        int dba_open_##x(dba_info *info, char **error TSRMLS_DC)
        !            95: #define DBA_CLOSE_FUNC(x) \
        !            96:        void dba_close_##x(dba_info *info TSRMLS_DC)
        !            97: #define DBA_FETCH_FUNC(x) \
        !            98:        char *dba_fetch_##x(dba_info *info, char *key, int keylen, int skip, int *newlen TSRMLS_DC)
        !            99: #define DBA_UPDATE_FUNC(x) \
        !           100:        int dba_update_##x(dba_info *info, char *key, int keylen, char *val, int vallen, int mode TSRMLS_DC)
        !           101: #define DBA_EXISTS_FUNC(x) \
        !           102:        int dba_exists_##x(dba_info *info, char *key, int keylen TSRMLS_DC)
        !           103: #define DBA_DELETE_FUNC(x) \
        !           104:        int dba_delete_##x(dba_info *info, char *key, int keylen TSRMLS_DC)
        !           105: #define DBA_FIRSTKEY_FUNC(x) \
        !           106:        char *dba_firstkey_##x(dba_info *info, int *newlen TSRMLS_DC)
        !           107: #define DBA_NEXTKEY_FUNC(x) \
        !           108:        char *dba_nextkey_##x(dba_info *info, int *newlen TSRMLS_DC)
        !           109: #define DBA_OPTIMIZE_FUNC(x) \
        !           110:        int dba_optimize_##x(dba_info *info TSRMLS_DC)
        !           111: #define DBA_SYNC_FUNC(x) \
        !           112:        int dba_sync_##x(dba_info *info TSRMLS_DC)
        !           113: #define DBA_INFO_FUNC(x) \
        !           114:        char *dba_info_##x(dba_handler *hnd, dba_info *info TSRMLS_DC)
        !           115: 
        !           116: #define DBA_FUNCS(x) \
        !           117:        DBA_OPEN_FUNC(x); \
        !           118:        DBA_CLOSE_FUNC(x); \
        !           119:        DBA_FETCH_FUNC(x); \
        !           120:        DBA_UPDATE_FUNC(x); \
        !           121:        DBA_DELETE_FUNC(x); \
        !           122:        DBA_EXISTS_FUNC(x); \
        !           123:        DBA_FIRSTKEY_FUNC(x); \
        !           124:        DBA_NEXTKEY_FUNC(x); \
        !           125:        DBA_OPTIMIZE_FUNC(x); \
        !           126:        DBA_SYNC_FUNC(x); \
        !           127:        DBA_INFO_FUNC(x)
        !           128: 
        !           129: #define VALLEN(p) Z_STRVAL_PP(p), Z_STRLEN_PP(p)
        !           130:        
        !           131: PHP_FUNCTION(dba_open);
        !           132: PHP_FUNCTION(dba_popen);
        !           133: PHP_FUNCTION(dba_close);
        !           134: PHP_FUNCTION(dba_firstkey);
        !           135: PHP_FUNCTION(dba_nextkey);
        !           136: PHP_FUNCTION(dba_replace);
        !           137: PHP_FUNCTION(dba_insert);
        !           138: PHP_FUNCTION(dba_delete);
        !           139: PHP_FUNCTION(dba_exists);
        !           140: PHP_FUNCTION(dba_fetch);
        !           141: PHP_FUNCTION(dba_optimize);
        !           142: PHP_FUNCTION(dba_sync);
        !           143: PHP_FUNCTION(dba_handlers);
        !           144: PHP_FUNCTION(dba_list);
        !           145: PHP_FUNCTION(dba_key_split);
        !           146: 
        !           147: #else
        !           148: #define dba_module_ptr NULL
        !           149: #endif
        !           150: 
        !           151: #define phpext_dba_ptr dba_module_ptr
        !           152: 
        !           153: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>