replicode
Classes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
mBrane::Networking Class Referenceabstract

#include <networking.h>

Inheritance diagram for mBrane::Networking:
Inheritance graph
Collaboration diagram for mBrane::Networking:
Collaboration graph

Classes

struct  AcceptConnectionArgs
 

Protected Types

typedef void(* BootCallback) ()
 

Protected Member Functions

bool startInterfaces ()
 
void stopInterfaces ()
 
void setNewReference ()
 
virtual void startReceivingThreads (uint8_t NID)=0
 
virtual void notifyNodeJoined (uint8_t NID, NetworkID *networkID)=0
 
virtual void notifyNodeLeft (uint8_t NID)=0
 
virtual void shutdown ()
 
bool checkSyncProbe (uint8_t syncNodeID)
 
void systemReady ()
 
bool addNodeName (const char *name, bool myself=false)
 
uint8_t getNodeID (const char *name)
 
bool allNodesJoined ()
 
bool allNodesReady ()
 
uint16_t sendID (CommChannel *c, NetworkID *networkID)
 
uint16_t recvID (CommChannel *c, NetworkID *&networkID, bool expectToken=true)
 
uint16_t sendMap (CommChannel *c)
 
uint16_t recvMap (CommChannel *c, NetworkID *fromNetworkID)
 
uint16_t connect (NetworkID *networkID)
 
uint16_t connect (Network network, NetworkID *networkID)
 
void _broadcastControlMessage (_Payload *p, Network network)
 
void broadcastControlMessage (_Payload *p, Network network)
 
void _sendControlMessage (_Payload *p, uint8_t destinationNID, Network network)
 
void sendControlMessage (_Payload *p, uint8_t destinationNID, Network network)
 
void sendData (uint8_t NID, _Payload *p, Network network)
 
void sendStreamData (uint8_t NID, _Payload *p, Network network)
 
void processError (uint8_t NID)
 
uint8_t addNodeEntry ()
 
bool init ()
 
virtual void start (uint8_t assignedNID, NetworkID *networkNID, bool isTimeReference)
 
bool startSync ()
 
 Networking ()
 
 ~Networking ()
 
bool loadInterface (XMLNode &interfaces, XMLNode &config, const char *name, InterfaceType type)
 
bool loadConfig (XMLNode &n)
 
- Protected Member Functions inherited from mBrane::sdk::mdaemon::Node
 Node (uint8_t ID=NoID)
 
bool loadConfig (XMLNode &n)
 
void start ()
 
 ~Node ()
 
- Protected Member Functions inherited from mBrane::sdk::module::Node
 Node (uint8_t ID)
 
 ~Node ()
 
- Protected Member Functions inherited from mBrane::Messaging
 Messaging ()
 
 ~Messaging ()
 
bool loadConfig (XMLNode &n)
 
void start ()
 
void shutdown ()
 
void send (_Payload *message, module::Node::Network network)
 
void send (_Payload *message, uint8_t nodeID, module::Node::Network network)
 
void pushJobs (_Payload *p, NodeEntry &e)
 
void pushJobs (_Payload *p)
 
void processControlMessage (_Payload *p)
 

Static Protected Member Functions

static void ScanIDs (Networking *node)
 
static void AcceptConnections (AcceptConnectionArgs *acargs)
 
static void Sync (Networking *node)
 
- Static Protected Member Functions inherited from mBrane::Messaging
static void SendMessages (Node *node)
 

Protected Attributes

Host::host_name hostName
 
uint8_t hostNameSize
 
SharedLibrarycallbackLibrary
 
BootCallback bootCallback
 
DynamicClassLoader< NetworkInterface > * networkInterfaceLoaders [7]
 
NetworkInterfacenetworkInterfaces [7]
 
Network network
 
std::mutex acceptConnectionMutex
 
int32_t bcastTimeout
 
uint8_t connectedNodeCount
 
NetworkIDnetworkID
 
CommChanneldiscoveryChannel
 
