1 /* 2 * Copyright (c) 2000-2006 Alberto Reggiori <areggiori@webweaving.org> 3 * Dirk-Willem van Gulik <dirkx@webweaving.org> 4 * 5 * NOTICE 6 * 7 * This product is distributed under a BSD/ASF like license as described in the 'LICENSE' 8 * file you should have received together with this source code. If you did not get a 9 * a copy of such a license agreement you can pick up one at: 10 * 11 * http://rdfstore.sourceforge.net/LICENSE 12 * 13 */ 14 15 #ifndef _H_DBMS_COMMS 16 #define _H_DBMS_COMMS 17 18 #include "dbms_compat.h" 19 20 /* Define standard min/max macro's if they 21 * are not defined. 22 */ 23 #ifndef MIN 24 #define MIN(x,y) (((x) < (y)) ? (x) : (y)) 25 #endif 26 27 #ifndef MAX 28 #define MAX(x,y) (((x) > (y)) ? (x) : (y)) 29 #endif 30 31 #ifdef RDFSTORE_DBMS_DEBUG_TIME 32 #define P0 0 33 #else 34 #define P0 1 35 #endif 36 37 #define DBMS_HOST "127.0.0.1" 38 #define DBMS_PORT 1234 39 #define DBMS_MODE (DBMS_XSMODE_RDWR) 40 41 #define MASK_SOURCE (128+64) 42 #define F_CLIENT_SIDE 128 43 #define F_SERVER_SIDE 64 44 #define F_INTERNAL (128+64) 45 46 #define MASK_STATUS 32 47 #define F_FOUND 32 48 #define F_NOTFOUND 0 49 50 #define MASK_TOKEN 31 51 #define TOKEN_ERROR 0 52 #define TOKEN_FETCH 1 53 #define TOKEN_STORE 2 54 #define TOKEN_DELETE 3 55 #define TOKEN_NEXTKEY 4 56 #define TOKEN_FIRSTKEY 5 57 #define TOKEN_EXISTS 6 58 #define TOKEN_SYNC 7 59 #define TOKEN_INIT 8 60 #define TOKEN_CLOSE 9 61 #define TOKEN_CLEAR 10 62 #define TOKEN_FDPASS 11 /* only used for internal passing FD*/ 63 #define TOKEN_PING 12 /* only used between servers ?? */ 64 #define TOKEN_INC 13 /* atomic increment */ 65 #define TOKEN_LIST 14 /* list all keys */ 66 #define TOKEN_DEC 15 /* atomic decrement */ 67 #define TOKEN_PACKINC 16 /* atomic packed increment */ 68 #define TOKEN_PACKDEC 17 /* atomic packed decrement */ 69 #define TOKEN_DROP 18 /* Drop database */ 70 #define TOKEN_FROM 19 /* Get first 'from' this point for a btree */ 71 72 #define TOKEN_MAX 20 /* last token.. */ 73 74 struct header { 75 unsigned char token; 76 unsigned long len1; 77 unsigned long len2; 78 #ifdef RDFSTORE_DBMS_DEBUG_TIME 79 struct timeval stamp; 80 #endif 81 }; 82 83 #define MAX_STATIC_NAME 256 84 #define MAX_STATIC_PFILE MAXPATHLEN 85 86 #ifndef MAX_PAYLOAD 87 88 /* increased (original value was 32) for RDFStore by AR and DW 2002/09/11 after too many Reconnect and dbms: 676:Cld **ERROR RQ string(s) to big 89 anyway this should be somehow related to MAXRECORDS in compress.h */ 90 #define MAX_PAYLOAD (128*1024) 91 92 #endif 93 94 #ifdef STATIC_CS_BUFF 95 #define MAX_CS_PAYLOAD MAX_PAYLOAD 96 #define P2 1 97 #else 98 #define P2 0 99 #endif 100 101 #ifdef STATIC_SC_BUFF 102 #define MAX_SC_PAYLOAD MAX_PAYLOAD 103 #define P1 1 104 #else 105 #define P1 0 106 #endif 107 108 #define DBMS_PROTO (110+P0*1+P1*2+P2*4) 109 110 #endif 111