/* MCVE v3.x C API (c) 2002 by Main Street Softworks, Inc. Written by Brad House This API is being released to the public domain to be modified and used in any manor the holder of this code sees fit. For any questions please contact support@mainstreetsoftworks.com */ #ifndef __LIBM_MAIN_H__ #define __LIBM_MAIN_H__ /* Standard includes ... all platforms */ #include #include #include #include #include #include #include #include #ifdef HAVE_STRINGS_H #include #endif /* Win32 includes */ #ifdef _WIN32 #include #include #include #else /* !Win32 */ /* UNIX/POSIX includes */ #include #include #ifndef DISABLE_IP #include #include #include #endif #include #include #endif /* Win32 */ #include "monetra.h" #ifdef ENABLE_SSL #include #include #include #include #include #include #endif #ifndef HAVE_SOCKLEN_T typedef int socklen_t; #endif typedef struct M_TRANS { char *key; char *value; } M_TRANS; typedef struct M_QUEUE { char identifier[31]; int type; int admin; int status; /* Store outgoing transaction fields -- key/value pairs */ int transaction_fields; M_TRANS *transaction; // Stuff read from return int code; int avs; int cv; char *auth; char *text; M_int64 tid; char *item; char *batch; int resp_fields; M_TRANS *parsed_resp; // Comma Delimited response storage char *response; int iscommadelimited; // storage char ***separated; int columns; int rows; void *next; void *prev; } M_QUEUE; #include "libmonetra_utils.h" #include "libmonetra_misc.h" #include "libmonetra_parsing.h" #include "libmonetra_cdparsing.h" #include "libmonetra_locking.h" #include "libmonetra_sockets.h" #include "libmonetra_file.h" #include "libmonetra_strings.h" #include "libmonetra_snprintf.h" #ifdef _WIN32 #define ioctl(a,b,c) ioctlsocket(a,b,c) #endif #define M_FILE 1 #define M_SOCKETS 2 #define M_SSL 3 #define M_DISCONNECTED 0 #define M_CONNECTED 1 typedef struct _M_CONN { int conn_method; // Drop File, Sockets, SSL char location[251]; // Either Drop-File directory, or hostname unsigned short port; // For IP and SSL, a port number int ptr; // For IP and SSL, the pointer to an open connection char *inbuf; int inbuf_cnt; int inbuf_alloc; char *outbuf; int outbuf_cnt; int outbuf_alloc; int status; int do_debug; long timeout; int blocking; int verifyconn; int verifyssl; int validate_identifier; int max_conn_time; char *error_text; #ifdef ENABLE_SSL SSL *ssl; X509 *server_cert; SSL_CTX *client_ctx; char ca_location[255]; char sslkeyfile[255]; char sslcertfile[255]; #endif // int CA_verify; // char *CA_cert; // To store an SSL certificate // char *CA_key; // To store an SSL key long outstanding_auths; long queue_length; M_QUEUE *queue; M_Register_Mutex mutexreg; M_Mutex_Lock mutexlock; M_Mutex_Unlock mutexunlock; M_Unregister_Mutex mutexunreg; void *mutex; } _M_CONN; #ifdef ENABLE_SSL extern SSL_CTX *client_ctx; #endif int M_TransParam_Add(M_CONN *myconn, M_uintptr identifier, const char *key, const char *value); #define IP_BLOCK_SIZE 64*1024 #endif