CommChannelbroadcastChannel [2]
 
std::mutex channelsMutex
 
UNORDERED_MAP< uint8_t, NodeCon * > nodes
 
bool isTimeReference
 
uint8_t referenceNID
 
Array< std::thread, 32 > commThreads
 
uint8_t nodeCount
 
int64_t timeDrift
 
int64_t syncPeriod
 
- Protected Attributes inherited from mBrane::sdk::mdaemon::Node
bool volatile _shutdown
 
StaticArray< DynamicClassLoader< Daemon > * > daemonLoaders
 
StaticArray< Daemon * > daemons
 
StaticArray< std::threaddaemonThreads
 
- Protected Attributes inherited from mBrane::sdk::module::Node
uint8_t _ID
 
- Protected Attributes inherited from mBrane::Messaging
Pipe11< P< _Payload >, MESSAGE_INPUT_BLOCK_SIZEmessageInputQueue
 
PipeN1< MessageSlot, MESSAGE_OUTPUT_BLOCK_SIZEmessageOutputQueue
 
PipeNN< Job, JOBS_BLOCK_SIZEjobs
 
Array< RecvThread *, MESSAGE_INPUT_BLOCK_SIZErecvThreads
 
std::thread sendThread
 
Array< PushThread *, MESSAGE_INPUT_BLOCK_SIZEpushThreads
 
std::vector< ConstantEntryconstants
 
UNORDERED_MAP< uint32_t, P< _Payload > > cache
 
std::vector< UNORDERED_SET< uint32_t > > lookup
 
std::mutex cacheMutex
 
uint8_t pendingAck
 
UNORDERED_SET< _Payload * > pendingDeletions [2]
 
uint8_t pendingDeletions_GC
 
uint8_t pendingDeletions_SO
 
std::mutex pendingDeletionsMutex
 
uint32_t GCPeriod
 
GarbageCollectorGC
 

Friends

class Messaging
 
class RecvThread
 
class NodeCon
 

Additional Inherited Members

- Public Types inherited from mBrane::sdk::module::Node
enum  Network {
  PRIMARY = 0, SECONDARY = 1, BOTH = 2, LOCAL = 3,
  EITHER = 4
}
 
enum  TraceLevel { EXECUTION = 0, NETWORK = 1, APPLICATION = 2 }
 
- Public Member Functions inherited from mBrane::sdk::mdaemon::Node
bool isRunning ()
 
virtual void dump (const char *fileName)=0
 
virtual void load (const char *fileName)=0
 
virtual void migrate (uint16_t CID, uint16_t ID, uint8_t NID)=0
 
virtual module::_ModulegetModule (uint8_t hostID, uint16_t CID, uint16_t ID)=0
 
- Public Member Functions inherited from mBrane::sdk::module::Node
uint8_t id () const
 
virtual const char * name ()=0
 
virtual void send (const _Module *sender, _Payload *p, Network network=PRIMARY)=0
 
virtual void send (const _Module *sender, _Payload *message, uint8_t nodeID, Network network=PRIMARY)=0
 
virtual uint64_t time () const =0
 
virtual void newSpace (const _Module *sender, Network network=PRIMARY)=0
 
virtual void newModule (const _Module *sender, uint16_t CID, Network network=PRIMARY, const char *hostName="local")=0
 
virtual void deleteSpace (uint16_t ID, Network network=PRIMARY)=0
 
virtual void deleteModule (uint16_t CID, uint16_t ID, Network network=PRIMARY)=0
 
virtual void activateModule (const _Module *sender, uint16_t module_cid, uint16_t module_id, uint16_t space_id, float activationLevel, Network network=PRIMARY)=0
 
virtual void activateSpace (const _Module *sender, uint16_t space_id, uint16_t target_sid, float activationLevel, Network network=PRIMARY)=0
 
virtual void setSpaceThreshold (const _Module *sender, uint16_t space_id, float threshold, Network network=PRIMARY)=0
 
