lwes_types.h

Go to the documentation of this file.
00001 /*======================================================================*
00002  * Copyright (C) 2008 Light Weight Event System                         *
00003  * All rights reserved.                                                 *
00004  *                                                                      *
00005  * This program is free software; you can redistribute it and/or modify *
00006  * it under the terms of the GNU General Public License as published by *
00007  * the Free Software Foundation; either version 2 of the License, or    *
00008  * (at your option) any later version.                                  *
00009  *                                                                      *
00010  * This program is distributed in the hope that it will be useful,      *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
00013  * GNU General Public License for more details.                         *
00014  *                                                                      *
00015  * You should have received a copy of the GNU General Public License    *
00016  * along with this program; if not, write to the Free Software          *
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor,                   *
00018  * Boston, MA 02110-1301 USA.                                           *
00019  *======================================================================*/
00020 #ifndef __LWES_TYPES_H
00021 #define __LWES_TYPES_H
00022 
00023 #include <sys/types.h> /* for size_t in cygwin */
00024 #include <netinet/in.h>
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif 
00029 
00030 /* I wanted mainpage documentation somewhere, so this is the best place
00031    I can think of
00032  */
00033 
00072 /* Now here is the documentat for this file */
00073 
00081 typedef unsigned char      LWES_BYTE;
00082 
00086 typedef unsigned char *    LWES_BYTE_P;
00087 
00091 typedef unsigned short int LWES_U_INT_16;
00092 
00096 typedef short int          LWES_INT_16;
00097 
00101 typedef unsigned int       LWES_U_INT_32;
00102 
00106 typedef int                LWES_INT_32;
00107 
00111 typedef unsigned long long LWES_U_INT_64;
00112 
00116 typedef long long          LWES_INT_64;
00117 
00122 typedef int                LWES_BOOLEAN;
00123 
00127 typedef struct in_addr     LWES_IP_ADDR;
00128 
00132 typedef char *             LWES_SHORT_STRING;
00133 
00137 typedef char *             LWES_LONG_STRING;
00138 
00142 typedef const char *       LWES_CONST_SHORT_STRING;
00143 
00147 typedef const char *       LWES_CONST_LONG_STRING;
00148 
00152 typedef char               LWES_CHAR;
00153 
00154 /* Maximums of each type in characters for a standard encoding */
00155 /* WARNING, WARNING
00156    These #define's should be considered deprecated, they will be removed
00157    in a future version of lwes */
00158 #define SHORT_STRING_MAX    255   /*                                          */
00159 #define LONG_STRING_MAX     65535 /*                                          */
00160 #define BYTE_STRING_MAX     2     /*                   00 - FF                */
00161 #define U_INT_16_STRING_MAX 5     /*                    0 - 65535             */
00162 #define INT_16_STRING_MAX   6     /*               -32768 - 32767             */
00163 #define U_INT_32_STRING_MAX 10    /*                    0 - 4294967295        */
00164 #define INT_32_STRING_MAX   11    /*          -2147483648 - 2147483647        */
00165 #define U_INT_64_STRING_MAX 20    /*                  0 - 18446744073709551615*/
00166 #define INT_64_STRING_MAX   20    /*-9223372036854775808 - 9223372036854775807*/
00167 #define BOOLEAN_STRING_MAX  5     /*                 true - false             */
00168 #define IP_ADDR_STRING_MAX  15    /*               xxx.xxx.xxx.xxx            */
00169 
00170 #define MAX_HEADER_LENGTH   22
00171 #define MAX_BODY_LENGTH     65513  /* 65535 - 22                              */
00172 
00173 #ifndef TRUE
00174 #define TRUE 1
00175 #endif
00176 #ifndef FALSE
00177 #define FALSE 0
00178 #endif
00179 extern const size_t MAX_QUEUED_ELEMENTS;
00180 extern const size_t MAX_MSG_SIZE;
00181 
00182 /* TODO: these really need to go away and be replaced with the type enumeration
00183    below, until then they need to remain in-sync.
00184  */
00185 extern const LWES_BYTE LWES_UNDEFINED_TOKEN;
00186 extern const LWES_BYTE LWES_U_INT_16_TOKEN;
00187 extern const LWES_BYTE LWES_INT_16_TOKEN;
00188 extern const LWES_BYTE LWES_U_INT_32_TOKEN;
00189 extern const LWES_BYTE LWES_INT_32_TOKEN;
00190 extern const LWES_BYTE LWES_U_INT_64_TOKEN;
00191 extern const LWES_BYTE LWES_INT_64_TOKEN;
00192 extern const LWES_BYTE LWES_BOOLEAN_TOKEN;
00193 extern const LWES_BYTE LWES_IP_ADDR_TOKEN;
00194 extern const LWES_BYTE LWES_STRING_TOKEN;
00195 
00196 extern const LWES_SHORT_STRING LWES_UNDEFINED_STRING;
00197 extern const LWES_SHORT_STRING LWES_U_INT_16_STRING;
00198 extern const LWES_SHORT_STRING LWES_INT_16_STRING;
00199 extern const LWES_SHORT_STRING LWES_U_INT_32_STRING;
00200 extern const LWES_SHORT_STRING LWES_INT_32_STRING;
00201 extern const LWES_SHORT_STRING LWES_U_INT_64_STRING;
00202 extern const LWES_SHORT_STRING LWES_INT_64_STRING;
00203 extern const LWES_SHORT_STRING LWES_BOOLEAN_STRING;
00204 extern const LWES_SHORT_STRING LWES_IP_ADDR_STRING;
00205 extern const LWES_SHORT_STRING LWES_STRING_STRING;
00206 
00207 extern const LWES_SHORT_STRING LWES_META_INFO_STRING;
00208 
00210 typedef enum {
00211     LWES_TYPE_U_INT_16  = 1,   
00212     LWES_TYPE_INT_16    = 2,   
00213     LWES_TYPE_U_INT_32  = 3,   
00214     LWES_TYPE_INT_32    = 4,   
00215     LWES_TYPE_STRING    = 5,   
00216     LWES_TYPE_IP_ADDR   = 6,   
00217     LWES_TYPE_INT_64    = 7,   
00218     LWES_TYPE_U_INT_64  = 8,   
00219     LWES_TYPE_BOOLEAN   = 9,   
00220     LWES_TYPE_UNDEFINED = 255, 
00221 } LWES_TYPE;
00222 
00223 #ifdef __cplusplus
00224 }
00225 #endif 
00226 
00227 #endif /* __LWES_TYPES_H */

Generated on Thu Aug 21 07:18:55 2008 for lwes by  doxygen 1.4.6