int OscReceiver::messageCB(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data) { OscReceiver* receiver = (OscReceiver*) user_data; return receiver->processMessage(ReceivedMessage((std::string) path, (std::string) types, argv, argc, msg), MessageSource(lo_message_get_source(msg))); }
//============================================================================ // NMessageServer::SendMessage : Send a message. //---------------------------------------------------------------------------- void NMessageServer::SendMessage(const NNetworkMessage &theMsg) { StLock acquireLock(mLock); NClientInfoMapConstIterator theIter; NEntityID dstID; // Get the state we need dstID = theMsg.GetDestination(); // Send to self if (dstID == GetID()) ReceivedMessage(theMsg); // Send to everyone else if (dstID == kNEntityEveryone) { ReceivedMessage(theMsg); for (theIter = mClients.begin(); theIter != mClients.end(); theIter++) (void) WriteMessage(theIter->second.theSocket, theMsg, false); } // Send to a client // // To handle tainted data, we check as well as assert. else { theIter = mClients.find(dstID); NN_ASSERT(theIter != mClients.end()); if (theIter != mClients.end()) (void) WriteMessage(theIter->second.theSocket, theMsg, false); } }
//============================================================================ // NMessageServer::ProcessMessage : Process a message. //---------------------------------------------------------------------------- void NMessageServer::ProcessMessage(const NNetworkMessage &theMsg) { NEntityID dstID; // Get the state we need dstID = theMsg.GetDestination(); // Process the message if (dstID == GetID()) ReceivedMessage(theMsg); else SendMessage(theMsg); }