virtual void subscribeMessage (const _Module *sender, uint16_t module_cid, uint16_t module_id, uint16_t space_id, uint16_t message_cid, Network network=PRIMARY)=0
 
virtual void unsubscribeMessage (const _Module *sender, uint16_t module_cid, uint16_t module_id, uint16_t space_id, uint16_t message_cid, Network network=PRIMARY)=0
 
virtual void subscribeStream (const _Module *sender, uint16_t module_cid, uint16_t module_id, uint16_t space_id, uint16_t stream_id, Network network=PRIMARY)=0
 
virtual void unsubscribeStream (const _Module *sender, uint16_t module_cid, uint16_t module_id, uint16_t space_id, uint16_t stream_id, Network network=PRIMARY)=0
 
virtual const char * getSpaceName (uint16_t hostID, uint16_t ID)=0
 
virtual const char * getModuleName (uint16_t CID)=0
 
virtual void markUnused (_Payload *p)=0
 
virtual void addConstantObject (_Payload *c, const std::string &name)=0
 
virtual _PayloadgetConstantObject (uint32_t OID)=0
 
virtual _PayloadgetConstantObject (const std::string &name)=0
 
virtual void addLookup (uint8_t sourceNID, uint32_t OID)=0
 
virtual bool hasLookup (uint8_t destinationNID, uint32_t OID)=0
 
virtual void addSharedObject (_Payload *p)=0
 
virtual _PayloadgetSharedObject (uint32_t OID)=0
 
virtual void consolidate (_Payload *p)=0
 
- Static Public Member Functions inherited from mBrane::sdk::module::Node
static NodeGet ()
 
static std::ostream & trace (TraceLevel l)
 
- Static Public Attributes inherited from mBrane::sdk::module::Node
static const uint8_t NoID = 0xFF
 
- Static Protected Attributes inherited from mBrane::sdk::module::Node
static std::ostream * Streams [3]
 

Member Typedef Documentation

typedef void(* mBrane::Networking::BootCallback) ()
protected

Constructor & Destructor Documentation

mBrane::Networking::Networking ( )
protected
mBrane::Networking::~Networking ( )
protected

Here is the call graph for this function:

Member Function Documentation

void mBrane::Networking::_broadcastControlMessage ( _Payload p,
Network  network 
)
inlineprotected

Here is the call graph for this function:

Here is the caller graph for this function:

void mBrane::Networking::_sendControlMessage ( _Payload p,
uint8_t  destinationNID,
Network  network 
)
inlineprotected

Here is the call graph for this function:

