Changeset 285
- Timestamp:
- Nov 27, 2007, 11:30:17 PM (17 years ago)
- Location:
- code/branches/merger/src
- Files:
-
- 1 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/merger/src/CMakeLists.txt
r280 r285 12 12 ADD_SUBDIRECTORY(orxonox) 13 13 ADD_SUBDIRECTORY(loader) 14 ADD_SUBDIRECTORY(network) -
code/branches/merger/src/network/Client.cc
r278 r285 2 2 // C++ Implementation: Client 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // … … 11 11 // 12 12 13 #include " network/Client.h"13 #include "Client.h" 14 14 15 15 namespace network{ 16 16 17 17 /** 18 18 * Constructor for the Client class … … 25 25 isConnected=false; 26 26 } 27 27 28 28 /** 29 29 * Constructor for the Client class … … 36 36 isConnected=false; 37 37 } 38 38 39 39 /** 40 40 * Constructor for the Client class … … 47 47 isConnected=false; 48 48 } 49 49 50 50 /** 51 51 * Establish the Connection to the Server … … 56 56 return isConnected; 57 57 } 58 58 59 59 /** 60 60 * closes the Connection to the Server … … 65 65 return client_connection.closeConnection(); 66 66 } 67 67 68 68 /** 69 69 * submits a MouseAction to the server … … 84 84 return false; 85 85 } 86 86 87 87 /** 88 88 * submits a Keystrike to the server … … 102 102 return false; 103 103 } 104 104 105 105 /** 106 106 * Adds a MouseAction to the PacketQueue … … 116 116 return false; 117 117 } 118 118 119 119 /** 120 120 * Adds a Keystrike to the PacketQueue … … 130 130 return false; 131 131 } 132 132 133 133 /** 134 134 * Performs a GameState update … … 136 136 void Client::update(){ 137 137 // to be implemented ================== 138 139 138 139 140 140 } 141 141 142 142 } -
code/branches/merger/src/network/Client.h
r278 r285 2 2 // C++ Interface: Client 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // … … 16 16 #include <string> 17 17 18 #include " network/ClientConnection.h"19 #include " network/PacketManager.h"18 #include "ClientConnection.h" 19 #include "PacketManager.h" 20 20 21 21 … … 26 26 * This class implements all necessary function for the network communication 27 27 * It is the root class of the network module 28 * 28 * 29 29 */ 30 30 class Client : PacketDecoder{ … … 33 33 Client(std::string address, int port); 34 34 Client(const char *address, int port); 35 35 36 36 bool establishConnection(); 37 37 bool closeConnection(); 38 38 39 39 bool sendMouse(double x, double y); 40 40 bool sendKeyboard(char key_code); 41 41 42 42 bool addMouse(double x, double y); 43 43 bool addKeyboard(char key_code); 44 44 45 45 void update(); 46 46 47 47 private: 48 48 ClientConnection client_connection; 49 49 PacketGenerator pck_gen; 50 50 51 51 //const char *server_address; 52 52 //int port; -
code/branches/merger/src/network/ClientConnection.cc
r278 r285 2 2 // C++ Interface: ClientConnection 3 3 // 4 // Description: The Class ClientConnection manages the servers conenctions to the clients. 5 // each connection is provided by a new process. communication between master process and 4 // Description: The Class ClientConnection manages the servers conenctions to the clients. 5 // each connection is provided by a new process. communication between master process and 6 6 // connection processes is provided by ... 7 7 // … … 10 10 // 11 11 12 #include " network/ClientConnection.h"12 #include "ClientConnection.h" 13 13 14 14 namespace network{ 15 15 16 16 boost::thread_group network_threads; 17 17 18 18 ClientConnection::ClientConnection(int port, std::string address){ 19 19 quit=false; … … 23 23 established=false; 24 24 } 25 25 26 26 ClientConnection::ClientConnection(int port, const char *address){ 27 27 quit=false; … … 31 31 established=false; 32 32 } 33 33 34 34 bool ClientConnection::waitEstablished(int milisec){ 35 35 for(int i=0; i<=milisec && !established; i++) … … 37 37 return established; 38 38 } 39 40 39 40 41 41 ENetPacket *ClientConnection::getPacket(ENetAddress &address){ 42 42 if(!buffer.isEmpty()) … … 45 45 return NULL; 46 46 } 47 47 48 48 bool ClientConnection::queueEmpty(){ 49 49 return buffer.isEmpty(); 50 50 } 51 51 52 52 bool ClientConnection::createConnection(){ 53 53 network_threads.create_thread(boost::bind(boost::mem_fn(&ClientConnection::receiverThread), this)); … … 55 55 return waitEstablished(10000); 56 56 } 57 57 58 58 bool ClientConnection::closeConnection(){ 59 59 quit=true; … … 62 62 return true; 63 63 } 64 65 64 65 66 66 bool ClientConnection::addPacket(ENetPacket *packet){ 67 67 if(server==NULL) … … 72 72 return true; 73 73 } 74 74 75 75 bool ClientConnection::sendPackets(ENetEvent *event){ 76 76 if(server==NULL) … … 78 78 if(enet_host_service(client, event, NETWORK_SEND_WAIT)>=0) 79 79 return true; 80 else 80 else 81 81 return false; 82 82 } 83 83 84 84 bool ClientConnection::sendPackets(){ 85 85 ENetEvent event; … … 88 88 if(enet_host_service(client, &event, NETWORK_SEND_WAIT)>=0) 89 89 return true; 90 else 90 else 91 91 return false; 92 92 } 93 93 94 94 void ClientConnection::receiverThread(){ 95 95 // what about some error-handling here ? … … 123 123 } 124 124 // now disconnect 125 126 if(!disconnectConnection()) 125 126 if(!disconnectConnection()) 127 127 // if disconnecting failed destroy conn. 128 128 enet_peer_reset(server); 129 129 return; 130 130 } 131 131 132 132 bool ClientConnection::disconnectConnection(){ 133 133 ENetEvent event; … … 145 145 enet_peer_reset(server); 146 146 } 147 147 148 148 bool ClientConnection::establishConnection(){ 149 149 ENetEvent event; … … 161 161 return false; 162 162 } 163 163 164 164 bool ClientConnection::processData(ENetEvent *event){ 165 165 // just add packet to the buffer … … 167 167 return buffer.push(event); 168 168 } 169 170 169 170 171 171 } -
code/branches/merger/src/network/ClientConnection.h
r278 r285 2 2 // C++ Interface: ClientConnection 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // … … 21 21 #include <boost/bind.hpp> 22 22 // headerfile 23 #include " network/ClientConnection.h"24 #include " network/PacketBuffer.h"23 #include "ClientConnection.h" 24 #include "PacketBuffer.h" 25 25 26 26 namespace network{ … … 31 31 #define NETWORK_SEND_WAIT 5 32 32 #define NETWORK_CLIENT_CHANNELS 2 33 34 33 34 35 35 class ClientConnection{ 36 36 public: … … 67 67 ENetPeer *server; 68 68 }; 69 70 71 72 73 74 75 76 69 70 71 72 73 74 75 76 77 77 } 78 78 -
code/branches/merger/src/network/ConnectionManager.cc
r278 r285 2 2 // C++ Interface: ConnectionManager 3 3 // 4 // Description: The Class ConnectionManager manages the servers conenctions to the clients. 5 // each connection is provided by a new process. communication between master process and 4 // Description: The Class ConnectionManager manages the servers conenctions to the clients. 5 // each connection is provided by a new process. communication between master process and 6 6 // connection processes is provided by ... 7 7 // … … 10 10 // 11 11 12 #include " network/ConnectionManager.h"12 #include "ConnectionManager.h" 13 13 14 14 namespace network{ 15 15 16 16 boost::thread_group network_threads; 17 17 18 18 void test(){ 19 19 return; 20 20 } 21 21 22 22 ConnectionManager::ConnectionManager(){ 23 23 quit=false; … … 26 26 bindAddress.port = NETWORK_PORT; 27 27 } 28 28 29 29 ConnectionManager::ConnectionManager(int port, std::string address){ 30 30 quit=false; … … 33 33 bindAddress.port = NETWORK_PORT; 34 34 } 35 35 36 36 ConnectionManager::ConnectionManager(int port, const char *address){ 37 37 quit=false; … … 40 40 bindAddress.port = NETWORK_PORT; 41 41 } 42 42 43 43 ENetPacket *ConnectionManager::getPacket(ENetAddress &address){ 44 44 if(!buffer.isEmpty()) … … 47 47 return NULL; 48 48 } 49 49 50 50 bool ConnectionManager::queueEmpty(){ 51 51 return buffer.isEmpty(); 52 52 } 53 53 54 54 void ConnectionManager::createListener(){ 55 55 network_threads.create_thread(boost::bind(boost::mem_fn(&ConnectionManager::receiverThread), this)); … … 57 57 return; 58 58 } 59 59 60 60 bool ConnectionManager::quitListener(){ 61 61 quit=true; … … 63 63 return true; 64 64 } 65 65 66 66 bool ConnectionManager::addPacket(ENetPacket *packet, ENetPeer *peer){ 67 67 if(client=NULL) … … 77 77 return true; 78 78 } 79 79 80 80 bool ConnectionManager::addPacket(ENetPacket *packet, int ID){ 81 81 if(client==NULL) … … 92 92 return true; 93 93 } 94 94 95 95 bool ConnectionManager::addPacketAll(ENetPacket *packet){ 96 96 ClientList *temp=client; … … 101 101 return true; 102 102 } 103 103 104 104 bool ConnectionManager::sendPackets(ENetEvent *event){ 105 105 if(server==NULL) … … 107 107 if(enet_host_service(server, event, NETWORK_SEND_WAIT)>=0) 108 108 return true; 109 else 110 return false; 111 } 112 109 else 110 return false; 111 } 112 113 113 void ConnectionManager::receiverThread(){ 114 114 // what about some error-handling here ? … … 120 120 // add some error handling here ========================== 121 121 quit=true; 122 122 123 123 while(!quit){ 124 124 if(enet_host_service(server, &event, NETWORK_WAIT_TIMEOUT)<0){ … … 144 144 enet_host_destroy(server); 145 145 } 146 146 147 147 bool ConnectionManager::processData(ENetEvent *event){ 148 148 // just add packet to the buffer … … 150 150 return buffer.push(event); 151 151 } 152 152 153 153 bool ConnectionManager::clientDisconnect(ENetPeer *peer){ 154 154 ClientList *temp=client; … … 177 177 return false; 178 178 } 179 179 180 180 bool ConnectionManager::addClient(ENetEvent *event){ 181 181 182 182 // first client? 183 183 if(client==NULL){ … … 202 202 return true; 203 203 } 204 205 204 205 206 206 } -
code/branches/merger/src/network/ConnectionManager.h
r278 r285 2 2 // C++ Interface: ConnectionManager 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // … … 21 21 #include <boost/bind.hpp> 22 22 // headerfile 23 #include " network/ConnectionManager.h"24 #include " network/PacketBuffer.h"23 #include "ConnectionManager.h" 24 #include "PacketBuffer.h" 25 25 26 26 namespace network{ … … 35 35 // #define ENetAddress std::ENetAddress 36 36 // #define ENetPeer std::ENetPeer 37 37 38 38 struct ClientList{ 39 39 ENetEvent *event; … … 41 41 ClientList *next; 42 42 }; 43 43 44 44 class ConnectionManager{ 45 45 public: … … 79 79 // boost::thread_group threads; 80 80 }; 81 82 83 84 85 86 87 88 81 82 83 84 85 86 87 88 89 89 } 90 90 -
code/branches/merger/src/network/Makefile
r278 r285 1 CC=g++ 2 MAIN_INC=.. 3 INC=-I ${MAIN_INC} 4 5 all: server client 6 7 # Link command: 8 server: PacketBuffer.o ConnectionManager.o dummyserver.o PacketDecoder.o PacketGenerator.o 9 ${CC} PacketDecoder.o PacketGenerator.o ConnectionManager.o dummyserver.o PacketBuffer.o -o server -lenet -lboost_thread -g 10 11 dummyserver.o: dummyserver.cc 12 ${CC} -c dummyserver.cc -o dummyserver.o -g ${INC} 13 # Compilation commands: 14 ConnectionManager.o: ConnectionManager.cc ConnectionManager.h 15 ${CC} -c ConnectionManager.cc -o ConnectionManager.o -g ${INC} 16 ClientConnection.o: ClientConnection.cc ClientConnection.h 17 ${CC} -c ClientConnection.cc -o ClientConnection.o -g ${INC} 18 19 PacketBuffer.o: PacketBuffer.cc 20 ${CC} -c PacketBuffer.cc -o PacketBuffer.o -g ${INC} 21 PacketGenerator.o: PacketGenerator.cc 22 ${CC} -c PacketGenerator.cc -o PacketGenerator.o -g ${INC} 23 PacketDecoder.o: PacketDecoder.cc 24 ${CC} -c PacketDecoder.cc -o PacketDecoder.o -g ${INC} 25 Client.o: Client.cc 26 ${CC} -c Client.cc -g ${INC} 27 Server.o: Server.cc 28 ${CC} -c Server.cc -g ${INC} 29 Synchronisable.o: Synchronisable.cc 30 ${CC} -c Synchronisable.cc -g ${INC} 31 GameStateManager.o: GameStateManager.cc 32 ${CC} -c GameStateManager.cc -g ${INC} 33 1 # CMAKE generated file: DO NOT EDIT! 2 # Generated by "Unix Makefiles" Generator, CMake Version 2.4 3 4 # Default target executed when no arguments are given to make. 5 default_target: all 6 7 #============================================================================= 8 # Special targets provided by cmake. 9 10 # Disable implicit rules so canoncical targets will work. 11 .SUFFIXES: 12 13 .SUFFIXES: .hpux_make_needs_suffix_list 14 15 # Produce verbose output by default. 16 VERBOSE = 1 17 18 # Suppress display of executed commands. 19 $(VERBOSE).SILENT: 20 21 # A target that is always out of date. 22 cmake_force: 23 24 #============================================================================= 25 # Set environment variables for the build. 26 27 # The shell in which to execute make rules. 28 SHELL = /bin/sh 29 30 # The CMake executable. 31 CMAKE_COMMAND = /usr/bin/cmake 32 33 # The command to remove a file. 34 RM = /usr/bin/cmake -E remove -f 35 36 # The program to use to edit the cache. 37 CMAKE_EDIT_COMMAND = /usr/bin/ccmake 38 39 # The top-level source directory on which CMake was run. 40 CMAKE_SOURCE_DIR = /home/nicolasc/development/orxonoxV2/branches/merger 41 42 # The top-level build directory on which CMake was run. 43 CMAKE_BINARY_DIR = /home/nicolasc/development/orxonoxV2/branches/merger 44 45 # Include the progress variables for this target. 46 include CMakeFiles/progress.make 47 48 #============================================================================= 49 # Targets provided globally by CMake. 50 51 # Special rule for the target edit_cache 52 edit_cache: 53 @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." 54 cd /home/nicolasc/development/orxonoxV2/branches/merger/src/network && /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 55 56 # Special rule for the target edit_cache 57 edit_cache/fast: edit_cache 58 59 # Special rule for the target rebuild_cache 60 rebuild_cache: 61 @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." 62 cd /home/nicolasc/development/orxonoxV2/branches/merger/src/network && /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) 63 64 # Special rule for the target rebuild_cache 65 rebuild_cache/fast: rebuild_cache 66 67 # The main all target 68 all: cmake_check_build_system 69 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(CMAKE_COMMAND) -E cmake_progress_start /home/nicolasc/development/orxonoxV2/branches/merger/CMakeFiles $(CMAKE_ALL_PROGRESS) 70 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f CMakeFiles/Makefile2 src/network/all 71 $(CMAKE_COMMAND) -E cmake_progress_start /home/nicolasc/development/orxonoxV2/branches/merger/CMakeFiles 0 72 73 # The main clean target 34 74 clean: 35 rm -rf *.o 36 37 client_old: PacketGenerator.o dummyclient.cc 38 ${CC} dummyclient.cc PacketGenerator.o -o client -lenet -g ${INC} 39 client: PacketGenerator.o ClientConnection.o PacketBuffer.o dummyclient2.cc 40 ${CC} dummyclient2.cc PacketGenerator.o PacketBuffer.o ClientConnection.o -o client -lenet -lboost_thread -g ${INC} 75 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f CMakeFiles/Makefile2 src/network/clean 76 77 # The main clean target 78 clean/fast: clean 79 80 # Prepare targets for installation. 81 preinstall: all 82 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f CMakeFiles/Makefile2 src/network/preinstall 83 84 # Prepare targets for installation. 85 preinstall/fast: 86 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f CMakeFiles/Makefile2 src/network/preinstall 87 88 # clear depends 89 depend: 90 $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 91 92 # Convenience name for target. 93 src/network/CMakeFiles/network.dir/rule: 94 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f CMakeFiles/Makefile2 src/network/CMakeFiles/network.dir/rule 95 96 # Convenience name for target. 97 network: src/network/CMakeFiles/network.dir/rule 98 99 # fast build rule for target. 100 network/fast: 101 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/build 102 103 # target to build an object file 104 Client.o: 105 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Client.o 106 107 # target to preprocess a source file 108 Client.i: 109 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Client.i 110 111 # target to generate assembly for a file 112 Client.s: 113 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Client.s 114 115 # target to build an object file 116 ClientConnection.o: 117 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/ClientConnection.o 118 119 # target to preprocess a source file 120 ClientConnection.i: 121 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/ClientConnection.i 122 123 # target to generate assembly for a file 124 ClientConnection.s: 125 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/ClientConnection.s 126 127 # target to build an object file 128 ConnectionManager.o: 129 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/ConnectionManager.o 130 131 # target to preprocess a source file 132 ConnectionManager.i: 133 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/ConnectionManager.i 134 135 # target to generate assembly for a file 136 ConnectionManager.s: 137 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/ConnectionManager.s 138 139 # target to build an object file 140 GameStateManager.o: 141 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/GameStateManager.o 142 143 # target to preprocess a source file 144 GameStateManager.i: 145 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/GameStateManager.i 146 147 # target to generate assembly for a file 148 GameStateManager.s: 149 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/GameStateManager.s 150 151 # target to build an object file 152 PacketBuffer.o: 153 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketBuffer.o 154 155 # target to preprocess a source file 156 PacketBuffer.i: 157 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketBuffer.i 158 159 # target to generate assembly for a file 160 PacketBuffer.s: 161 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketBuffer.s 162 163 # target to build an object file 164 PacketDecoder.o: 165 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketDecoder.o 166 167 # target to preprocess a source file 168 PacketDecoder.i: 169 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketDecoder.i 170 171 # target to generate assembly for a file 172 PacketDecoder.s: 173 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketDecoder.s 174 175 # target to build an object file 176 PacketGenerator.o: 177 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketGenerator.o 178 179 # target to preprocess a source file 180 PacketGenerator.i: 181 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketGenerator.i 182 183 # target to generate assembly for a file 184 PacketGenerator.s: 185 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/PacketGenerator.s 186 187 # target to build an object file 188 Server.o: 189 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Server.o 190 191 # target to preprocess a source file 192 Server.i: 193 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Server.i 194 195 # target to generate assembly for a file 196 Server.s: 197 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Server.s 198 199 # target to build an object file 200 Synchronisable.o: 201 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Synchronisable.o 202 203 # target to preprocess a source file 204 Synchronisable.i: 205 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Synchronisable.i 206 207 # target to generate assembly for a file 208 Synchronisable.s: 209 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/Synchronisable.s 210 211 # target to build an object file 212 dummyclient.o: 213 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyclient.o 214 215 # target to preprocess a source file 216 dummyclient.i: 217 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyclient.i 218 219 # target to generate assembly for a file 220 dummyclient.s: 221 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyclient.s 222 223 # target to build an object file 224 dummyclient2.o: 225 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyclient2.o 226 227 # target to preprocess a source file 228 dummyclient2.i: 229 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyclient2.i 230 231 # target to generate assembly for a file 232 dummyclient2.s: 233 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyclient2.s 234 235 # target to build an object file 236 dummyserver.o: 237 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyserver.o 238 239 # target to preprocess a source file 240 dummyserver.i: 241 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyserver.i 242 243 # target to generate assembly for a file 244 dummyserver.s: 245 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(MAKE) -f src/network/CMakeFiles/network.dir/build.make src/network/CMakeFiles/network.dir/dummyserver.s 246 247 # Help Target 248 help:: 249 @echo "The following are some of the valid targets for this Makefile:" 250 @echo "... all (the default if no target is provided)" 251 @echo "... clean" 252 @echo "... depend" 253 @echo "... edit_cache" 254 @echo "... network" 255 @echo "... rebuild_cache" 256 @echo "... Client.o" 257 @echo "... Client.i" 258 @echo "... Client.s" 259 @echo "... ClientConnection.o" 260 @echo "... ClientConnection.i" 261 @echo "... ClientConnection.s" 262 @echo "... ConnectionManager.o" 263 @echo "... ConnectionManager.i" 264 @echo "... ConnectionManager.s" 265 @echo "... GameStateManager.o" 266 @echo "... GameStateManager.i" 267 @echo "... GameStateManager.s" 268 @echo "... PacketBuffer.o" 269 @echo "... PacketBuffer.i" 270 @echo "... PacketBuffer.s" 271 @echo "... PacketDecoder.o" 272 @echo "... PacketDecoder.i" 273 @echo "... PacketDecoder.s" 274 @echo "... PacketGenerator.o" 275 @echo "... PacketGenerator.i" 276 @echo "... PacketGenerator.s" 277 @echo "... Server.o" 278 @echo "... Server.i" 279 @echo "... Server.s" 280 @echo "... Synchronisable.o" 281 @echo "... Synchronisable.i" 282 @echo "... Synchronisable.s" 283 @echo "... dummyclient.o" 284 @echo "... dummyclient.i" 285 @echo "... dummyclient.s" 286 @echo "... dummyclient2.o" 287 @echo "... dummyclient2.i" 288 @echo "... dummyclient2.s" 289 @echo "... dummyserver.o" 290 @echo "... dummyserver.i" 291 @echo "... dummyserver.s" 292 293 294 295 #============================================================================= 296 # Special targets to cleanup operation of make. 297 298 # Special rule to run CMake to check the build system integrity. 299 # No rule that depends on this can have commands that come from listfiles 300 # because they might be regenerated. 301 cmake_check_build_system: 302 cd /home/nicolasc/development/orxonoxV2/branches/merger && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 303 -
code/branches/merger/src/network/PacketBuffer.cc
r278 r285 7 7 8 8 #include <iostream> 9 #include " network/PacketBuffer.h"9 #include "PacketBuffer.h" 10 10 11 11 namespace network{ 12 12 13 13 boost::mutex networkPacketBufferMutex; 14 14 15 15 PacketBuffer::PacketBuffer(){ 16 16 closed=false; … … 19 19 } 20 20 //this is needed in order to make the packetbuffer threadsafe 21 21 22 22 23 23 bool PacketBuffer::push(ENetEvent *ev){ … … 87 87 temp=temp->next; 88 88 } 89 89 90 90 } 91 91 -
code/branches/merger/src/network/PacketBufferTest.cc
r278 r285 1 #include " network/PacketBuffer.h"2 #include " network/PacketBuffer.cc"1 #include "PacketBuffer.h" 2 #include "PacketBuffer.cc" 3 3 #include <iostream> 4 4 #include <string> -
code/branches/merger/src/network/PacketBufferTestExt.cc
r278 r285 3 3 #include <enet/enet.h> 4 4 #include <boost/thread/thread.hpp> 5 #include " network/PacketBuffer.h"6 #include " network/PacketBuffer.cc"5 #include "PacketBuffer.h" 6 #include "PacketBuffer.cc" 7 7 8 8 using namespace network; … … 15 15 for(int i=0; i<10; i++){ 16 16 std::string temp = "packet "; 17 packet = enet_packet_create("packet", strlen("packet ")+1, 17 packet = enet_packet_create("packet", strlen("packet ")+1, 18 18 ENET_PACKET_FLAG_RELIABLE); 19 19 std::cout << i << ": pushing " << packet->data << std::endl; … … 43 43 boost::thread thrd1(boost::bind(&write, &test)); 44 44 boost::thread thrd2(boost::bind(&read, &test)); 45 45 46 46 thrd1.join(); 47 47 thrd2.join(); 48 48 49 49 return 0; 50 50 } -
code/branches/merger/src/network/Server.cc
r278 r285 2 2 // C++ Implementation: Server 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // … … 12 12 13 13 14 #include " network/Server.h"14 #include "Server.h" 15 15 16 16 namespace network{ 17 17 18 18 /** 19 19 * Constructor for default values (bindaddress is set to ENET_HOST_ANY 20 * 20 * 21 21 */ 22 22 Server::Server(){ 23 24 23 24 25 25 } 26 26 27 27 /** 28 28 * Constructor … … 31 31 */ 32 32 Server::Server(int port, std::string bindAddress) : connection(port, bindAddress){ 33 34 33 34 35 35 } 36 36 37 37 /** 38 38 * Constructor … … 41 41 */ 42 42 Server::Server(int port, const char *bindAddress) : connection(port, bindAddress){ 43 44 45 46 43 44 45 46 47 47 } 48 49 50 51 52 48 49 50 51 52 53 53 } -
code/branches/merger/src/network/Server.h
r278 r285 2 2 // C++ Interface: Server 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // … … 16 16 #include <string> 17 17 18 #include " network/ConnectionManager.h"19 #include " network/PacketManager.h"18 #include "ConnectionManager.h" 19 #include "PacketManager.h" 20 20 21 21 22 22 namespace network{ 23 23 24 24 /** 25 25 * This class is the root class of the network module for a server. … … 31 31 Server(int port, std::string bindAddress); 32 32 Server(int port, const char *bindAddress); 33 33 34 34 private: 35 35 ConnectionManager connection; 36 37 38 39 40 41 42 36 37 38 39 40 41 42 43 43 }; 44 45 46 47 48 44 45 46 47 48 49 49 } 50 50 -
code/branches/merger/src/network/Synchronisable.cc
r278 r285 2 2 // C++ Implementation: synchronisable 3 3 // 4 // Description: 4 // Description: 5 5 // 6 6 // … … 10 10 // 11 11 12 #include " network/Synchronisable.h"12 #include "Synchronisable.h" 13 13 14 14 namespace network { … … 27 27 Synchronisable::~Synchronisable() 28 28 { 29 29 30 30 } 31 31 … … 72 72 int n=0; 73 73 for(i=syncList.begin(); n<totalsize && i!=syncList.end(); i++){ 74 //CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID* 74 //CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID* 75 75 std::memcpy(retVal.data+n, (const void*)(i->size), sizeof(int)); 76 76 n+=sizeof(int); … … 102 102 int n=0; 103 103 for(i=syncList.begin(); n<datasize && i!=syncList.end(); i++){ 104 //CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID* 104 //CHANGED: i->size TO (const void*)(&(i->size)) memcpy WANTS A CONST VOID* SO CONVERT INT TO CONST VOID* 105 105 std::memcpy(retVal.data+n, (const void*)(i->size), sizeof(int)); 106 106 n+=sizeof(int); -
code/branches/merger/src/network/dummyclient.cc
r278 r285 7 7 #include <string> 8 8 #include <enet/enet.h> 9 #include " network/PacketManager.h"9 #include "PacketManager.h" 10 10 11 11 using namespace std; … … 20 20 enet_initialize(); 21 21 atexit(enet_deinitialize); 22 22 23 23 cout << "Enter address of the server xxx.xxx.xxx.xxx (enter for localhost)" << endl; 24 24 string str; … … 27 27 if(str.compare("")==0) 28 28 str="127.0.0.1"; 29 29 30 30 enet_address_set_host(&address, str.c_str()); 31 31 address.port = 55556; … … 87 87 enet_peer_reset(peer); 88 88 89 90 89 90 91 91 return 0; 92 92 } -
code/branches/merger/src/network/dummyclient2.cc
r278 r285 7 7 #include <string> 8 8 #include <enet/enet.h> 9 #include " network/PacketManager.h"10 #include " network/ClientConnection.h"9 #include "PacketManager.h" 10 #include "ClientConnection.h" 11 11 12 12 using namespace network; … … 25 25 26 26 client.createConnection(); 27 27 28 28 if(client.waitEstablished(10000)) 29 29 std::cout << "Connection established" << std::endl; 30 30 else 31 31 std::cout << "Connection failed" << std::endl; 32 32 33 33 ENetPacket *packet; 34 34 ENetEvent event; 35 36 37 35 36 37 38 38 for(int i=0; i<10; i++){ 39 39 // weihnachtsmann bringt packete -
code/branches/merger/src/network/dummyserver.cc
r278 r285 7 7 #include <iostream> 8 8 #include "enet/enet.h" 9 #include " network/ConnectionManager.h"10 #include " network/PacketManager.h"9 #include "ConnectionManager.h" 10 #include "PacketManager.h" 11 11 12 12 using namespace network; … … 18 18 ENetEvent event; 19 19 server.createListener(); 20 20 21 21 PacketDecoder dec; 22 22 23 23 while(!quit){ 24 24 if(server.queueEmpty()) -
code/branches/merger/src/orxonox/CMakeLists.txt
r280 r285 7 7 ADD_EXECUTABLE(../../bin/main ${SRC_FILES} ${INC_FILES}) 8 8 9 TARGET_LINK_LIBRARIES(../../bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${CEGUI_LIBRARIES} ${CEGUI_OGRE_LIBRARIES} core objects loader )9 TARGET_LINK_LIBRARIES(../../bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${CEGUI_LIBRARIES} ${CEGUI_OGRE_LIBRARIES} core objects loader network) 10 10 11 11
Note: See TracChangeset
for help on using the changeset viewer.