00001 // 00002 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH) 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 // 00018 00024 #ifndef __SCPACKET_H_ 00025 #define __SCPACKET_H_ 00026 00027 #define SC_MOVE_INDICATION 0 00028 #define SC_ADD_NEIGHBOR 1 00029 #define SC_REMOVE_NEIGHBOR 2 00030 #define SC_RESIZE_AOI 3 00031 #define SC_PARAM_REQUEST 4 00032 #define SC_PARAM_RESPONSE 5 00033 #define SC_EV_CHAT 6 00034 #define SC_EV_SNOWBALL 7 00035 #define SC_EV_FROZEN 8 00036 00037 class SCBasePacket // SC_PARAM_REQUEST 00038 { 00039 public: 00040 unsigned char packetType; 00041 }; 00042 00043 class SCAddPacket : public SCBasePacket // SC_ADD_NEIGHBOR 00044 { 00045 public: 00046 double posX; 00047 double posY; 00048 unsigned int ip; 00049 }; 00050 00051 class SCRemovePacket : public SCBasePacket // SC_REMOVE_NEIGHBOR 00052 { 00053 public: 00054 unsigned int ip; 00055 }; 00056 00057 class SCMovePacket : public SCBasePacket // SC_MOVE_INDICATION 00058 { 00059 public: 00060 double posX; 00061 double posY; 00062 }; 00063 00064 class SCAOIPacket : public SCBasePacket // SC_RESIZE_AOI 00065 { 00066 public: 00067 double AOI; 00068 }; 00069 00070 class SCParamPacket : public SCBasePacket // SC_PARAM_RESPONSE 00071 { 00072 public: 00073 double speed; 00074 double dimension; 00075 double AOI; 00076 double delay; 00077 double startX; 00078 double startY; 00079 unsigned int ip; 00080 unsigned int seed; 00081 }; 00082 00083 00084 class SCChatPacket : public SCBasePacket // SC_EV_CHAT 00085 { 00086 public: 00087 unsigned int ip; 00088 char msg[]; 00089 }; 00090 00091 class SCSnowPacket : public SCBasePacket // SC_EV_SNOWBALL 00092 { 00093 public: 00094 unsigned int ip; 00095 double startX; 00096 double startY; 00097 double endX; 00098 double endY; 00099 int time_sec; 00100 int time_usec; 00101 }; 00102 00103 class SCFrozenPacket : public SCBasePacket // SC_EV_FROZEN 00104 { 00105 public: 00106 unsigned int ip; 00107 unsigned int source; 00108 int time_sec; 00109 int time_usec; 00110 }; 00111 00112 #endif