void mBrane::Networking::AcceptConnections ( AcceptConnectionArgs acargs)
staticprotected

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t mBrane::Networking::addNodeEntry ( )
protected
bool mBrane::Networking::addNodeName ( const char *  name,
bool  myself = false 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

bool mBrane::Networking::allNodesJoined ( )
protected

Here is the caller graph for this function:

bool mBrane::Networking::allNodesReady ( )
protected

Here is the call graph for this function:

void mBrane::Networking::broadcastControlMessage ( _Payload p,
Network  network 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

bool mBrane::Networking::checkSyncProbe ( uint8_t  syncNodeID)
protected

Here is the caller graph for this function:

uint16_t mBrane::Networking::connect ( NetworkID networkID)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t mBrane::Networking::connect ( Network  network,
NetworkID networkID 
)
protected

Here is the call graph for this function:

uint8_t mBrane::Networking::getNodeID ( const char *  name)
protectedvirtual

Implements mBrane::sdk::module::Node.

Here is the caller graph for this function:

bool mBrane::Networking::init ( )
protected

Here is the call graph for this function:

Here is the caller graph for this function:

bool mBrane::Networking::loadConfig ( XMLNode n)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

bool mBrane::Networking::loadInterface ( XMLNode interfaces,
XMLNode config,
const char *  name,
InterfaceType  type 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void mBrane::Networking::notifyNodeJoined ( uint8_t  NID,
NetworkID networkID 
)
protectedpure virtual

Implemented in mBrane::Node.

Here is the caller graph for this function:

virtual void mBrane::Networking::notifyNodeLeft ( uint8_t  NID)
protectedpure virtual

Implemented in mBrane::Node.

Here is the caller graph for this function:

void mBrane::Networking::processError ( uint8_t  NID)
inlineprotected

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t mBrane::Networking::recvID ( CommChannel c,
NetworkID *&  networkID,
bool  expectToken = true 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t mBrane::Networking::recvMap ( CommChannel c,
NetworkID fromNetworkID 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

void mBrane::Networking::ScanIDs ( Networking node)
staticprotected

Here is the call graph for this function:

Here is the caller graph for this function:

void mBrane::Networking::sendControlMessage ( _Payload p,
uint8_t  destinationNID,
Network  network 
)
protected

Here is the caller graph for this function:

void mBrane::Networking::sendData ( uint8_t  NID,
_Payload p,
Network  network 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t mBrane::Networking::sendID ( CommChannel c,
NetworkID networkID 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t mBrane::Networking::sendMap ( CommChannel c)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

void mBrane::Networking::sendStreamData ( uint8_t  NID,
_Payload p,
Network  network 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

void mBrane::Networking::setNewReference ( )
protected

Here is the caller graph for this function:

void mBrane::Networking::shutdown ( )
protectedvirtual

Reimplemented from mBrane::sdk::mdaemon::Node.

Reimplemented in mBrane::Node.

Here is the call graph for this function:

Here is the caller graph for this function:

void mBrane::Networking::start ( uint8_t  assignedNID,
NetworkID networkNID,
bool  isTimeReference 
)
protectedvirtual

Reimplemented in mBrane::Node.

Here is the call graph for this function:

Here is the caller graph for this function:

bool mBrane::Networking::startInterfaces ( )
protected

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void mBrane::Networking::startReceivingThreads ( uint8_t  NID)
protectedpure virtual

Implemented in mBrane::Node.

bool mBrane::Networking::startSync ( )
protected

Here is the call graph for this function:

Here is the caller graph for this function:

void mBrane::Networking::stopInterfaces ( )
protected

Here is the call graph for this function:

Here is the caller graph for this function:

void mBrane::Networking::Sync ( Networking node)
staticprotected

Here is the call graph for this function:

void mBrane::Networking::systemReady ( )
protected

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class Messaging
friend
friend class NodeCon
friend
friend class RecvThread
friend

Member Data Documentation

std::mutex mBrane::Networking::acceptConnectionMutex
protected
int32_t mBrane::Networking::bcastTimeout
protected
BootCallback mBrane::Networking::bootCallback
protected
CommChannel* mBrane::Networking::broadcastChannel[2]
protected
SharedLibrary* mBrane::Networking::callbackLibrary
protected
std::mutex mBrane::Networking::channelsMutex
protected
Array<std::thread, 32> mBrane::Networking::commThreads
protected
uint8_t mBrane::Networking::connectedNodeCount
protected
CommChannel* mBrane::Networking::discoveryChannel
protected
Host::host_name mBrane::Networking::hostName
protected
uint8_t mBrane::Networking::hostNameSize
protected
bool mBrane::Networking::isTimeReference
protected
Network mBrane::Networking::network
protected
NetworkID* mBrane::Networking::networkID
protected
DynamicClassLoader<NetworkInterface>* mBrane::Networking::networkInterfaceLoaders[7]
protected
NetworkInterface* mBrane::Networking::networkInterfaces[7]
protected
uint8_t mBrane::Networking::nodeCount
protected
UNORDERED_MAP<uint8_t, NodeCon *> mBrane::Networking::nodes
protected
uint8_t mBrane::Networking::referenceNID
protected
int64_t mBrane::Networking::syncPeriod
protected
int64_t mBrane::Networking::timeDrift
protected

The documentation for this class was generated from the following files: