Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/libraries/network/MasterServerComm.h @ 7744

Last change on this file since 7744 was 7739, checked in by dafrick, 14 years ago

Merging masterserver branch to new presentation branch.

File size: 2.7 KB
RevLine 
[7611]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Sandro 'smerkli' Merkli
24 *   Co-authors:
25 *      ...
26 *
27 */
28
[7631]29#include <cstdlib>
30#include <cstdio>
[7650]31#include <string>
[7631]32#include <cstring>
33#include <enet/enet.h>
34
35namespace orxonox
[7611]36{
[7631]37  class MasterServerComm
38  {
39    public: 
40      /** constructor */
41      MasterServerComm();
[7611]42
[7631]43      /** destructor */
44      ~MasterServerComm();
[7611]45
[7631]46      /** \return 0 for success, other for error
47       *
48       * Initialize everything for the master server communication
49       */
50      int initialize();
[7611]51
52
[7631]53      /** \param address Address to connect to (Host name or IP in text form)
54       * \param port Port to connect on
55       * \return 0 for success, other for error
56       *
57       * Connect to the master server with the given address on the given port.
58       */
[7725]59      int connect( const char *address, unsigned int port );
[7611]60
[7631]61      /** \param data The data to be sent.
62       * \return 0 for success, other for error.
63       *
64       * Send a request to the master server containing data specified in data
65       */
[7725]66      int sendRequest( const char *data );
[7611]67
[7650]68      /** \param data The data to be sent.
69       * \return 0 for success, other for error.
70       *
71       * Send a request to the master server containing data specified in data
72       * (string version)
73       */
74      int sendRequest( std::string data );
75
[7631]76      /** \param callback The callback function to call with data receivced.
77       * \return 0 for success, other for error
78       *
79       * Poll the master server for new data and act accordingly */
80      int pollForReply( int (*callback)( char*, ENetEvent* ) );
[7611]81
[7631]82    private:
83      /** client handle */
84      ENetHost *client;
[7611]85
[7631]86      /** event data holder */
[7684]87      ENetEvent *event;
[7631]88
89      /** address holder */
90      ENetAddress address;
91
92      /** peer data holder */
93      ENetPeer *peer;
94  };
95
96}
Note: See TracBrowser for help on using the repository browser.