00001 /* 00002 * aesop-base.h 00003 * 00004 * Copyright (C) 2007-2009 Thomas A. Vaughan 00005 * All rights reserved. 00006 * 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * * Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * * Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * * Neither the name of the <organization> nor the 00016 * names of its contributors may be used to endorse or promote products 00017 * derived from this software without specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THOMAS A. VAUGHAN ''AS IS'' AND ANY 00020 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00021 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00022 * DISCLAIMED. IN NO EVENT SHALL THOMAS A. VAUGHAN BE LIABLE FOR ANY 00023 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00026 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 * 00030 * 00031 * The very base (root) aesop include file. Specifies basic objects. 00032 */ 00033 00034 #ifndef AESOP_BASE_H__ 00035 #define AESOP_BASE_H__ 00036 00037 // includes -------------------------------------------------------------------- 00038 #include "util/fixed-buffer.h" 00039 00040 00041 namespace aesop { 00042 00043 00053 00056 00057 enum eConstants { 00058 // an ID is used to identify maps, models, instances, types, etc 00059 // see later in this file for helpful ID buffer objects 00060 eAESOP_MaxIdLength = 31, 00061 eAESOP_IdBufferSize = 32, 00062 00063 // a tag string is a username, or a player tag, etc. 00064 // see later in this file for helpful ID buffer objects 00065 eAESOP_MaxTagLength = 15, 00066 eAESOP_TagBufferSize = 16, 00067 00068 // keep this last 00069 eAESOP_Invalid = 0 00070 }; 00071 00072 00073 00075 enum eProtocol { 00076 eProtocol_Major = 0, 00077 eProtocol_Minor = 1, 00078 00079 eProtocol_Long = (eProtocol_Major << 16) + eProtocol_Minor 00080 }; 00081 00082 00083 00085 enum eServerMode { 00086 eServerMode_Idle = 1, 00087 eServerMode_Game = 2, 00088 00089 // must be last 00090 eServerMode_Invalid = 0 00091 }; 00092 00093 00094 00096 enum eHostMode { 00097 eHostMode_Connected = 1, 00098 eHostMode_Authorized = 2, 00099 00100 // must be last 00101 eHostMode_Invalid = 0 00102 }; 00103 00104 00105 00107 enum ePlayerMode { 00108 ePlayerMode_UnAuth = 1, 00109 ePlayerMode_Browse = 2, 00110 ePlayerMode_Game = 3, 00111 00112 // must be last 00113 ePlayerMode_Invalid = 0 00114 }; 00115 00116 00117 00118 // helper classes for ID buffers 00119 // (see the FixedBuffer<T> template in the wavepacket libraries) 00120 class AESOPIdSizer { 00121 public: 00122 static int getBufferSize(void) throw() 00123 { return eAESOP_IdBufferSize; } 00124 char buffer[eAESOP_IdBufferSize]; 00125 }; 00126 00127 00128 00129 class AESOPTagSizer { 00130 public: 00131 static int getBufferSize(void) throw() 00132 { return eAESOP_TagBufferSize; } 00133 char buffer[eAESOP_TagBufferSize]; 00134 }; 00135 00136 00137 00139 typedef FixedBuffer<AESOPIdSizer, CommonFileValidator> AESOPIdBuffer; 00140 00142 typedef FixedBuffer<AESOPTagSizer, CommonFileValidator> AESOPTagBuffer; 00143 00144 00145 }; // aesop namespace 00146 00147 #endif // AESOP_BASE_H__ 00148