/* librock/data.h - - - - - - - - - - - - Copyright Notice - - - - - - - - - - - - Copyright 1998-2000 Forrest J. Cavalier III See http://www.rocketaware.com/librock/ for documentation and original copies of this software. This software shall be distributed with the implementation source code according to the license terms therein. License text in librock_LIDESC_HC=12440211096131f5976d36be0cddca4cd9152e45 */ #ifndef librock_INC_DATA_H #define librock_INC_DATA_H #include #ifdef __cplusplus extern "C" { #endif /**************************************************************/ #ifdef librock_INC_TYPES_C librock_uint32_t librock_CRC32(librock_uint32_t crc,const void *pBuf,unsigned int cbBuf); #endif /**************************************************************/ #ifdef librock_INC_TYPES_C typedef struct { librock_uint32_t state[4]; /* state (ABCD) */ librock_uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } librock_MD5_CTX; void librock_MD5Init (librock_MD5_CTX *); void librock_MD5Update (librock_MD5_CTX *, const unsigned char *, unsigned int); void librock_MD5Final (unsigned char [16], librock_MD5_CTX *); /* Copied public interface items from the shs1.h file for librock, and expanded and replaced macros here to keep the global namespace clean */ /*Expanded by hand: #define SHS1_CHUNKWORDS ((1<<6)/sizeof(librock_uint32_t)) */ /*Expanded by hand: SHS1_DIGESTSIZE is a the length of the digest as defined by the algorithm #define SHS1_DIGESTWORDS ((20)/sizeof(librock_uint32_t)) */ /* * The structure for storing SHS1 info * * We will assume that bit count is a multiple of 8. */ typedef struct { librock_uint32_t digest[/*SHS1_DIGESTWORDS*/((20)/sizeof(librock_uint32_t))]; /* message digest */ librock_uint32_t countLo; /* 64 bit count: bits 3-34 */ librock_uint32_t countHi; /* 64 bit count: bits 35-63 */ librock_uint32_t datalen; /* length of data in data */ librock_uint32_t data[/*SHS1_CHUNKWORDS*/((1<<6)/sizeof(librock_uint32_t))]; /* SHS1 chunk buffer */ } librock_SHS1_INFO; void librock_shs1_Init (librock_SHS1_INFO*); void librock_shs1_Update (librock_SHS1_INFO*, const unsigned char *, librock_uint32_t); void librock_shs1_Final (librock_SHS1_INFO*); #endif /**************************************************************/ #ifdef librock_WANT_dbiodbc_win32 void *librock_dbi_odbc_open(const char *pszParams,char **ppaszErr); #else #define librock_dbi_odbc_open librock_dbi_fail_open #endif #ifdef librock_WANT_db_s struct librock_db_s { const char *(*pfnClose)(void *idConn,char **ppaszErr); void *(*pfnExec)(void *idConn,const char *str,char **ppaszErr); void *(*pfnExec_2)(void *idConn,const char *str,char **ppaszErr,int *prowcount); const char *(*pfnFetch)(void *idResults,const char ***ppCols,int *pnCols,char **ppaszErr); const char *(*pfnQuote)(void *idConn,char **ppaszQuoted,const char *val,int cnt); }; #endif void *librock_dbi_open(const char *params,char **ppaszErr); const char *librock_dbi_close(void *idConn,char **ppaszErr); void *librock_dbi_exec(void *idConn,const char *str,char **ppaszErr); void *librock_dbi_exec_2(void *idConn,const char *str,char **ppaszErr,int *pRowcount); const char *librock_dbi_fetch_row(void *idResults,const char ***ppCols,int *pnCols,char **ppaszErr); const char *librock_dbi_quote(void *idConn,char **ppaszQuoted,const char *val,int cnt); /**************************************************************/ /**************************************************************/ struct librock_attributes_s *librock_attributes_alloc(); void librock_attributes_free(struct librock_attributes_s *pAttributes); const char *librock_attributes_get(struct librock_attributes_s *pAttributes, const char *pName, int cbName); const char *librock_attributes_getparent( struct librock_attributes_s *pa, const char *pszPrefix, const char *pName, int cbName); const char *librock_attributes_set(struct librock_attributes_s *pa, const char *pszPrefix, const char *pName,int cbName, const char *pVal,int cbVal); const char *librock_attributes_iter(struct librock_attributes_s *pa, const char *place, const char *pszPrefix); #ifdef librock_INC_FILEIO_C const char *librock_attributes_readfile( FILE *f, struct librock_attributes_s *paReturn, int onesection, const char *pszFileName, long iLine, char **ppaszErrors); #endif /*// Simple extensions */ const char *librock_attributes_idchars( struct librock_attributes_s *pa, const char *pszCharset, int val); struct librock_attributes_s *librock_attributes_setcontext( struct librock_attributes_s *paCurrent, struct librock_attributes_s *paContext, char **ppaszErr); typedef const char *(*librock_attributes_fngettype)(struct librock_attributes_s *pa,const char *name,int cbName); librock_attributes_fngettype librock_attributes_setfnget( struct librock_attributes_s *pa, librock_attributes_fngettype fnget); /*// Advanced extensions. Rarely needed. See notes. */ void librock_attributes_astrcatPosition( struct librock_attributes_s *pa, char **ppasz); int librock_attributes_evalexpr( char **ppaszResult, const char *pStart, struct librock_attributes_s *pa, char **ppaszErrors); int librock_attributes_interpret( char **ppasz, const char *pStart, struct librock_attributes_s *pa, char **ppaszError); typedef int (*librock_attributes_fnevalexprtype)(char **ppaszResult,const char *pStart,struct librock_attributes_s *pa,char **ppaszErrors); librock_attributes_fnevalexprtype librock_attributes_extendexpr( struct librock_attributes_s *pa, librock_attributes_fnevalexprtype fneval); /**************************************************************/ #ifdef __cplusplus }; #endif #include /**************************************************************/ #endif /* $Log: data.h,v $ Revision 1.3 2002/04/19 14:59:07 forrest@mibsoftware.com rights=#1 SHS1. const correctness. Revision 1.2 2002/04/09 03:55:08 forrest@mibsoftware.com rights=#1 local/local2 bracket. extern "C" bracket. Revision 1.1 2002/03/22 04:21:33 forrest@mibsoftware.com rights=#1 Created. rights#1 Copyright (c) Forrest J Cavalier III d-b-a Mib Software rights#1 License text in librock_LIDESC_HC=12440211096131f5976d36be0cddca4cd9152e45 */