Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/test/src/lib/network/peer_info.cc @ 10651

Last change on this file since 10651 was 9656, checked in by bensch, 18 years ago

orxonox/trunk: merged the proxy bache back with no conflicts

File size: 1.6 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: Christoph Renner rennerc@ee.ethz.ch
13   co-programmer:   Patrick Boenzli  boenzlip@orxonox.ethz.ch
14
15     June 2006: finishing work on the network stream for pps presentation (rennerc@ee.ethz.ch)
16     July 2006: some code rearangement and integration of the proxy server mechanism (boenzlip@ee.ethz.ch)
17*/
18
19
20#define DEBUG_MODULE_NETWORK
21
22
23#include "peer_info.h"
24
25
26
27
28
29
30/**
31 * constructor
32 */
33PeerInfo::PeerInfo()
34{
35  this->clear();
36}
37
38
39/**
40 * clearint and initializing the peer info
41 */
42void PeerInfo::clear()
43{
44  this->userId = NET_ID_UNASSIGNED;
45  this->nodeType = NET_UNASSIGNED;
46  this->socket = NULL;
47  this->handshake = NULL;
48  this->lastAckedState = 0;
49  this->lastRecvedState = 0;
50  this->connectionMonitor = NULL;
51  this->bLocal = false;
52
53  this->ip = IP(0,0);
54}
55
56
57const std::string& PeerInfo::getNodeTypeString() const
58{
59  return PeerInfo::nodeTypeToString( this->nodeType );
60  // the above does the same, and is faster in it. (there is no case where node is uninit i hope!)
61}
62
63const std::string& PeerInfo::nodeTypeToString(unsigned int type)
64{
65  return PeerInfo::nodeNames[type];
66}
67
68
69const std::string PeerInfo::nodeNames[] =
70{
71  "master server",
72  "proxy server active",
73  "proxy server passive",
74  "client",
75  "node is not initialized"
76};
Note: See TracBrowser for help on using the repository browser.