|
MASA-Core
|
Definition at line 55 of file MasaNet.hpp.
#include <MasaNet.hpp>
Public Member Functions | |
| MasaNet (int nodeType, string description) | |
| virtual | ~MasaNet () |
| void | startServer (int port) |
| Peer * | connectToPeer (string address, int connection_type) |
| void | createRing () |
| bool | onConnect (Peer *peer) |
| bool | onConnectData (Peer *peer) |
| void | onDisconnect (Peer *peer) |
| void | announce (vector< Peer * > announcedPeers, Peer *excludeSocket) |
| void | disanounce (Peer *peer, Peer *excludeSocket) |
| MasaNetStatus * | getPeerStatus () |
| const set< string > & | testRing (string peer) |
| const PeerList & | getConnectedPeers () const |
| const PeerList & | getDiscoveredPeers () const |
| Peer * | getLeftPeer () const |
| Peer * | getRightPeer () const |
| const vector< Peer * > & | getRemotePeers (string peer, int type) |
Private Member Functions | |
| void | broadcastCommand (Command *command, Peer *excludeSocket=NULL) |
| void | cmd_discover (Command *_cmd, Peer *socket) |
| void | cmd_undiscover (Command *_cmd, Peer *socket) |
| void | cmd_status_request (Command *_cmd, Peer *socket) |
| void | cmd_peer_request (Command *_cmd, Peer *socket) |
| void | cmd_create_ring (Command *_cmd, Peer *socket) |
| void | cmd_test_ring (Command *_cmd, Peer *socket) |
| Peer * | getPeer (const string &peer) |
| Peer * | solveSimultaneousConnection (Peer *newPeer, Peer *oldPeer) |
Static Private Member Functions | |
| static void | registerCommand (cmd_creator_f creator, cmd_handler_f handler) |
| static void * | staticListeningThread (void *arg) |
| static void * | staticPeerHandler (void *arg) |
| static int | hostname_to_ip (const char *hostname, char *ip) |
Private Attributes | |
| int | nodeType |
| string | nodeDescription |
| int | serverSocket |
| pthread_t | listeningThread |
| bool | serverActive |
| pthread_mutex_t | mutex |
| MasaNetStatus | status |
| string | myId |
| int | serverPort |
| PeerList | peers |
| PeerList | discoveredPeers |
| string | leftPeerId |
| Peer * | leftPeerData |
| Peer * | leftPeer |
| string | rightPeerId |
| Peer * | rightPeerData |
| Peer * | rightPeer |
Static Private Attributes | |
| static map< int, cmd_handler_f > | cmdHandlers |
| MasaNet::MasaNet | ( | int | nodeType, |
| string | description | ||
| ) |
Definition at line 54 of file MasaNet.cpp.
| MasaNet::~MasaNet | ( | ) | [virtual] |
Definition at line 88 of file MasaNet.cpp.
| void MasaNet::announce | ( | vector< Peer * > | announcedPeers, |
| Peer * | excludeSocket | ||
| ) |
Definition at line 501 of file MasaNet.cpp.
| void MasaNet::broadcastCommand | ( | Command * | command, |
| Peer * | excludeSocket = NULL |
||
| ) | [private] |
Definition at line 326 of file MasaNet.cpp.
| void MasaNet::cmd_create_ring | ( | Command * | _cmd, |
| Peer * | socket | ||
| ) | [private] |
Definition at line 663 of file MasaNet.cpp.
| void MasaNet::cmd_discover | ( | Command * | _cmd, |
| Peer * | socket | ||
| ) | [private] |
Definition at line 575 of file MasaNet.cpp.
| void MasaNet::cmd_peer_request | ( | Command * | _cmd, |
| Peer * | socket | ||
| ) | [private] |
Definition at line 639 of file MasaNet.cpp.
| void MasaNet::cmd_status_request | ( | Command * | _cmd, |
| Peer * | socket | ||
| ) | [private] |
Definition at line 632 of file MasaNet.cpp.
| void MasaNet::cmd_test_ring | ( | Command * | _cmd, |
| Peer * | socket | ||
| ) | [private] |
Definition at line 706 of file MasaNet.cpp.
| void MasaNet::cmd_undiscover | ( | Command * | _cmd, |
| Peer * | socket | ||
| ) | [private] |
Definition at line 612 of file MasaNet.cpp.
| Peer * MasaNet::connectToPeer | ( | string | address, |
| int | connection_type | ||
| ) |
Definition at line 153 of file MasaNet.cpp.
| void MasaNet::createRing | ( | ) |
Definition at line 555 of file MasaNet.cpp.
| void MasaNet::disanounce | ( | Peer * | peer, |
| Peer * | excludeSocket | ||
| ) |
Definition at line 510 of file MasaNet.cpp.
| const PeerList & MasaNet::getConnectedPeers | ( | ) | const |
Definition at line 488 of file MasaNet.cpp.
| const PeerList & MasaNet::getDiscoveredPeers | ( | ) | const |
Definition at line 492 of file MasaNet.cpp.
| Peer * MasaNet::getLeftPeer | ( | ) | const |
Definition at line 655 of file MasaNet.cpp.
| Peer * MasaNet::getPeer | ( | const string & | peer | ) | [private] |
Definition at line 536 of file MasaNet.cpp.
Definition at line 522 of file MasaNet.cpp.
| const vector< Peer * > & MasaNet::getRemotePeers | ( | string | peer, |
| int | type | ||
| ) |
Definition at line 546 of file MasaNet.cpp.
| Peer * MasaNet::getRightPeer | ( | ) | const |
Definition at line 659 of file MasaNet.cpp.
| int MasaNet::hostname_to_ip | ( | const char * | hostname, |
| char * | ip | ||
| ) | [static, private] |
Definition at line 339 of file MasaNet.cpp.
| bool MasaNet::onConnect | ( | Peer * | peer | ) | [virtual] |
Implements MasaNetCallbacks.
Definition at line 377 of file MasaNet.cpp.
| bool MasaNet::onConnectData | ( | Peer * | peer | ) | [virtual] |
Implements MasaNetCallbacks.
Definition at line 431 of file MasaNet.cpp.
| void MasaNet::onDisconnect | ( | Peer * | peer | ) | [virtual] |
Implements MasaNetCallbacks.
Definition at line 468 of file MasaNet.cpp.
| void MasaNet::registerCommand | ( | cmd_creator_f | creator, |
| cmd_handler_f | handler | ||
| ) | [static, private] |
Definition at line 92 of file MasaNet.cpp.
| Peer * MasaNet::solveSimultaneousConnection | ( | Peer * | newPeer, |
| Peer * | oldPeer | ||
| ) | [private] |
Definition at line 367 of file MasaNet.cpp.
| void MasaNet::startServer | ( | int | port | ) |
Definition at line 103 of file MasaNet.cpp.
| void * MasaNet::staticListeningThread | ( | void * | arg | ) | [static, private] |
Definition at line 222 of file MasaNet.cpp.
| void * MasaNet::staticPeerHandler | ( | void * | arg | ) | [static, private] |
Definition at line 264 of file MasaNet.cpp.
| const set< string > & MasaNet::testRing | ( | string | peer | ) |
Definition at line 561 of file MasaNet.cpp.
map< int, cmd_handler_f > MasaNet::cmdHandlers [static, private] |
Definition at line 105 of file MasaNet.hpp.
PeerList MasaNet::discoveredPeers [private] |
Definition at line 95 of file MasaNet.hpp.
Peer* MasaNet::leftPeer [private] |
Definition at line 99 of file MasaNet.hpp.
Peer* MasaNet::leftPeerData [private] |
Definition at line 98 of file MasaNet.hpp.
string MasaNet::leftPeerId [private] |
Definition at line 97 of file MasaNet.hpp.
pthread_t MasaNet::listeningThread [private] |
Definition at line 85 of file MasaNet.hpp.
pthread_mutex_t MasaNet::mutex [private] |
Definition at line 87 of file MasaNet.hpp.
string MasaNet::myId [private] |
Definition at line 91 of file MasaNet.hpp.
string MasaNet::nodeDescription [private] |
Definition at line 82 of file MasaNet.hpp.
int MasaNet::nodeType [private] |
Definition at line 81 of file MasaNet.hpp.
PeerList MasaNet::peers [private] |
Definition at line 94 of file MasaNet.hpp.
Peer* MasaNet::rightPeer [private] |
Definition at line 102 of file MasaNet.hpp.
Peer* MasaNet::rightPeerData [private] |
Definition at line 101 of file MasaNet.hpp.
string MasaNet::rightPeerId [private] |
Definition at line 100 of file MasaNet.hpp.
bool MasaNet::serverActive [private] |
Definition at line 86 of file MasaNet.hpp.
int MasaNet::serverPort [private] |
Definition at line 92 of file MasaNet.hpp.
int MasaNet::serverSocket [private] |
Definition at line 84 of file MasaNet.hpp.
MasaNetStatus MasaNet::status [private] |
Definition at line 89 of file MasaNet.hpp.
1.7.6.1