forest-net
an overlay networks for large-scale virtual worlds
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
NetMgr.h File Reference
#include <pthread.h>
#include "Forest.h"
#include "Packet.h"
#include "PacketStoreTs.h"
#include "NetInfo.h"
#include "ComtInfo.h"
#include "UiSetPair.h"
#include "IdMap.h"
#include "Queue.h"
#include "CpHandler.h"
#include "Substrate.h"
#include "NetBuffer.h"
#include "Logger.h"
#include <map>
#include "AdminTable.h"
Include dependency graph for NetMgr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  forest::prefixInfo
 
struct  forest::clientInfo
 

Namespaces

 forest
 The CtlPkt class is used to pack and unpack forest control messages.
 

Constant Groups

 forest
 The CtlPkt class is used to pack and unpack forest control messages.
 

Functions

bool forest::init (const char *topoFile)
 Initialization of NetMgr. More...
 
bool forest::readPrefixInfo (char *)
 
void * forest::handler (void *qp)
 Control packet handler. More...
 
bool forest::handleConsole (int sock, CpHandler &cph)
 Handle a connection from a remote console. More...
 
bool forest::handleConDisc (pktx px, CtlPkt &cp, CpHandler &cph)
 Handle a connection/disconnection notification from a router. More...
 
bool forest::handleNewSession (pktx px, CtlPkt &cp, CpHandler &cph)
 Handle a new session request. More...
 
bool forest::handleCancelSession (pktx px, CtlPkt &cp, CpHandler &cph)
 Handle a cancel session request. More...
 
bool forest::handleBootLeaf (pktx px, CtlPkt &cp, CpHandler &cph)
 Handle boot process for a pre-configured leaf node. More...
 
bool forest::handleBootRouter (pktx px, CtlPkt &cp, CpHandler &cph)
 Handle a boot request from a router. More...
 
bool forest::login (NetBuffer &buf, string &clientName, string &reply)
 Handle a login request. More...
 
bool forest::newAccount (NetBuffer &buf, string &clientName, string &reply)
 Handle a new account request. More...
 
void forest::getProfile (NetBuffer &buf, string &clientName, string &reply)
 Handle a get profile request. More...
 
void forest::updateProfile (NetBuffer &buf, string &clientName, string &reply)
 Handle an update profile request. More...
 
void forest::changePassword (NetBuffer &buf, string &clientName, string &reply)
 Handle a change password request. More...
 
void forest::writeAdminRecord (int adx)
 Write a record to the file of network administrators. More...
 
void forest::getLinkTable (NetBuffer &buf, string &reply, CpHandler &cph)
 Get link table from router and return to Console. More...
 
void forest::getComtreeTable (NetBuffer &buf, string &reply, CpHandler &cph)
 Get comtree table from router and return to Console. More...
 
void forest::getIfaceTable (NetBuffer &buf, string &reply, CpHandler &cph)
 Get iface table from router and return to Console. More...
 
void forest::getRouteTable (NetBuffer &buf, string &reply, CpHandler &cph)
 Get route table from router and return to Console. More...
 
void forest::addFilter (NetBuffer &buf, string &reply, CpHandler &cph)
 Allocate log filter in router and return filter index to Console. More...
 
void forest::modFilter (NetBuffer &buf, string &reply, CpHandler &cph)
 Modify log filter in router. More...
 
void forest::dropFilter (NetBuffer &buf, string &reply, CpHandler &cph)
 Drop log filter from router. More...
 
void forest::getFilter (NetBuffer &buf, string &reply, CpHandler &cph)
 Get log filter from router and return to Console. More...
 
void forest::getFilterSet (NetBuffer &buf, string &reply, CpHandler &cph)
 Get log filter set from router and return to Console. More...
 
void forest::getLoggedPackets (NetBuffer &buf, string &reply, CpHandler &cph)
 Get logged packets from router and return to Console. More...
 
void forest::enablePacketLog (NetBuffer &buf, string &reply, CpHandler &cph)
 
uint64_t forest::generateNonce ()
 Return a random nonce suitable for use when connecting a leaf. More...
 
fAdr_t forest::setupLeaf (int leaf, pktx px, CtlPkt &cp, int rtr, int iface, uint64_t nonce, CpHandler &cph, bool useTunnel)
 Setup a leaf by sending configuration packets to its access router. More...
 
bool forest::setupEndpoint (int lnk, int rtr, pktx px, CtlPkt &cp, CpHandler &cph, bool useTunnel)
 Configure a link endpoint at a router. More...
 
bool forest::setupComtree (int ctx, int rtr, pktx px, CtlPkt &cp, CpHandler &cph, bool useTunnel)
 Setup a pre-configured comtree at a booting router. More...
 
bool forest::processReply (pktx px, CtlPkt &cp, pktx reply, CtlPkt &repCp, CpHandler &cph, const string &msg)
 Process the reply from an outgoing request packet This method implements a common pattern used by handlers that are configuring routers in response to a received request. More...
 
void forest::sendToCons (int)
 
int forest::recvFromCons ()
 
bool forest::findCliRtr (ipa_t cliIp, fAdr_t &rtrAdr)
 Finds the router address of the router based on IP prefix. More...
 

Variables

fAdr_t forest::cliMgrAdr
 forest address of the client manager
 
fAdr_t forest::comtCtlAdr
 forest address of the comtree controller
 
int forest::netMgr
 node number of net manager in NetInfo
 
int forest::nmRtr
 node number of net manager's router
 
AdminTable * forest::admTbl
 data about administrators
 
int forest::numPrefixes
 
prefixInfo forest::prefixes [1000]
 
fstream forest::adminFile
 stream for reading/updating admin data
 
pthread_mutex_t forest::adminFileLock
 so only one thread can update at a time
 
static int const forest::RECORD_SIZE = 256
 size of an admin file record
 

Detailed Description

Author
Jon Turner
Date
2011 This is open source software licensed under the Apache 2.0 license. See http://www.apache.org/licenses/LICENSE-2.0 for details.

Definition in file NetMgr.h.