00001 /* 00002 changes: 00003 added ODB packet types, xandi, 250300 00004 added CCP packet types, xandi, 270300 00005 added MCP packet types, xandi, 270300 00006 */ 00007 00008 #ifndef PROTOCOL_H 00009 #define PROTOCOL_H 00010 00011 #include <string> 00012 #include <sys/time.h> 00013 00014 #define MAX_PACKET_HEADER 5 00015 00017 struct packet_header { 00018 int from; 00019 int to; 00020 timeval TimeStamp; 00021 int header[MAX_PACKET_HEADER]; 00022 int length; 00023 }; 00024 00026 typedef struct packet { 00027 packet_header h; 00028 string data; 00029 // void erase ( void ); 00030 }; 00031 00032 /* 00033 void packet::erase() 00034 { 00035 //memset ( h, 0x00, sizeof(h) ); 00036 data.erase(); 00037 } 00038 */ 00039 // packet->header[0] = 00040 00041 00042 //<TEMPORARY> 00043 #define CLIENT_CORE 1 00044 #define CLIENT_OUTPUT 2 00045 //</TEMPORARY> 00046 00047 00048 #define PROT_HANDSHAKE 1 00049 #define PROT_AUTHENTICATE 2 00050 #define PROT_REQUEST_MATRIX 3 00051 #define PROT_KILL_CLIENT 254 00052 00053 00054 #define PROT_MATRIX_STUFF 4 00055 #define PROT_MATRIX_STUFF_REPLY 5 00056 00057 #define PROT_REGISTER_ENTITY 6 00058 #define PROT_REGISTER_ENTITY_REPLY 7 00059 00060 #define PROT_ADD_OBJECT 8 00061 #define PROT_ADD_OBJECT_REPLY 9 00062 00063 #define PROT_GET_ALL_OBJECTS_REPLY 10 00064 #define PROT_GET_ALL_ATOMS_REPLY 11 00065 #define PROT_GET_OBJECT_REPLY 12 00066 #define PROT_GET_ATOM_REPLY 13 00067 00068 #define PROT_GET_ALL_CHANGED 14 00069 00070 #define PROT_GET_OBJECT 15 00071 #define PROT_REQUEST_REPLY 16 00072 #define PROT_ACCESS_MATRIX 17 00073 #define PROT_MATRIX_ACCESS_REPLY 18 00074 #define PROT_RECEIVE_OBJECT 19 00075 #define PROT_RECEIVE_ATOM 20 00076 00077 00078 00079 00080 #define PROT_OUTPUT_VISUAL 29 00081 #define PROT_OUTPUT_DUMMY 666 00082 00083 #define PROT_INPUT_MOVE 30 00084 #define PROT_INPUT_ROTATE 31 00085 #define PROT_INPUT_SPIN 32 00086 #define PROT_INPUT_SPEED 33 00087 00088 #define PROT_SEND_MSG 40 00089 00090 #define PROT_CHANGE_POSITION 41 00091 #define PROT_AVATAR_HULL 42 00092 00093 #define PROT_CHAT_MSG 43 00094 #define PROT_TEXT_MSG 44 00095 #define PROT_TURN_AVATAR_OFF 45 00096 00097 00098 #define INPUT_FORWARD 2 00099 #define INPUT_BACKWARD 3 00100 #define INPUT_SPIN_UP 4 00101 #define INPUT_SPIN_DOWN 5 00102 #define INPUT_ROTATE_X 6 00103 #define INPUT_ROTATE_Y 7 00104 #define INPUT_ROTATE_Z 8 00105 00106 #define VISUAL_CAMERA_MOVE 1 00107 #define VISUAL_CAMERA_LOOKTO 2 00108 #define VISUAL_NEW_OBJECT 3 00109 #define VISUAL_NEW_ATOM 4 00110 #define VISUAL_MY_OBJECT 5 00111 #define VISUAL_TURN_AVATAR_OFF 6 00112 00113 //Object DataBase Packets 00114 #define ODB_ADD_OBJECT 1 00115 #define ODB_ADD_ATOM 2 00116 #define ODB_INSERT_ATOM 3 00117 00118 #define ODB_GET_ALL_CHANGED 4 00119 //#define ODB_GET_ALL_ATOMS 5 00120 #define ODB_GET_OBJECT 6 00121 #define ODB_GET_ATOM 7 00122 00123 #define ODB_CHANGE_ATOM 8 00124 00125 #define ODB_ADD_REASON 9 00126 #define ODB_REMOVE_REASON 10 00127 00128 00129 /* 00130 #define ODB_CHANGE_OBJECT 00131 #define ODB_REMOVE_OBJECT 00132 #define ODB_REMOVE_ATOM 00133 */ 00134 00135 00136 00137 #define ODB_TYPE_LONG 1 00138 #define ODB_TYPE_STRING 2 00139 #define ODB_TYPE_3DPOINT 3 00140 #define ODB_TYPE_BINARY 4 00141 00142 //AtomType 00143 00144 #define AT_USERNAME 1 00145 #define AT_SOCKET 2 00146 #define AT_NETADDRESS 3 00147 #define AT_POSITION 4 00148 #define AT_ENTITYTYPE 5 00149 #define AT_3DSIAGRAPH 6 00150 //... 00151 #define AT_SURNAME 20 00152 #define AT_FIRSTNAME 21 00153 #define AT_REALADDRESS 22 00154 #define AT_CHATMSG 23 00155 00156 #define RT_E_PARENT_O 1 00157 #define RT_E_HOLDING_O 2 00158 #define RT_O_PARTOF_E 3 00159 #define RT_O_PARENT_O 4 00160 #define RT_O_ATTACHED_O 5 00161 00162 //CLT CLass Types (for ODB) 00163 #define CLT_OBJECT 1 00164 #define CLT_ENTITY 2 00165 00166 00167 /* OBSOLETE!!!!!!!!!!!! 00168 //CoreCommunicationPacket (anyone has a better name for that?) 00169 #define CCP_ACCESS_MATRIX 1 00170 #define CCP_MCP_ACCESS_REPLY 3 00171 #define CCP_GET_EVERYTHING 6 00172 #define CCP_ADD_OBJECT 7 00173 #define CCP_ADD_OBJECT_REPLY 8 00174 #define CCP_GET_OBJECT 9 00175 #define CCP_GET_CONTENT 10 00176 #define CCP_SEND_MSG 11 00177 #define CCP_INITAL_CALL 12 00178 #define CCP_FINAL_CALL 13 00179 #define CCP_REGISTER_ENTITY 14 00180 00181 #define CCP_ADD_REG_ATOM 15 00182 #define CCP_ACCESS_REPLY 16 00183 00184 #define CCP_WANT_REPLY 123 00185 00186 // and so forth... :) 00187 */ 00188 00189 //MatrixControlPacket 00190 #define MCP_ACCESS_MATRIX 1 00191 00192 00193 // packet->header[0] = PROT_HANDSHAKE 00194 // packet->header[1] = 00195 00196 #define HANDSHAKE_GREETING 1 00197 00198 00199 // packet->header[0] = PROT_AUTHENTICATE 00200 // packet->header[1] = 00201 00202 #define AUTH_PASSWORD 1 00203 00204 00205 // packet->header[0] = PROT_REQUEST_MATRIX 00206 // packet->header[1] = 00207 00208 #define R_MATRIX_ADDRESS 1 00209 #define R_MATRIX_INVENTORY 2 00210 #define R_MATRIX_ACTION 3 00211 00212 // packet->header[0] = PROT_REQUEST_MATRIX 00213 // packet->header[1] = R_MATRIX_INVENTORY 00214 // packet->header[2] = 00215 00216 #define R_M_INVENTORY_SYNC 1 00217 00218 // packet->header[0] = PROT_REQUEST_MATRIX 00219 // packet->header[1] = R_MATRIX_ACTION 00220 // packet->header[2] = 00221 00222 #define R_M_ACTION_MOVE 1 00223 #define R_M_ACTION_COPY 2 00224 #define R_M_ACTION_DELETE 3 00225 00226 #endif