NLNET Namespace Reference


Detailed Description

This namespace contains all network class.


Data Structures

class  _CUniTime
struct  CAlarm
struct  CBaseStruct
class  CBufClient
struct  CBufferizedOutPacket
class  CBufNetBase
class  CBufServer
class  CBufSock
class  CCallbackClient
class  CCallbackNetBase
class  CCallbackServer
class  CClientReceiveTask
class  CDummyTcpSock
struct  CGraphUpdate
class  CInetAddress
class  CListenSock
class  CListenTask
class  CLoginClient
class  CLoginCookie
class  CLoginServer
class  CMessage
class  CMessageRecorder
class  CNamingClient
struct  CNamingClient::CServiceEntry
class  CNetDisplayer
class  CNetLog
class  CNetManager
class  CNonBlockingBufSock
class  CPacsClient
struct  CPendingUser
struct  CRequest
class  CServerBufSock
class  CServerReceiveTask
class  CServerTask
class  CSock
class  CTcpSock
class  CTransportClass
class  CUdpSimSock
class  CUdpSock
class  CUnifiedNetwork
class  CUnifiedNetwork::CUnifiedConnection
 This may contains a CCallbackClient or a TSockId, depending on which type of connection it is. More...

struct  CUnifiedNetwork::CUnifiedConnection::TConnection
 The connection structure. More...

struct  CUnifiedNetwork::TNameMappedConnection
 A map of service ids, referred by a service name. More...

struct  EAccessDenied
 Exception raised when an unauthorized access has been done. More...

struct  EServiceNotFound
 Exception raised when a the NS does not find the service looked-up. More...

struct  ESocket
struct  ESocketConnectionClosed
 Exception raised when a connection is gracefully closed by peer. More...

struct  ESocketConnectionFailed
 Exception raised when connect() fails. More...

class  IService
struct  TCallbackItem
 Callback items. See CMsgSocket::update() for an explanation on how the callbacks are called. More...

struct  TMessageRecord
struct  TUnifiedCallbackItem
 Callback items. See CMsgSocket::update() for an explanation on how the callbacks are called. More...


Typedefs

typedef std::set< TSockIdCConnections
typedef CSynchronizedFIFO::CAccessor CFifoAccessor
 Accessor of mutexed FIFO buffer.

typedef NLMISC::CSynchronized<
NLMISC::CBufFIFO
CSynchronizedFIFO
 Synchronized FIFO buffer.

typedef std::vector< NLMISC::IThread * > CThreadPool
typedef uint32 TBlockSize
 Size of a block.

typedef void(* TBroadcastCallback )(const std::string &name, TServiceId sid, const std::vector< CInetAddress > &addr)
typedef void(* TDisconnectClientCallback )(uint32 userId)
 Callback function type called when a client need to be disconnected (double login...).

typedef void(* TMsgCallback )(CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
typedef void(* TNetCallback )(TSockId from, void *arg)
 Callback function for message processing.

typedef void(* TNetManagerCallback )(const std::string &serviceName, TSockId from, void *arg)
 Callback function type for message processing.

typedef void(* TNewClientCallback )(TSockId from, const CLoginCookie &cookie)
 Callback function type called when a new client is identified (with the login password procedure).

typedef void(* TRemoteClientCallback )(uint32 rid, const std::string &cmd, const std::string &entityNames)
typedef uint8 TServiceId
typedef CBufSockTSockId
 Socket identifier.

typedef std::pair< TNetCallback,
TSockId
TStoredNetCallback
 Storing a TNetCallback call for future call.

typedef void(* TUnifiedMsgCallback )(CMessage &msgin, const std::string &serviceName, uint16 sid)
typedef void(* TUnifiedNetCallback )(const std::string &serviceName, uint16 sid, void *arg)

Enumerations

enum  TNetworkEvent {
  Sending, Receiving, Connecting, ConnFailing,
  Accepting, Disconnecting, Error
}
 Type of network events (if changed, don't forget to change EventToString() and StringToEvent(). More...


Functions

void addRequestAnswer (uint32 rid, const std::vector< std::string > &variables, const std::vector< std::string > &values)
void addRequestAnswer (uint32 rid, const vector< string > &variables, const vector< string > &values)
void addRequestWaitingNb (uint32 rid)
CVariable< bool > Bench ("Bench","1 if benching 0 if not", 0, true)
void cbAdminPing (CMessage &msgin, const std::string &serviceName, uint16 sid)
void cbAESConnection (const string &serviceName, uint16 sid, void *arg)
void cbAESDisconnection (const std::string &serviceName, uint16 sid, void *arg)
void cbClientGetUniversalTime (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbcMessageRecvAllAssociations (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbDirectoryChanged (IVariable &var)
void cbExecCommand (CMessage &msgin, const std::string &serviceName, uint16 sid)
void cbExecuteCommands (CConfigFile::CVar &var)
void cbGetUniversalTime (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbInfo (CMessage &msgin, const std::string &serviceName, uint16 sid)
void cbLogFilter (CConfigFile::CVar &var)
void cbnbMessageAskAssociations (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbnbMessageRecvAssociations (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbnbNewDisconnection (TSockId from, void *data)
void cbPacsAnswer (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbQueryPort (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbReceiveShardId (CMessage &msgin, const string &serviceName, uint16 serviceId)
void cbRegister (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbRegisterBroadcast (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbServerAskUniversalTime (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbServGetView (CMessage &msgin, const std::string &serviceName, uint16 sid)
void cbShardValidate (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbShardValidation (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbSimVar (CConfigFile::CVar &var)
void cbsNewConnection (TSockId from, void *data)
void cbStopService (CMessage &msgin, const std::string &serviceName, uint16 sid)
void cbTCReceiveMessage (CMessage &msgin, const string &name, uint16 sid)
void cbTCReceiveOtherSideClass (CMessage &msgin, const string &name, uint16 sid)
void cbTCUpService (const std::string &serviceName, uint16 sid, void *arg)
void cbUnregisterBroadcast (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void cbWSChooseShard (CMessage &msgin, const std::string &serviceName, uint16 sid)
void cbWSDisconnectClient (CMessage &msgin, const std::string &serviceName, uint16 sid)
void cfcbAcceptInvalidCookie (CConfigFile::CVar &var)
void cfcbDefaultUserPriv (CConfigFile::CVar &var)
void cfcbListenAddress (CConfigFile::CVar &var)
void cfcbTimeBeforeEraseCookie (CConfigFile::CVar &var)
void cleanRequest ()
void ClientConnection (TSockId from, void *arg)
bool createMessage (CMessage &msgout, const vector< string > &args, CLog &log)
bool emptyRequest (uint32 rid)
string EventToString (TNetworkEvent e)
 TNetworkEvent -> string.

void getNameOfMessageOrTransportClass (NLNET::CMessage &msgin, std::string &msgName)
void initAdmin (bool dontUseAES)
void initSignal ()
std::string internalIPAddressToString (uint32 addr)
 Take an internal address and convert it to a internet dot string.

bool isRemoteCommand (string &str)
CVariable< sint32NetSpeedLoop ("NetSpeedLoop","duration of the last user loop(in ms)", 10, false)
NLMISC::CMutex nettrace_mutex ("nettrace_mutex")
 NLMISC_COMMAND (isServiceLocal,"Says if a service is local or not compare with this service","< sid >|< service name >")
 NLMISC_COMMAND (l5Callback,"Displays all callback registered in layer5","")
 NLMISC_COMMAND (l5InternalTables,"Displays internal table of network layer5","")
 NLMISC_COMMAND (l5QueuesStats,"Displays queues stats of network layer5","")
 NLMISC_COMMAND (msgout,"Send a message to a specified service(ex:msgout 128 REGISTER u32 10 b 1 f 1.5)","< ServiceName >|< ServiceId >< MessageName >[< ParamType >< Param >]*")
 NLMISC_COMMAND (msgin,"Simulate an input message from another service(ex:msgin 128 REGISTER u32 10 b 1 f 1.5)","< ServiceName >|< ServiceId >< MessageName >[< ParamType >< Param >]*")
 NLMISC_COMMAND (getUnknownConfigFileVariables,"display the variables from config file that are called but not present","")
 NLMISC_COMMAND (displayConfigFile,"display the variables of the default configfile","")
 NLMISC_COMMAND (getWinDisplayerInfo,"display the info about the pos and size of the window displayer","")
 NLMISC_COMMAND (resetMeasures,"reset hierarchical timer","")
 NLMISC_COMMAND (serviceInfo,"display information about this service","")
 NLMISC_COMMAND (brutalQuit,"exit the service brutally","")
 NLMISC_COMMAND (quit,"exit the service","")
 NLMISC_COMMAND (services,"displays registered services","")
 NLMISC_COMMAND (lsPending,"displays the list of all pending users","")
 NLMISC_COMMAND (lsUsers,"displays the list of all connected users","")
 NLMISC_COMMAND (getView,"send a view and receive an array as result","< varpath >")
 NLMISC_COMMAND (displayInformations,"displays all admin informations","")
 NLMISC_DYNVARIABLE (uint64, SentBytes,"total of bytes sent by this service")
 NLMISC_DYNVARIABLE (uint64, ReceivedBytes,"total of bytes received by this service")
 NLMISC_DYNVARIABLE (uint64, ReceiveQueueSize,"current size in bytes of all receive queues")
 NLMISC_DYNVARIABLE (uint64, SendQueueSize,"current size in bytes of all send queues")
 NLMISC_DYNVARIABLE (string, State,"Set this value to 0 to shutdown the service and 1 to start the service")
 NLMISC_DYNVARIABLE (string, Scroller,"current size in bytes of the sent queue size")
 NLMISC_DYNVARIABLE (string, Uptime,"time from the launching of the program")
 NLMISC_DYNVARIABLE (string, LaunchingDate,"date of the launching of the program")
 NLMISC_DYNVARIABLE (string, LSListenAddress,"the listen address sended to the client to connect on this front_end")
 NLMISC_VARIABLE (uint32, TotalCallbackCalled,"Total callback called number on layer 5")
 NLMISC_VARIABLE (uint32, NbUserUpdate,"number of time the user IService::update() called")
 NLMISC_VARIABLE (string, CompilationMode,"mode of the compilation")
 NLMISC_VARIABLE (string, CompilationDate,"date of the compilation")
 NLMISC_VARIABLE (string, DefaultUserPriv,"Default User priv for people who don't use the login system")
 NLMISC_VARIABLE (uint32, NbServerReceiveTask,"Number of server receive thread")
 NLMISC_VARIABLE (uint32, NbServerListenTask,"Number of server listen thread")
 NLMISC_VARIABLE (uint32, NbNetworkTask,"Number of server and client thread")
 NLMISC_VARIABLE (uint32, NbClientReceiveTask,"Number of client receive thread")
void nmNewConnection (TSockId from, void *arg)
void nmNewDisconnection (TSockId from, void *arg)
bool operator< (const CInetAddress &a1, const CInetAddress &a2)
bool operator== (const CLoginCookie &c1, const CLoginCookie &c2)
bool operator== (const CInetAddress &a1, const CInetAddress &a2)
void refreshPendingList ()
void RegistrationBroadcast (const std::string &name, TServiceId sid, const vector< CInetAddress > &addr)
void sendAdminEmail (char *format,...)
bool sendEmail (const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile="", bool onlyCheck=false)
bool sendEmail (const string &smtpServer, const string &from, const string &to, const string &subject, const string &body, const string &attachedFile, bool onlyCheck)
bool sendEMailCommand (CTcpSock &sock, const std::string &command, uint32 code=250)
void serviceGetView (uint32 rid, const std::string &rawvarpath, std::vector< std::pair< std::vector< std::string >, std::vector< std::string > > > &answer, bool async=false)
void serviceGetView (uint32 rid, const string &rawvarpath, vector< pair< vector< string >, vector< string > > > &answer, bool async)
void setDefaultEmailParams (const std::string &smtpServer, const std::string &from, const std::string &to)
void setInformations (const std::vector< std::string > &alarms, const std::vector< std::string > &graphupdate)
void setInformations (const vector< string > &alarms, const vector< string > &graphupdate)
void setListenAddress (const string &la)
void setRemoteClientCallback (TRemoteClientCallback cb)
void sigHandler (int Sig)
string stringFromVectorPart (const vector< uint8 > &v, uint32 pos, uint32 len)
TNetworkEvent StringToEvent (string &s)
 string -> TNetworkEvent

uint32 stringToInternalIPAddress (const std::string &addr)
 Take a internet dot string and convert it in an uint32 internal format for example "128.64.32.16" -> 0xF0804020.

void subRequestWaitingNb (uint32 rid)
string typeToString (CTransportClass::TProp type)
void uncbConnection (TSockId from, void *arg)
void uncbDisconnection (TSockId from, void *arg)
void uncbMsgProcessing (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void uncbServiceIdentification (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
void uNetRegistrationBroadcast (const string &name, TServiceId sid, const vector< CInetAddress > &addr)
void uNetUnregistrationBroadcast (const string &name, TServiceId sid, const vector< CInetAddress > &addr)
void UnregistrationBroadcast (const std::string &name, TServiceId sid, const vector< CInetAddress > &addr)
void updateAdmin ()
CVariable< uint32UpdateAssertionThreadTimeout ("UpdateAssertionThreadTimeout","in millisecond, timeout before thread assertion", 0, 0, true, UpdateAssertionThreadTimeoutCB)
void UpdateAssertionThreadTimeoutCB (IVariable &var)
uint64 updateStatCounter (uint64 &counter, uint64 newvalue)
CVariable< sint32UserSpeedLoop ("UserSpeedLoop","duration of the last network loop(in ms)", 10, false)
void uuencode (const char *s, const char *store, const int length)
std::string vectorCInetAddressToString (const std::vector< CInetAddress > &addrs)

Variables

TBroadcastCallback _RegistrationBroadcastCallback = NULL
TBroadcastCallback _UnregistrationBroadcastCallback = NULL
bool AcceptInvalidCookie = false
const uint32 AlarmCheckDelay = 5
vector< CAlarmAlarms
string allstuffs
const uint64 AppIdDeadConnection = 0xDEAD
uint8 buffer [10000]
queue< CBufferizedOutPacket * > BufferizedInPackets
queue< CBufferizedOutPacket * > BufferizedOutPackets
TUnifiedCallbackItem builtinServiceCallbacks []
TUnifiedCallbackItem CallbackArray []
TCallbackItem cbnbMessageAssociationArray []
const TCallbackItem ClientCallbackArray []
TCallbackItem ClientMessageAssociationArray []
CNetDisplayer commandDisplayer (false)
string CompilationDate
string CompilationMode = "???"
string DefaultFrom
string DefaultSMTPServer
string DefaultTo
string DefaultUserPriv = ""
TDisconnectClientCallback DisconnectClientCallback = NULL
TUnifiedCallbackItem EmptyCallbackArray [1] = { { "", NULL } }
sint ExitSignalAsked = 0
CFileDisplayer fd
TCallbackItem FESCallbackArray []
bool GetClientUniversalTime
TTime GetClientUniversalTimeUniTime
bool GetUniversalTime
uint32 GetUniversalTimeSecondsSince1970
TTime GetUniversalTimeUniTime
vector< CGraphUpdateGraphUpdates
const TSockId InvalidSockId = (TSockId) NULL
uint32 LaunchingDate
string ListenAddr
const char * LockedSubMessageError = "a sub message is forbidden"
const sint16 LOG_CBINDEX = 0
bool ModeTcp = 0
CTimeoutAssertionThread MyTAT
TCallbackItem NamingClientCallbackArray []
uint32 NbClientReceiveTask = 0
uint32 NbNetworkTask = 0
uint32 NbServerListenTask = 0
uint32 NbServerReceiveTask = 0
uint32 NbUserUpdate = 0
const char * NegFiltersNames []
CNetLog NetLog
TNewClientCallback NewClientCallback = NULL
TCallbackItem PacsCallbackArray []
list< CPendingUserPendingUsers
bool QueryPort
uint16 QueryPortPort
string Reason
bool Registered
TServiceIdRegisteredSID = NULL
bool RegisteredSuccess
TRemoteClientCallback RemoteClientCallback = 0
vector< CRequestRequests
uint32 RequestTimeout = 4
CCallbackServerServer = NULL
TCallbackItem ServerTimeServiceCallbackArray []
bool ShardValidate
string ShardValidateReason
const sint Signal []
uint SignalisedThread
const char * SignalName []
char tbl [65]
CLog test (CLog::LOG_INFO)
uint ThreadCreator = 0
uint TimeBeforeEraseCookie = 120
uint32 TotalCallbackCalled = 0
TCallbackItem unServerCbArray []
map< uint32, TSockIdUserIdSockAssociations
 contains the correspondance between userid and the sockid

TUnifiedCallbackItem WSCallbackArray []


Typedef Documentation

typedef std::set<TSockId> NLNET::CConnections
 

Definition at line 382 of file buf_server.h.

typedef CSynchronizedFIFO::CAccessor NLNET::CFifoAccessor
 

Accessor of mutexed FIFO buffer.

Definition at line 56 of file buf_net_base.h.

Referenced by NLNET::CBufServer::dataAvailable(), NLNET::CBufClient::dataAvailable(), NLNET::CBufClient::disconnect(), NLNET::CBufNetBase::displayReceiveQueueStat(), NLNET::CBufNetBase::getReceiveQueueSize(), NLNET::CBufNetBase::pushMessageIntoReceiveQueue(), NLNET::CBufServer::receive(), NLNET::CBufClient::receive(), and NLNET::CServerReceiveTask::run().

typedef NLMISC::CSynchronized<NLMISC::CBufFIFO> NLNET::CSynchronizedFIFO
 

Synchronized FIFO buffer.

Definition at line 53 of file buf_net_base.h.

Referenced by NLNET::CBufNetBase::receiveQueue().

typedef std::vector<NLMISC::IThread*> NLNET::CThreadPool
 

Definition at line 115 of file buf_server.h.

Referenced by NLNET::CBufServer::addNewThread().

typedef uint32 NLNET::TBlockSize
 

Size of a block.

Definition at line 59 of file buf_net_base.h.

Referenced by NLNET::CBufSock::flush(), NLNET::CBufServer::pushBufferToHost(), NLNET::CBufServer::receive(), and NLNET::CNonBlockingBufSock::receivePart().

typedef void(* NLNET::TBroadcastCallback)(const std::string &name, TServiceId sid, const std::vector<CInetAddress> &addr)
 

Definition at line 44 of file naming_client.h.

Referenced by NLNET::CNamingClient::setRegistrationBroadcastCallback(), and NLNET::CNamingClient::setUnregistrationBroadcastCallback().

typedef void(* NLNET::TDisconnectClientCallback)(uint32 userId)
 

Callback function type called when a client need to be disconnected (double login...).

Definition at line 50 of file login_server.h.

Referenced by NLNET::CLoginServer::init().

typedef void(* NLNET::TMsgCallback)(CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
 

Callback function type for message processing

msgin contains parameters of the message from is the SockId of the connection, for a client, from is always the same value

Definition at line 55 of file callback_net_base.h.

Referenced by NLNET::CCallbackNetBase::processOneMessage(), and NLNET::CCallbackNetBase::setDefaultCallback().

typedef void(* NLNET::TNetCallback)( TSockId from, void *arg )
 

Callback function for message processing.

Definition at line 47 of file buf_net_base.h.

Referenced by NLNET::CBufServer::connectionCallback(), NLNET::CBufNetBase::disconnectionCallback(), NLNET::CCallbackServer::setConnectionCallback(), NLNET::CBufServer::setConnectionCallback(), NLNET::CCallbackServer::setDisconnectionCallback(), NLNET::CCallbackNetBase::setDisconnectionCallback(), NLNET::CCallbackClient::setDisconnectionCallback(), and NLNET::CBufNetBase::setDisconnectionCallback().

typedef void(* NLNET::TNetManagerCallback)(const std::string &serviceName, TSockId from, void *arg)
 

Callback function type for message processing.

Definition at line 52 of file net_manager.h.

Referenced by NLNET::CNetManager::setConnectionCallback(), and NLNET::CNetManager::setDisconnectionCallback().

typedef void(* NLNET::TNewClientCallback)(TSockId from, const CLoginCookie &cookie)
 

Callback function type called when a new client is identified (with the login password procedure).

Definition at line 47 of file login_server.h.

Referenced by NLNET::CLoginServer::init().

typedef void(* NLNET::TRemoteClientCallback)(uint32 rid, const std::string &cmd, const std::string &entityNames)
 

Definition at line 66 of file admin.h.

Referenced by setRemoteClientCallback().

typedef uint8 NLNET::TServiceId
 

Definition at line 42 of file naming_client.h.

Referenced by NLNET::CNetManager::addServer(), cbRegisterBroadcast(), cbUnregisterBroadcast(), NLNET::CNamingClient::CServiceEntry::CServiceEntry(), NLNET::CNamingClient::find(), NLNET::IService::getServiceId(), NLNET::CUnifiedNetwork::init(), NLNET::CNamingClient::lookup(), NLNET::CNamingClient::registerService(), NLNET::CNamingClient::registerServiceWithSId(), RegistrationBroadcast(), NLNET::CNamingClient::resendRegisteration(), uNetRegistrationBroadcast(), uNetUnregistrationBroadcast(), NLNET::CNamingClient::unregisterAllServices(), NLNET::CNamingClient::unregisterService(), and UnregistrationBroadcast().

typedef CBufSock* NLNET::TSockId
 

Socket identifier.

Definition at line 42 of file buf_net_base.h.

Referenced by NLNET::CServerReceiveTask::addNewSocket(), NLNET::CServerReceiveTask::addToRemoveSet(), NLNET::CBufSock::advertiseDisconnection(), NLNET::CBufSock::advertiseSystemEvent(), NLNET::CCallbackNetBase::authorizeOnly(), cbClientGetUniversalTime(), cbcMessageRecvAllAssociations(), cbGetUniversalTime(), cbnbMessageAskAssociations(), cbnbMessageRecvAssociations(), cbnbNewDisconnection(), cbPacsAnswer(), cbQueryPort(), cbRegister(), cbRegisterBroadcast(), cbServerAskUniversalTime(), cbShardValidate(), cbShardValidation(), cbsNewConnection(), cbUnregisterBroadcast(), NLNET::CServerReceiveTask::clearClosedConnections(), ClientConnection(), NLNET::CBufServer::dataAvailable(), NLNET::CCallbackServer::disconnect(), NLNET::CCallbackNetBase::disconnect(), NLNET::CCallbackClient::disconnect(), NLNET::CBufServer::disconnect(), NLNET::CCallbackServer::displaySendQueueStat(), NLNET::CCallbackClient::displaySendQueueStat(), NLNET::CBufServer::displaySendQueueStat(), NLNET::CServerBufSock::fillSockIdAndEventType(), NLNET::CCallbackServer::flush(), NLNET::CCallbackClient::flush(), NLNET::CBufServer::flush(), NLNET::CUnifiedNetwork::getNetBase(), NLNET::CBufServer::getSendQueueSize(), NLNET::CCallbackServer::getSockId(), NLNET::CCallbackClient::getSockId(), NLNET::CCallbackServer::hostAddress(), NLNET::CCallbackNetBase::hostAddress(), NLNET::CCallbackClient::hostAddress(), NLNET::CBufServer::hostAddress(), NLNET::CBufClient::id(), NLMISC_COMMAND(), nmNewConnection(), nmNewDisconnection(), NLNET::CCallbackNetBase::processOneMessage(), NLNET::CBufServer::pushBufferToHost(), NLNET::CCallbackServer::receive(), NLNET::CCallbackClient::receive(), NLNET::CBufServer::receive(), NLNET::CMessageRecorder::recordNext(), NLNET::CServerReceiveTask::run(), NLNET::CNetManager::send(), NLNET::CCallbackServer::send(), NLNET::CCallbackClient::send(), NLNET::CBufServer::send(), NLNET::CCallbackServer::sendAllMyAssociations(), NLNET::CBufServer::setSizeFlushTrigger(), NLNET::CBufServer::setTimeFlushTrigger(), NLNET::CClientReceiveTask::sockId(), NLNET::CUnifiedNetwork::CUnifiedConnection::TConnection::TConnection(), NLNET::TMessageRecord::TMessageRecord(), uncbConnection(), uncbDisconnection(), uncbMsgProcessing(), and uncbServiceIdentification().

typedef std::pair<TNetCallback,TSockId> NLNET::TStoredNetCallback
 

Storing a TNetCallback call for future call.

Definition at line 50 of file buf_net_base.h.

typedef void(* NLNET::TUnifiedMsgCallback)(CMessage &msgin, const std::string &serviceName, uint16 sid)
 

Callback function type for message processing

Parameters:
msgin message received
serviceName name of the service that sent the message
sid id of the service that sent the message

Definition at line 52 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::findCallback(), and NLMISC_COMMAND().

typedef void(* NLNET::TUnifiedNetCallback)(const std::string &serviceName, uint16 sid, void *arg)
 

Callback function type for service up/down processing

Parameters:
serviceName name of the service that is un/registered to the naming service
arg a pointer initialized by the user

Definition at line 45 of file unified_network.h.

Referenced by NLNET::CUnifiedNetwork::callServiceDownCallback(), NLNET::CUnifiedNetwork::callServiceUpCallback(), NLNET::CUnifiedNetwork::setServiceDownCallback(), and NLNET::CUnifiedNetwork::setServiceUpCallback().


Enumeration Type Documentation

enum NLNET::TNetworkEvent
 

Type of network events (if changed, don't forget to change EventToString() and StringToEvent().

Enumeration values:
Sending 
Receiving 
Connecting 
ConnFailing 
Accepting 
Disconnecting 
Error 

Definition at line 49 of file message_recorder.h.

Referenced by NLNET::CMessageRecorder::checkNextOne(), NLNET::CCallbackClient::connect(), NLNET::CMessageRecorder::replayConnectionAttempt(), and StringToEvent().


Function Documentation

void addRequestAnswer uint32  rid,
const std::vector< std::string > &  variables,
const std::vector< std::string > &  values
 

void addRequestAnswer uint32  rid,
const vector< string > &  variables,
const vector< string > &  values
 

Definition at line 275 of file admin.cpp.

References nlassert, nldebug, nlwarning, Requests, uint, and uint32.

Referenced by serviceGetView().

00276 {
00277         if (!variables.empty() && variables[0] == "__log")
00278         {       nlassert (variables.size() == 1); }
00279         else
00280         {       nlassert (variables.size() == values.size()); }
00281 
00282         for (uint i = 0 ; i < Requests.size (); i++)
00283         {
00284                 if (Requests[i].Id == rid)
00285                 {
00286                         Requests[i].Answers.push_back (make_pair(variables, values));
00287 
00288                         Requests[i].NbReceived++;
00289                         nldebug ("ADMIN: ++ i %d rid %d NbWaiting %d NbReceived+ %d", i, Requests[i].Id, Requests[i].NbWaiting, Requests[i].NbReceived);
00290                         
00291                         return;
00292                 }
00293         }
00294         // we received an unknown request, forget it
00295         nlwarning ("ADMIN: Receive an answer for unknown request %d", rid);
00296 }

void addRequestWaitingNb uint32  rid  )  [static]
 

Definition at line 221 of file admin.cpp.

References nldebug, nlwarning, Requests, uint, and uint32.

Referenced by serviceGetView().

00222 {
00223         for (uint i = 0 ; i < Requests.size (); i++)
00224         {
00225                 if (Requests[i].Id == rid)
00226                 {
00227                         Requests[i].NbWaiting++;
00228                         nldebug ("ADMIN: ++ i %d rid %d NbWaiting+ %d NbReceived %d", i, Requests[i].Id, Requests[i].NbWaiting, Requests[i].NbReceived);
00229                         // if we add a waiting, reset the timer
00230                         Requests[i].Time = CTime::getSecondsSince1970 ();
00231                         return;
00232                 }
00233         }
00234         nlwarning ("ADMIN: addRequestWaitingNb: can't find the rid %d", rid);
00235 }

CVariable<bool> Bench "Bench"  ,
"1 if benching 0 if not"  ,
,
true 
 

Referenced by NLNET::IService::main().

void cbAdminPing CMessage msgin,
const std::string &  serviceName,
uint16  sid
[static]
 

Definition at line 155 of file admin.cpp.

References uint16.

00156 {
00157         // Send back a pong to say to the AES that I'm alive
00158         CMessage msgout("ADMIN_PONG");
00159         CUnifiedNetwork::getInstance()->send(sid, msgout);
00160 }

void cbAESConnection const string &  serviceName,
uint16  sid,
void *  arg
 

Definition at line 169 of file admin.cpp.

References NLMISC::CMemStream::serial(), uint16, and uint32.

Referenced by initAdmin().

00170 {
00171         // established a connection to the AES, identify myself
00172 
00173         //
00174         // Sends the identification message with the name of the service and all commands available on this service
00175         //
00176 
00177         CMessage msgout ("SID");
00178         uint32 pid = getpid ();
00179         msgout.serial (IService::getInstance()->_AliasName, IService::getInstance()->_LongName, pid);
00180         ICommand::serialCommands (msgout);
00181         CUnifiedNetwork::getInstance()->send("AES", msgout);
00182 
00183         if (IService::getInstance()->_Initialized)
00184         {
00185                 CMessage msgout2 ("SR");
00186                 CUnifiedNetwork::getInstance()->send("AES", msgout2);
00187         }
00188 }

void cbAESDisconnection const std::string &  serviceName,
uint16  sid,
void *  arg
[static]
 

Definition at line 191 of file admin.cpp.

References nlinfo, and uint16.

Referenced by initAdmin().

00192 {
00193         nlinfo("Lost connection to the %s-%hu", serviceName.c_str(), sid);
00194 }

void cbClientGetUniversalTime CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
[static]
 

Definition at line 296 of file unitime.cpp.

References GetClientUniversalTime, GetClientUniversalTimeUniTime, nlstop, NLMISC::CMemStream::serial(), and TSockId.

00297 {
00298         nlstop;
00299         // get the association between a date and unitime
00300         msgin.serial (GetClientUniversalTimeUniTime);
00301         GetClientUniversalTime = true;
00302 }

void cbcMessageRecvAllAssociations CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
[static]
 

Definition at line 43 of file callback_client.cpp.

References cbnbMessageRecvAssociations(), from, NLNET::CCallbackNetBase::getSIDA(), NLMISC::CStringIdArray::ignoreAllUnknownId(), and TSockId.

00044 {
00045         netbase.getSIDA().ignoreAllUnknownId (false);
00046         cbnbMessageRecvAssociations (msgin, from, netbase);
00047 }

void cbDirectoryChanged IVariable var  ) 
 

Definition at line 230 of file service.cpp.

References NLMISC::IVariable::fromString(), NLMISC::ICommand::getName(), nlinfo, and NLMISC::IVariable::toString().

Referenced by NLNET::IService::IService().

00231 {
00232         string vp = CPath::getFullPath(var.toString());
00233         nlinfo ("SERVICE: '%s' changed to '%s'", var.getName().c_str(), vp.c_str());
00234         var.fromString(vp);
00235 
00236         if (var.getName() == "RunningDirectory")
00237         {
00238 #ifdef NL_OS_WINDOWS
00239                 _chdir (vp.c_str());
00240 #else
00241                 chdir (vp.c_str());
00242 #endif
00243         }
00244 }

void cbExecCommand CMessage msgin,
const std::string &  serviceName,
uint16  sid
[static]
 

Definition at line 144 of file admin.cpp.

References nlinfo, NLMISC::CMemStream::serial(), and uint16.

00145 {
00146         string command;
00147         msgin.serial (command);
00148         
00149         nlinfo ("ADMIN: Executing command from network : '%s'", command.c_str());
00150         ICommand::execute (command, IService::getInstance()->CommandLog);
00151 }

void cbExecuteCommands CConfigFile::CVar var  ) 
 

Definition at line 405 of file service.cpp.

References NLMISC::CConfigFile::CVar::asString(), sint, and NLMISC::CConfigFile::CVar::size().

Referenced by NLNET::IService::main().

00406 {
00407         for (sint i = 0; i < var.size(); i++)
00408         {
00409                 ICommand::execute (var.asString(i), IService::getInstance()->CommandLog);
00410         }
00411 }

void cbGetUniversalTime CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
[static]
 

Definition at line 139 of file unitime.cpp.

References GetUniversalTime, GetUniversalTimeSecondsSince1970, GetUniversalTimeUniTime, nlstop, NLMISC::CMemStream::serial(), and TSockId.

00140 {
00141         nlstop;
00142         // get the association between a date and unitime
00143         msgin.serial (GetUniversalTimeSecondsSince1970);
00144         msgin.serial (GetUniversalTimeUniTime);
00145         GetUniversalTime = true;
00146 }

void cbInfo CMessage msgin,
const std::string &  serviceName,
uint16  sid
[static]
 

Definition at line 100 of file admin.cpp.

References nlinfo, NLMISC::CMemStream::serialCont(), setInformations(), and uint16.

00101 {
00102         nlinfo ("ADMIN: Updating admin informations");
00103 
00104         vector<string> alarms;
00105         msgin.serialCont (alarms);
00106         vector<string> graphupdate;
00107         msgin.serialCont (graphupdate);
00108         
00109         setInformations (alarms, graphupdate);
00110 }       

void cbLogFilter CConfigFile::CVar var  ) 
 

Definition at line 361 of file service.cpp.

References NLMISC::CLog::addNegativeFilter(), NLMISC::AssertLog, NLMISC::CConfigFile::CVar::asString(), NLMISC::DebugLog, NLMISC::ErrorLog, NLMISC::InfoLog, NLMISC::CConfigFile::CVar::Name, nlinfo, nlstop, NLMISC::CLog::removeFilter(), sint, NLMISC::CConfigFile::CVar::size(), and NLMISC::WarningLog.

Referenced by NLNET::IService::main().

00362 {
00363         CLog *log = NULL;
00364         if (var.Name == "NegFiltersDebug")
00365         {
00366                 log = DebugLog;
00367         }
00368         else if (var.Name == "NegFiltersInfo")
00369         {
00370                 log = InfoLog;
00371         }
00372         else if (var.Name == "NegFiltersWarning")
00373         {
00374                 log = WarningLog;
00375         }
00376         else if (var.Name == "NegFiltersAssert")
00377         {
00378                 log = AssertLog;
00379         }
00380         else if (var.Name == "NegFiltersError")
00381         {
00382                 log = ErrorLog;
00383         }
00384         else
00385         {
00386                 nlstop;
00387         }
00388 
00389         nlinfo ("SERVICE: Updating %s from config file", var.Name.c_str());
00390         
00391         // remove all old filters from config file
00392         CConfigFile::CVar &oldvar = IService::getInstance()->ConfigFile.getVar (var.Name);
00393         for (sint j = 0; j < oldvar.size(); j++)
00394         {
00395                 log->removeFilter (oldvar.asString(j).c_str());
00396         }
00397 
00398         // add all new filters from config file
00399         for (sint i = 0; i < var.size(); i++)
00400         {
00401                 log->addNegativeFilter (var.asString(i).c_str());
00402         }
00403 }

void cbnbMessageAskAssociations CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
 

Definition at line 88 of file callback_net_base.cpp.

References NLNET::CCallbackNetBase::_OutputSIDA, from, NLMISC::CStringIdArray::getId(), NLNET::CCallbackNetBase::getSIDA(), nlassert, nldebug, NLNET::CCallbackNetBase::send(), NLMISC::CMemStream::serial(), sint, size, TSockId, and NLMISC::CStringIdArray::TStringId.

00089 {
00090         CMessage msgout (netbase.getSIDA(), "RA");
00091         CStringIdArray::TStringId size;
00092         msgin.serial (size);
00093 
00094         nldebug ("LNETL3NB_ASSOC: The other side want %d string associations", size);
00095 
00096         msgout.serial (size);
00097 
00098         for (sint i = 0; i < size; i++)
00099         {
00100                 string name;
00101                 msgin.serial (name);
00102                 nldebug ("LNETL3NB_ASSOC:  sending association '%s' -> %d", name.c_str (), netbase._OutputSIDA.getId(name));
00103 
00104                 // if this assert occurs, it means that the other side ask an unknown message
00105                 // or that there are different types of client (with differents callbackarray) and one of the client doesn't have this callback
00106                 nlassert(netbase._OutputSIDA.getId(name) != -1);
00107 
00108                 msgout.serial (name);
00109 
00110                 CStringIdArray::TStringId id = netbase._OutputSIDA.getId (name);
00111                 msgout.serial (id);
00112         }
00113         // send the message to the other side
00114         netbase.send (msgout, from);
00115 }

void cbnbMessageRecvAssociations CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
 

Definition at line 55 of file callback_net_base.cpp.

References NLMISC::CStringIdArray::addString(), NLNET::CCallbackNetBase::getSIDA(), nlassert, nldebug, NLMISC::CMemStream::serial(), size, TSockId, and NLMISC::CStringIdArray::TStringId.

Referenced by cbcMessageRecvAllAssociations().

00056 {
00057         // receive a new message association
00058 
00059         CStringIdArray::TStringId size;
00060         msgin.serial (size);
00061 
00062         nldebug ("LNETL3NB_ASSOC: The other side gave me %d association strings", size);
00063 
00064         for (CStringIdArray::TStringId i = 0; i < size; i++)
00065         {
00066                 std::string name;
00067                 CStringIdArray::TStringId id;
00068 
00069                 msgin.serial (name);
00070                 msgin.serial (id);
00071 
00072                 // if id == -1, it means that there are no callback associated to this message
00073                 // it should not happen, it mean that one side send a message that the other side
00074                 // can't manage in his callbackarray.
00075                 // to resolve the problem, add the callback in the callbackarray in the other side
00076                 // and put NULL if you don't want to manage this message
00077                 nlassert (id != -1);
00078 
00079                 nldebug ("LNETL3NB_ASSOC:  association '%s' -> %d", name.c_str (), id);
00080                 netbase.getSIDA().addString (name, id);
00081         }
00082 }

void cbnbNewDisconnection TSockId  from,
void *  data
 

Definition at line 127 of file callback_net_base.cpp.

References NLNET::CCallbackNetBase::_DisconnectionCallback, NLNET::CCallbackNetBase::_DisconnectionCbArg, data, from, nlassert, nldebug, and TSockId.

Referenced by NLNET::CCallbackNetBase::CCallbackNetBase().

00128 {
00129         nlassert (data != NULL);
00130         CCallbackNetBase *base = (CCallbackNetBase *)data;
00131 
00132         nldebug("LNETL3NB: cbnbNewDisconnection()");
00133 
00134 #ifdef USE_MESSAGE_RECORDER
00135         // Record or replay disconnection
00136         base->noticeDisconnection( from );
00137 #endif
00138         
00139         // Call the client callback if necessary
00140         if (base->_DisconnectionCallback != NULL)
00141                 base->_DisconnectionCallback (from, base->_DisconnectionCbArg);
00142 }

void cbPacsAnswer CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
[static]
 

Definition at line 495 of file pacs_client.h.

References from, NLNET::CPacsClient::getPositionSpeedCallback(), NLNET::CPacsClient::messageCallback(), nlassert, NLMISC::nlError(), NLNET_PACS_PROTOCOL_VERSION, NLNET::CPacsClient::rayTestCallback(), NLMISC::CMemStream::serial(), NLMISC::IStream::serialCheck(), NLMISC::CMemStream::serialCont(), NLNET::CPacsClient::testMoveCallback(), NLNET::CPacsClient::triggerCallback(), TSockId, NLPACS::UMovePrimitive::TUserData, uint, and uint32.

00496 {
00497         // Get the client pointer
00498         CPacsClient *client=(CPacsClient*)(uint)from->appId ();
00499 
00500         // Check stream
00501         msgin.serialCheck ((uint32)NLNET_PACS_PROTOCOL_VERSION);
00502 
00503         // Message callback
00504         client->messageCallback ();
00505 
00506         bool again;
00507         msgin.serial (again);
00508         
00509         while (again)
00510         {
00511                 // Read the message sub string
00512                 std::string subMessage;
00513                 msgin.serial (subMessage);
00514 
00515                 // This code can work only if sizeof (uint) == sizeof (void*)
00516                 nlassert (sizeof (uint)==sizeof (void*));
00517 
00518                 // Raytrace callback ?
00519                 if (subMessage=="RY")
00520                 {
00521                         // Read test id and test result
00522                         uint32 testId;
00523                         bool testResult;
00524                         msgin.serial (testId, testResult);
00525 
00526                         // Call the callback
00527                         client->rayTestCallback (testId, testResult);
00528                 }
00529                 // Trigger callback ?
00530                 else if (subMessage=="TR")
00531                 {
00532                         // Read eval id and trigger info
00533                         uint32 evalId;
00534                         std::vector<NLPACS::UTriggerInfo> triggerInfo;
00535                         msgin.serial (evalId);
00536                         msgin.serialCont (triggerInfo);
00537 
00538                         // Call the callback
00539                         client->triggerCallback (evalId, triggerInfo);
00540                 }
00541                 // Test move callback ?
00542                 else if (subMessage=="TM")
00543                 {
00544                         // Read the primitive id and test result
00545                         NLPACS::UMovePrimitive::TUserData id;
00546                         bool testResult;
00547                         msgin.serial (id, testResult);
00548                         
00549                         // Call the callback    
00550                         client->testMoveCallback (id, testResult);
00551                 }
00552                 // Test move callback ?
00553                 else if (subMessage=="PS")
00554                 {
00555                         // Read the primitive id and test result
00556                         NLPACS::UMovePrimitive::TUserData id;
00557                         NLMISC::CVectorD position;
00558                         NLMISC::CVectorD speed;
00559                         msgin.serial (id, position, speed);
00560                         
00561                         // Call the callback    
00562                         client->getPositionSpeedCallback (id, position, speed);
00563                 }
00564                 else
00565                         NLMISC::nlError ("Pacs client: unkown sub message string");
00566 
00567                 // Next message ?
00568                 msgin.serial (again);
00569         }
00570 }

void cbQueryPort CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
[static]
 

Definition at line 109 of file naming_client.cpp.

References QueryPort, QueryPortPort, NLMISC::CMemStream::serial(), and TSockId.

00110 {
00111         msgin.serial (QueryPortPort);
00112         QueryPort = true;
00113 }

void cbReceiveShardId CMessage msgin,
const string &  serviceName,
uint16  serviceId
 

Definition at line 251 of file service.cpp.

References nlinfo, nlwarning, NLMISC::CMemStream::serial(), uint16, and uint32.

00252 {
00253         uint32  shardId;
00254         msgin.serial(shardId);
00255 
00256         if (serviceName != "WS")
00257         {
00258                 nlwarning("SERVICE: received unauthorized R_SH_ID callback from service %s-%d asking to set ShardId to %d", serviceName.c_str(), serviceId, shardId);
00259                 return;
00260         }
00261 
00262         nlinfo("SERVICE: set ShardId to %d", shardId);
00263         IService::getInstance()->_ShardId = shardId;
00264 }

void cbRegister CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
[static]
 

Definition at line 85 of file naming_client.cpp.

References cbRegisterBroadcast(), from, nlassert, Reason, Registered, RegisteredSID, RegisteredSuccess, NLMISC::CMemStream::serial(), and TSockId.

00086 {
00087         nlassert(RegisteredSID != NULL);
00088 
00089         msgin.serial (RegisteredSuccess);
00090         if (RegisteredSuccess)
00091         {
00092                 msgin.serial (*RegisteredSID);
00093 
00094                 // decode the registered services at the register process
00095                 cbRegisterBroadcast (msgin, from, netbase);
00096         }
00097         else
00098         {
00099                 msgin.serial( Reason );
00100         }
00101         Registered = true;
00102 }

void cbRegisterBroadcast CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
 

Definition at line 119 of file naming_client.cpp.

References _RegistrationBroadcastCallback, addr, nlinfo, nlstop, NLMISC::CMemStream::serial(), NLMISC::CMemStream::serialCont(), size, TServiceId, TSockId, uint16, and vectorCInetAddressToString().

Referenced by cbRegister().

00120 {
00121         TServiceId size;
00122         string name;
00123         TServiceId sid;
00124         vector<CInetAddress> addr;
00125 
00126         msgin.serial (size);
00127 
00128         for (TServiceId i = 0; i < size; i++)
00129         {
00130                 msgin.serial (name);
00131                 msgin.serial (sid);
00132                 msgin.serialCont (addr);
00133 
00134                 // add it in the list
00135 
00136                 std::vector<CInetAddress> addrs;
00137                 CNamingClient::find (sid, addrs);
00138 
00139                 if (addrs.size() == 0)
00140                 {
00141                         CNamingClient::RegisteredServicesMutex.enter ();
00142                         CNamingClient::RegisteredServices.push_back (CNamingClient::CServiceEntry (name, sid, addr));
00143                         CNamingClient::RegisteredServicesMutex.leave ();
00144 
00145                         nlinfo ("NC: Registration Broadcast of the service %s-%hu '%s'", name.c_str(), (uint16)sid, vectorCInetAddressToString(addr).c_str());
00146 
00147                         if (_RegistrationBroadcastCallback != NULL)
00148                                 _RegistrationBroadcastCallback (name, sid, addr);
00149                 }
00150                 else if (addrs.size() == 1)
00151                 {
00152                         CNamingClient::RegisteredServicesMutex.enter ();
00153                         for (std::list<CNamingClient::CServiceEntry>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++)
00154                         {
00155                                 if (sid == (*it).SId)
00156                                 {
00157                                         (*it).Name = name;
00158                                         (*it).Addr = addr;
00159                                         break;
00160                                 }
00161                         }
00162                         CNamingClient::RegisteredServicesMutex.leave ();
00163                         nlinfo ("NC: Registration Broadcast (update) of the service %s-%hu '%s'", name.c_str(), (uint16)sid, addr[0].asString().c_str());
00164                 }
00165                 else
00166                 {
00167                         nlstop;
00168                 }
00169         }
00170 
00171 //      FirstRegisteredBroadcast = true;
00172 
00173         //CNamingClient::displayRegisteredServices ();
00174 }

void cbServerAskUniversalTime CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
[static]
 

Definition at line 262 of file unitime.cpp.

References NLNET::CInetAddress::asString(), from, NLNET::CCallbackNetBase::getSIDA(), NLNET::CCallbackNetBase::hostAddress(), NL_I64, nlinfo, nlstop, NLNET::CCallbackNetBase::send(), NLMISC::CMemStream::serial(), TSockId, and NLMISC::TTime.

00263 {
00264         nlstop;
00265         TTime ut = _CUniTime::getUniTime ();
00266 
00267         // afficher l adresse de celui qui demande
00268         nlinfo("UT: Send the universal time %"NL_I64"d to '%s'", ut, netbase.hostAddress(from).asString().c_str());
00269         
00270         CMessage msgout (netbase.getSIDA(), "GUT");
00271         msgout.serial (ut);
00272         netbase.send (msgout, from);
00273 }

void cbServGetView CMessage msgin,
const std::string &  serviceName,
uint16  sid
[static]
 

Definition at line 112 of file admin.cpp.

References nlassert, Requests, NLMISC::CMemStream::serial(), serviceGetView(), uint16, and uint32.

00113 {
00114         uint32 rid;
00115         string rawvarpath;
00116 
00117         msgin.serial (rid);
00118         msgin.serial (rawvarpath);
00119 
00120         Requests.push_back (CRequest(rid, sid));
00121 
00122         vector<pair<vector<string>, vector<string> > > answer;
00123         // just send the view in async mode, don't retrieve the answer
00124         serviceGetView (rid, rawvarpath, answer, true);
00125         nlassert (answer.empty());
00126 
00127 /*
00128         CMessage msgout("VIEW");
00129         msgout.serial(rid);
00130         
00131         for (uint i = 0; i < answer.size(); i++)
00132         {
00133                 msgout.serialCont (answer[i].first);
00134                 msgout.serialCont (answer[i].second);
00135         }
00136         
00137         CUnifiedNetwork::getInstance ()->send (sid, msgout);
00138         nlinfo ("ADMIN: Sent result view to service '%s-%hu'", serviceName.c_str(), sid);
00139 */
00140 
00141 }

void cbShardValidate CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
 

Definition at line 48 of file login_client.cpp.

References NLMISC::CMemStream::serial(), ShardValidate, ShardValidateReason, and TSockId.

00049 {
00050         //
00051         // S14: receive "SV" message from FES
00052         //
00053 
00054         msgin.serial (ShardValidateReason);
00055         ShardValidate = true;
00056 }

void cbShardValidation CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
 

Definition at line 181 of file login_server.cpp.

References AcceptInvalidCookie, NLNET::CInetAddress::asString(), NLNET::CCallbackNetBase::authorizeOnly(), NLNET::CCallbackNetBase::disconnect(), from, NLNET::CCallbackNetBase::getSIDA(), NLNET::CLoginCookie::getUserId(), NLNET::CCallbackNetBase::hostAddress(), ModeTcp, NewClientCallback, nlwarning, NLNET::CCallbackNetBase::send(), NLMISC::CMemStream::serial(), Server, NLNET::CLoginCookie::set(), NLNET::CLoginCookie::toString(), TSockId, uint32, and UserIdSockAssociations.

00182 {
00183         //
00184         // S13: receive "SV" message from client
00185         //
00186 
00187         // the client send me a cookie
00188         CLoginCookie cookie;
00189         string reason;
00190         msgin.serial (cookie);
00191 
00192         string userName, userPriv;
00193         // verify that the user was pending
00194         reason = CLoginServer::isValidCookie (cookie, userName, userPriv);
00195 
00196         // if the cookie is not valid and we accept them, clear the error
00197         if(AcceptInvalidCookie && !reason.empty())
00198         {
00199                 reason = "";
00200                 cookie.set (rand(), rand(), rand());
00201         }
00202 
00203         CMessage msgout2 (netbase.getSIDA (), "SV");
00204         msgout2.serial (reason);
00205         netbase.send (msgout2, from);
00206         
00207         if (!reason.empty())
00208         {
00209                 nlwarning ("LS: User (%s) is not in the pending user list (cookie:%s)", netbase.hostAddress(from).asString().c_str(), cookie.toString().c_str());
00210                 // deconnect him
00211                 netbase.disconnect (from);
00212         }
00213         else
00214         {
00215                 // add the user association
00216                 uint32 userid = cookie.getUserId();
00217 
00218                 if (ModeTcp)
00219                         UserIdSockAssociations.insert (make_pair(userid, from));
00220 
00221                 // identification OK, let's call the user callback
00222                 if (NewClientCallback != NULL)
00223                         NewClientCallback (from, cookie);
00224 
00225                 // ok, now, he can call all callback
00226                 Server->authorizeOnly (NULL, from);
00227         }
00228 }

void cbSimVar CConfigFile::CVar var  ) 
 

Definition at line 191 of file udp_sim_sock.cpp.

References NLMISC::CConfigFile::CVar::asInt(), NLMISC::CConfigFile::CVar::Name, and nlstop.

Referenced by NLNET::CUdpSimSock::setSimValues().

00192 {
00193              if (var.Name == "SimInLag") CUdpSimSock::_InLag = var.asInt ();
00194         else if (var.Name == "SimInPacketLost") CUdpSimSock::_InPacketLoss = var.asInt ();
00195         else if (var.Name == "SimOutLag") CUdpSimSock::_OutLag = var.asInt ();
00196         else if (var.Name == "SimOutPacketLost") CUdpSimSock::_OutPacketLoss = var.asInt ();
00197         else if (var.Name == "SimOutPacketDuplication") CUdpSimSock::_OutPacketDuplication = var.asInt ();
00198         else if (var.Name == "SimOutPacketDisordering") CUdpSimSock::_OutPacketDisordering = var.asInt ();
00199         else nlstop;
00200 }

void cbsNewConnection TSockId  from,
void *  data
 

Definition at line 45 of file callback_server.cpp.

References NLNET::CCallbackServer::_ConnectionCallback, NLNET::CCallbackServer::_ConnectionCbArg, data, from, nlassert, nldebug, and TSockId.

Referenced by NLNET::CCallbackServer::CCallbackServer().

00046 {
00047         nlassert (data != NULL);
00048         CCallbackServer *server = (CCallbackServer *)data;
00049 
00050         nldebug("LNETL3S: newConnection()");
00051 
00052 #ifdef USE_MESSAGE_RECORDER
00053         // Record connection
00054         server->noticeConnection( from );
00055 #endif
00056 
00057         // send all my association to the new client
00058 // association are disactivated so we don t need to send them
00059 //      server->sendAllMyAssociations (from);
00060 
00061         // call the client callback if necessary
00062         if (server->_ConnectionCallback != NULL)
00063                 server->_ConnectionCallback (from, server->_ConnectionCbArg);
00064 }

void cbStopService CMessage msgin,
const std::string &  serviceName,
uint16  sid
[static]
 

Definition at line 162 of file admin.cpp.

References nlinfo, and uint16.

00163 {
00164         nlinfo ("ADMIN: Receive a stop from service %s-%d, need to quit", serviceName.c_str(), sid);
00165         IService::getInstance()->exit (0xFFFF);
00166 }

void cbTCReceiveMessage CMessage msgin,
const string &  name,
uint16  sid
 

Definition at line 254 of file transport_class.cpp.

References nlassert, nldebug, nlwarning, uint16, and uint8.

00255 {
00256         nldebug ("NETTC: cbReceiveMessage");
00257 
00258         CTransportClass::TempMessage.clear();
00259         CTransportClass::TempMessage.assignFromSubMessage( msgin );
00260 
00261         string className;
00262         CTransportClass::TempMessage.serial (className);
00263 
00264         CTransportClass::TRegisteredClass::iterator it = CTransportClass::LocalRegisteredClass.find (className);
00265         if (it == CTransportClass::LocalRegisteredClass.end ())
00266         {
00267                 nlwarning ("NETTC: Receive unknown transport class '%s' received from %s-%hu", className.c_str(), name.c_str(), sid);
00268                 return;
00269         }
00270 
00271         nlassert ((*it).second.Instance != NULL);
00272         
00273         if (!(*it).second.Instance->read (name, (uint8)sid))
00274         {
00275                 nlwarning ("NETTC: Can't read the transportclass '%s' received from %s-%hu", className.c_str(), name.c_str(), sid);
00276         }
00277 }

void cbTCReceiveOtherSideClass CMessage msgin,
const string &  name,
uint16  sid
 

Definition at line 279 of file transport_class.cpp.

References nldebug, NLMISC::CMemStream::serial(), NLMISC::IStream::serialEnum(), typeToString(), uint, uint16, uint32, and uint8.

00280 {
00281         nldebug ("NETTC: cbReceiveOtherSideClass");
00282 
00283         CTransportClass::TOtherSideRegisteredClass osrc;
00284 
00285         uint32 nbClass;
00286         msgin.serial (nbClass);
00287 
00288         nldebug ("NETTC: %d class", nbClass);
00289 
00290         for (uint i = 0; i < nbClass; i++)
00291         {
00292                 string className;
00293                 msgin.serial (className);
00294 
00295                 osrc.push_back(make_pair (className, vector<CTransportClass::CRegisteredBaseProp>()));
00296 
00297                 uint32 nbProp;
00298                 msgin.serial (nbProp);
00299 
00300                 nldebug ("NETTC:   %s (%d prop)", className.c_str(), nbProp);
00301 
00302                 for (uint j = 0; j < nbProp; j++)
00303                 {
00304                         CTransportClass::CRegisteredBaseProp prop;
00305                         msgin.serial (prop.Name);
00306                         msgin.serialEnum (prop.Type);
00307                         nldebug ("NETTC:     %s %s", prop.Name.c_str(), typeToString(prop.Type).c_str());
00308                         osrc[osrc.size()-1].second.push_back (prop);
00309                 }
00310         }
00311 
00312         // we have the good structure
00313         CTransportClass::registerOtherSideClass ((uint8)sid, osrc);
00314 }

void cbTCUpService const std::string &  serviceName,
uint16  sid,
void *  arg
 

Definition at line 322 of file transport_class.cpp.

References nldebug, uint16, and uint8.

Referenced by NLNET::CTransportClass::init().

00323 {
00324         nldebug ("NETTC: CTransportClass Service %s %d is up", serviceName.c_str(), sid);
00325         if (sid >= 256)
00326                 return;
00327         CTransportClass::sendLocalRegisteredClass ((uint8)sid);
00328 }

void cbUnregisterBroadcast CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
 

Definition at line 178 of file naming_client.cpp.

References _UnregistrationBroadcastCallback, nlassertex, nlinfo, nlwarning, NLMISC::CMemStream::serial(), TServiceId, TSockId, and uint16.

00179 {
00180         string name;
00181         TServiceId sid;
00182         vector<CInetAddress> addrs;
00183 
00184         msgin.serial (name);
00185         msgin.serial (sid);
00186 
00187         // remove it in the list, if the service is not found, ignore it
00188 
00189         CNamingClient::RegisteredServicesMutex.enter ();
00190         for (std::list<CNamingClient::CServiceEntry>::iterator it = CNamingClient::RegisteredServices.begin(); it != CNamingClient::RegisteredServices.end (); it++)
00191         {
00192                 if ((*it).SId == sid)
00193                 {
00194                         // check the structure
00195                         nlassertex ((*it).Name == name, ("%s %s",(*it).Name.c_str(), name.c_str()));
00196 
00197                         addrs = (*it).Addr;
00198 
00199                         CNamingClient::RegisteredServices.erase (it);
00200                         break;
00201                 }
00202         }
00203         CNamingClient::RegisteredServicesMutex.leave ();
00204 
00205         nlinfo ("NC: Unregistration Broadcast of the service %s-%hu", name.c_str(), (uint16)sid);
00206 
00207         // send the ACK to the NS
00208 
00209         CMessage msgout (CNamingClient::_Connection->getSIDA(), "ACK_UNI");
00210         msgout.serial (sid);
00211         CNamingClient::_Connection->send (msgout);
00212 
00213         // oh my god, it s my sid! but i m alive, why this f*cking naming service want to kill me? ok, i leave it alone!
00214         if(CNamingClient::_MySId == sid)
00215         {
00216                 nlwarning ("NC: Naming Service asked me to leave, I leave!");
00217                 IService::getInstance()->exit();
00218                 return;
00219         }
00220 
00221         if (_UnregistrationBroadcastCallback != NULL)
00222                 _UnregistrationBroadcastCallback (name, sid, addrs);
00223 
00224         //CNamingClient::displayRegisteredServices ();
00225 }

void cbWSChooseShard CMessage msgin,
const std::string &  serviceName,
uint16  sid
 

Definition at line 100 of file login_server.cpp.

References ListenAddr, nlinfo, nlwarning, PendingUsers, refreshPendingList(), NLMISC::CMemStream::serial(), NLNET::CLoginCookie::toString(), and uint16.

00101 {
00102         // the WS call me that a new client want to come in my shard
00103         string reason, userName, userPriv;
00104         CLoginCookie cookie;
00105 
00106         refreshPendingList ();
00107 
00108         //
00109         // S08: receive "CS" message from WS and send "SCS" message to WS
00110         //
00111 
00112         msgin.serial (cookie);
00113         msgin.serial (userName, userPriv);
00114         
00115         list<CPendingUser>::iterator it;
00116         for (it = PendingUsers.begin(); it != PendingUsers.end (); it++)
00117         {
00118                 if ((*it).Cookie == cookie)
00119                 {
00120                         // the cookie already exists, erase it and return false
00121                         nlwarning ("LS: Cookie %s is already in the pending user list", cookie.toString().c_str());
00122                         PendingUsers.erase (it);
00123                         reason = "cookie already exists";
00124                         break;
00125                 }
00126         }
00127         if (it == PendingUsers.end ())
00128         {
00129                 // add it to the awaiting client
00130                 nlinfo ("LS: New cookie %s (name '%s' priv '%s') inserted in the pending user list (awaiting new client)", cookie.toString().c_str(), userName.c_str(), userPriv.c_str());
00131                 PendingUsers.push_back (CPendingUser (cookie, userName, userPriv));
00132                 reason = "";
00133         }
00134 
00135         CMessage msgout ("SCS");
00136         msgout.serial (reason);
00137         msgout.serial (cookie);
00138         msgout.serial (ListenAddr);
00139         CUnifiedNetwork::getInstance()->send ("WS", msgout);
00140 }

void cbWSDisconnectClient CMessage msgin,
const std::string &  serviceName,
uint16  sid
 

Definition at line 142 of file login_server.cpp.

References NLNET::CCallbackServer::disconnect(), DisconnectClientCallback, ModeTcp, nlinfo, nlwarning, NLMISC::CMemStream::serial(), Server, uint16, uint32, and UserIdSockAssociations.

00143 {
00144         // the WS tells me that i have to disconnect a client
00145 
00146         uint32 userid;
00147         msgin.serial (userid);
00148 
00149         if (ModeTcp)
00150         {
00151                 map<uint32, TSockId>::iterator it = UserIdSockAssociations.find (userid);
00152                 if (it == UserIdSockAssociations.end ())
00153                 {
00154                         nlwarning ("LS: Can't disconnect the user %d, he is not found", userid);
00155                 }
00156                 else
00157                 {
00158                         nlinfo ("LS: Disconnect the user %d", userid);
00159                         Server->disconnect ((*it).second);
00160                 }
00161         }
00162 
00163         if (DisconnectClientCallback != NULL)
00164         {
00165                 DisconnectClientCallback (userid);
00166         }
00167 }

void cfcbAcceptInvalidCookie CConfigFile::CVar var  ) 
 

Definition at line 272 of file login_server.cpp.

References AcceptInvalidCookie, NLMISC::CConfigFile::CVar::asInt(), and nlinfo.

Referenced by NLNET::CLoginServer::init().

00273 {
00274         // set the new ListenAddr
00275         AcceptInvalidCookie = var.asInt() == 1;
00276         
00277         nlinfo("LS: This service %saccept invalid cookie", AcceptInvalidCookie?"":"doesn't ");
00278 }

void cfcbDefaultUserPriv CConfigFile::CVar var  ) 
 

Definition at line 264 of file login_server.cpp.

References NLMISC::CConfigFile::CVar::asString(), DefaultUserPriv, and nlinfo.

Referenced by NLNET::CLoginServer::init().

00265 {
00266         // set the new ListenAddr
00267         DefaultUserPriv = var.asString();
00268         
00269         nlinfo("LS: The default user priv is '%s'", DefaultUserPriv.c_str());
00270 }

void cfcbListenAddress CConfigFile::CVar var  ) 
 

Definition at line 259 of file login_server.cpp.

References NLMISC::CConfigFile::CVar::asString(), and setListenAddress().

Referenced by NLNET::CLoginServer::init().

00260 {
00261         setListenAddress (var.asString());
00262 }

void cfcbTimeBeforeEraseCookie CConfigFile::CVar var  ) 
 

Definition at line 280 of file login_server.cpp.

References NLMISC::CConfigFile::CVar::asInt(), nlinfo, and TimeBeforeEraseCookie.

Referenced by NLNET::CLoginServer::init().

00281 {
00282         // set the new ListenAddr
00283         TimeBeforeEraseCookie = var.asInt();
00284         
00285         nlinfo("LS: This service will remove cookie after %d seconds", TimeBeforeEraseCookie);
00286 }

void cleanRequest  )  [static]
 

Definition at line 310 of file admin.cpp.

References NLMISC::CLog::displayRaw(), NLMISC::CLog::displayRawNL(), NLMISC::InfoLog, nldebug, nlinfo, nlwarning, Requests, RequestTimeout, NLMISC::CMemStream::serial(), NLMISC::CMemStream::serialCont(), uint, and uint32.

Referenced by updateAdmin().

00311 {
00312         uint32 currentTime = CTime::getSecondsSince1970 ();
00313 
00314         for (uint i = 0 ; i < Requests.size ();)
00315         {
00316                 // timeout
00317                 if (currentTime >= Requests[i].Time+RequestTimeout)
00318                 {
00319                         nlwarning ("ADMIN: **** i %d rid %d -> Requests[i].NbWaiting (%d) != Requests[i].NbReceived (%d)", i, Requests[i].Id, Requests[i].NbWaiting, Requests[i].NbReceived);
00320                         Requests[i].NbWaiting = Requests[i].NbReceived;
00321                 }
00322 
00323                 if (Requests[i].NbWaiting <= Requests[i].NbReceived)
00324                 {
00325                         // the request is over, send to the php
00326 
00327                         CMessage msgout("VIEW");
00328                         msgout.serial (Requests[i].Id);
00329 
00330                         for (uint j = 0; j < Requests[i].Answers.size (); j++)
00331                         {
00332                                 msgout.serialCont (Requests[i].Answers[j].first);
00333                                 msgout.serialCont (Requests[i].Answers[j].second);
00334                         }
00335 
00336                         if (Requests[i].SId == 0)
00337                         {
00338                                 nlinfo ("ADMIN: Receive an answer for the fake request %d with %d answers", Requests[i].Id, Requests[i].Answers.size ());
00339                                 for (uint j = 0; j < Requests[i].Answers.size (); j++)
00340                                 {
00341                                         uint k;
00342                                         for (k = 0; k < Requests[i].Answers[j].first.size(); k++)
00343                                         {
00344                                                 InfoLog->displayRaw ("%-10s", Requests[i].Answers[j].first[k].c_str());
00345                                         }
00346                                         InfoLog->displayRawNL("");
00347                                         for (k = 0; k < Requests[i].Answers[j].second.size(); k++)
00348                                         {
00349                                                 InfoLog->displayRaw ("%-10s", Requests[i].Answers[j].second[k].c_str());
00350                                         }
00351                                         InfoLog->displayRawNL("");
00352                                         InfoLog->displayRawNL("-------------------------");
00353                                 }       
00354                         }
00355                         else
00356                         {
00357                                 nlinfo ("ADMIN: The request is over, send the result to AES");
00358                                 CUnifiedNetwork::getInstance ()->send (Requests[i].SId, msgout);
00359                         }
00360 
00361                         // set to 0 to erase it
00362                         Requests[i].NbWaiting = 0;
00363                         nldebug ("ADMIN: ++ i %d rid %d NbWaiting0 %d NbReceived %d", i, Requests[i].Id, Requests[i].NbWaiting, Requests[i].NbReceived);
00364                 }
00365 
00366                 if (Requests[i].NbWaiting == 0)
00367                 {
00368                         Requests.erase (Requests.begin ()+i);
00369                 }
00370                 else
00371                 {
00372                         i++;
00373                 }
00374         }
00375 }

void ClientConnection TSockId  from,
void *  arg
 

Definition at line 230 of file login_server.cpp.

References NLNET::CCallbackNetBase::authorizeOnly(), from, nldebug, Server, and TSockId.

Referenced by NLNET::CLoginServer::init().

00231 {
00232         nldebug("LS: new client connection: %s", from->asString ().c_str ());
00233 
00234         // the client could only call "SV" message
00235         Server->authorizeOnly ("SV", from);
00236 }

bool createMessage CMessage msgout,
const vector< string > &  args,
CLog &  log
 

Definition at line 1892 of file unified_network.cpp.

References NLMISC::CLog::displayNL(), NLMISC::CEntityId::fromString(), NLMISC::CMemStream::serial(), sint16, sint32, sint64, sint8, type, uint, uint16, uint32, uint64, uint8, v, and value.

Referenced by NLMISC_COMMAND().

01893 {
01894         for (uint i = 2; i < args.size (); i+=2)
01895         {
01896                 string type = args[i+0];
01897                 string value = args[i+1];
01898 
01899                          if (type == "s8")                      { sint8  v = atoi(value.c_str()); msgout.serial (v); }
01900                 else if (type == "s16")                 { sint16 v = atoi(value.c_str()); msgout.serial (v); }
01901                 else if (type == "s32")                 { sint32 v = atoi(value.c_str()); msgout.serial (v); }
01902                 else if (type == "s64")                 { sint64 v = atoi(value.c_str()); msgout.serial (v); }
01903                 else if (type == "u8")                  { uint8  v = atoi(value.c_str()); msgout.serial (v); }
01904                 else if (type == "u16")                 { uint16 v = atoi(value.c_str()); msgout.serial (v); }
01905                 else if (type == "u32")                 { uint32 v = atoi(value.c_str()); msgout.serial (v); }
01906                 else if (type == "u64")                 { uint64 v = atoi(value.c_str()); msgout.serial (v); }
01907                 else if (type == "f")                   { float  v = (float)atof(value.c_str()); msgout.serial (v); }
01908                 else if (type == "d")                   { double v = atof(value.c_str()); msgout.serial (v); }
01909                 else if (type == "b")                   { bool v = atoi(value.c_str()) == 1; msgout.serial (v); }
01910                 else if (type == "s")                   { msgout.serial (value); }
01911                 else if (type == "e")                   { CEntityId e; e.fromString(value.c_str()); msgout.serial(e); }
01912                 else { log.displayNL ("type '%s' is not a valid type", type.c_str()); return false; }
01913         }
01914         return true;
01915 }

bool emptyRequest uint32  rid  )  [static]
 

Definition at line 298 of file admin.cpp.

References Requests, uint, and uint32.

00299 {
00300         for (uint i = 0 ; i < Requests.size (); i++)
00301         {
00302                 if (Requests[i].Id == rid && Requests[i].NbWaiting != 0)
00303                 {
00304                         return false;
00305                 }
00306         }
00307         return true;
00308 }

string NLNET::EventToString TNetworkEvent  e  ) 
 

TNetworkEvent -> string.

Definition at line 39 of file message_recorder.cpp.

References Accepting, Connecting, ConnFailing, Disconnecting, nlstop, Receiving, and Sending.

Referenced by NLNET::CMessageRecorder::checkNextOne(), and NLNET::TMessageRecord::serial().

00040 {
00041         switch ( e )
00042         {
00043         case Sending: return "SEND";
00044         case Receiving: return "RECV";
00045         case Connecting: return "CONN";
00046         case ConnFailing: return "CNFL";
00047         case Accepting: return "ACCP";
00048         case Disconnecting: return "DISC";
00049         default: nlstop; return "-ERR-";
00050         }
00051 }

void NLNET::getNameOfMessageOrTransportClass NLNET::CMessage msgin,
std::string &  msgName
 

Get the name of message (for displaying), or extract the class name if it is a transport class.

Preconditions:

  • msgin is an input message that contains a valid message

Postconditions:

  • msgin.getPos() was modified
  • msgName contains "msg %s" or "transport class %s" where s is the name of message, or the name transport class is the message is a CT_MSG

Definition at line 414 of file transport_class.cpp.

References NLNET::CMessage::getHeaderSize(), NLNET::CMessage::getName(), NLMISC::CMemStream::seek(), and NLMISC::CMemStream::serial().

00415 {
00416         if ( msgin.getName() == "CT_MSG" )
00417         {
00418                 try
00419                 {
00420                         msgin.seek( msgin.getHeaderSize(), NLMISC::IStream::begin );
00421                         msgin.serial( msgName );
00422                 }
00423                 catch ( EStreamOverflow& )
00424                 {
00425                         msgName = "<Name not found>";
00426                 }
00427                 msgName = "transport class " + msgName;
00428         }
00429         else
00430         {
00431                 msgName = "msg " + msgin.getName();
00432         }
00433 }

void NLNET::initAdmin bool  dontUseAES  ) 
 

Definition at line 636 of file admin.cpp.

References cbAESConnection(), and cbAESDisconnection().

Referenced by NLNET::IService::main().

00637 {
00638         if (!dontUseAES)
00639         {
00640                 CUnifiedNetwork::getInstance()->setServiceUpCallback ("AES", cbAESConnection, NULL);
00641                 CUnifiedNetwork::getInstance()->setServiceDownCallback ("AES", cbAESDisconnection, NULL);
00642                 CUnifiedNetwork::getInstance()->addService ("AES", CInetAddress("localhost:49997"));
00643         }
00644         CUnifiedNetwork::getInstance()->addCallbackArray (CallbackArray, sizeof(CallbackArray)/sizeof(CallbackArray[0]));
00645 }

void initSignal  )  [static]
 

Definition at line 211 of file service.cpp.

References NLMISC::getThreadId(), sigHandler(), and SignalisedThread.

Referenced by NLNET::IService::main().

00212 {
00213         SignalisedThread = getThreadId ();
00214 #ifdef NL_DEBUG
00215         // in debug mode, we only trap the SIGINT signal
00216         signal(Signal[3], sigHandler);
00217         //nldebug("Signal : %s (%d) trapped", SignalName[3], Signal[3]);
00218 #else
00219         // in release, redirect all signals
00220 /* don't redirect now because to hard to debug...
00221         for (int i = 0; i < (int)(sizeof(Signal)/sizeof(Signal[0])); i++)
00222         {
00223                 signal(Signal[i], sigHandler);
00224                 nldebug("Signal %s (%d) trapped", SignalName[i], Signal[i]);
00225         }
00226 */
00227 #endif
00228 }

std::string NLNET::internalIPAddressToString uint32  addr  ) 
 

Take an internal address and convert it to a internet dot string.

Definition at line 527 of file inet_address.cpp.

References addr, res, NLMISC::toString(), and uint32.

Referenced by NLNET::CUnifiedNetwork::addNetworkAssociation(), and NLNET::CUnifiedNetwork::displayInternalTables().

00528 {
00529         string res;
00530         res = toString((addr)&0xFF);
00531         res += ".";
00532         res += toString((addr>>8)&0xFF);
00533         res += ".";
00534         res += toString((addr>>16)&0xFF);
00535         res += ".";
00536         res += toString((addr>>24)&0xFF);
00537         return res;
00538 }

bool isRemoteCommand string &  str  ) 
 

Definition at line 378 of file admin.cpp.

Referenced by serviceGetView().

00379 {
00380         if (str.size()<2) return false;
00381         return tolower(str[0]) == 'r' && tolower(str[1]) == 'c';
00382 }

CVariable<sint32> NetSpeedLoop "NetSpeedLoop"  ,
"duration of the last user loop(in ms)"  ,
10  ,
false 
 

Referenced by NLNET::IService::main().

NLMISC::CMutex nettrace_mutex "nettrace_mutex"   ) 
 

NLMISC_COMMAND isServiceLocal  ,
"Says if a service is local or not compare with this service"  ,
"< sid >|< service name >" 
 

Definition at line 2156 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::_SId, NLNET::CUnifiedNetwork::isServiceLocal(), and uint16.

02157 {
02158         if(args.size() != 1) return false;
02159 
02160         if (!CUnifiedNetwork::isUsed ())
02161         {
02162                 log.displayNL("Can't do that because the service doesn't use CUnifiedNetwork");
02163                 return false;
02164         }
02165 
02166         uint16 sid = atoi (args[0].c_str ());
02167         if (sid > 0)
02168         {
02169                 log.displayNL ("Service %s-%hu and sid %s are %son the same computer", CUnifiedNetwork::getInstance ()->_Name.c_str(), (uint16)CUnifiedNetwork::getInstance ()->_SId, args[0].c_str(), CUnifiedNetwork::getInstance ()->isServiceLocal (sid)?"":"not ");
02170         }
02171         else
02172         {
02173                 log.displayNL ("Service %s-%hu and %s are %son the same computer", CUnifiedNetwork::getInstance ()->_Name.c_str(), (uint16)CUnifiedNetwork::getInstance ()->_SId, args[0].c_str(), CUnifiedNetwork::getInstance ()->isServiceLocal (args[0])?"":"not ");
02174         }
02175 
02176         return true;
02177 }

NLMISC_COMMAND l5Callback  ,
"Displays all callback registered in layer5"  ,
"" 
 

Definition at line 2136 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::_Callbacks, and uint.

02137 {
02138         if(args.size() != 0) return false;
02139 
02140         if (!CUnifiedNetwork::isUsed ())
02141         {
02142                 log.displayNL("Can't display internal table because layer5 is not used");
02143                 return false;
02144         }
02145         
02146         log.displayNL ("There're %d registered callbacks:", CUnifiedNetwork::getInstance()->_Callbacks.size());
02147         uint i = 0;
02148         for (CUnifiedNetwork::TMsgMappedCallback::iterator it = CUnifiedNetwork::getInstance()->_Callbacks.begin(); it != CUnifiedNetwork::getInstance()->_Callbacks.end(); it++)
02149         {
02150                 log.displayNL (" %d '%s' %s", i++, (*it).first.c_str(), ((*it).second == NULL?"have a NULL address":""));
02151         }
02152         
02153         return true;
02154 }

NLMISC_COMMAND l5InternalTables  ,
"Displays internal table of network layer5"  ,
"" 
 

Definition at line 2121 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::displayInternalTables().

02122 {
02123         if(args.size() != 0) return false;
02124 
02125         if (!CUnifiedNetwork::isUsed ())
02126         {
02127                 log.displayNL("Can't display internal table because layer5 is not used");
02128                 return false;
02129         }
02130 
02131         CUnifiedNetwork::getInstance ()->displayInternalTables(&log);
02132 
02133         return true;
02134 }

NLMISC_COMMAND l5QueuesStats  ,
"Displays queues stats of network layer5"  ,
"" 
 

Definition at line 2098 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::_IdCnx, and uint.

02099 {
02100         if(args.size() != 0) return false;
02101         
02102         if (!CUnifiedNetwork::isUsed ())
02103         {
02104                 log.displayNL("Can't display internal table because layer5 is not used");
02105                 return false;
02106         }
02107         
02108         log.displayNL ("%u Unified Connections:", CUnifiedNetwork::getInstance()->_IdCnx.size ());
02109         for (uint i = 0; i < CUnifiedNetwork::getInstance()->_IdCnx.size (); i++)
02110         {
02111                 if(CUnifiedNetwork::getInstance()->_IdCnx[i].State != CUnifiedNetwork::CUnifiedConnection::NotUsed)
02112                 {
02113                         CUnifiedNetwork::getInstance()->_IdCnx[i].display (true, &log);
02114                 }
02115         }
02116         
02117         return true;
02118 }

NLMISC_COMMAND msgout  ,
"Send a message to a specified service(ex:msgout 128 REGISTER u32 10 b 1 f 1.5)"  ,
"< ServiceName >|< ServiceId >< MessageName > *"  [< ParamType >< Param >]
 

Definition at line 2048 of file unified_network.cpp.

References createMessage(), NLNET::CUnifiedNetwork::getNetBase(), NLNET::CCallbackNetBase::send(), TSockId, uint16, and uint8.

02048                                                                  : msgout 128 REGISTER u32 10 b 1 f 1.5)", "<ServiceName>|<ServiceId> <MessageName> [<ParamType> <Param>]*")
02049 {
02050         if(args.size() < 2) return false;
02051 
02052         if (!CUnifiedNetwork::isUsed ())
02053         {
02054                 log.displayNL("Can't do that because the service doesn't use CUnifiedNetwork");
02055                 return false;
02056         }
02057 
02058         uint16 serviceId = atoi (args[0].c_str());
02059         string serviceName = args[0].c_str();
02060         string messageName = args[1].c_str();
02061         
02062         if (serviceId > 255)
02063         {
02064                 log.displayNL ("Service Id %d must be between [1;255]", serviceId);
02065                 return false;
02066         }
02067         
02068         if ((args.size()-2) % 2 != 0)
02069         {
02070                 log.displayNL ("The number of parameter must be a multiple of 2");
02071                 return false;
02072         }
02073 
02074         CMessage msg (messageName);
02075 
02076         if (!createMessage (msg, args, log))
02077                 return false;
02078 
02079         TSockId host = InvalidSockId;
02080         CCallbackNetBase *cnb = NULL;
02081 
02082         if (serviceId != 0)
02083                 cnb = CUnifiedNetwork::getInstance()->getNetBase ((uint8)serviceId, host);
02084         else
02085                 cnb = CUnifiedNetwork::getInstance()->getNetBase (serviceName, host);
02086 
02087         if (cnb == NULL)
02088         {
02089                 log.displayNL ("'%s' is a bad <ServiceId> or <ServiceName>", args[0].c_str());
02090                 return false;
02091         }
02092 
02093         cnb->send (msg, host);
02094         
02095         return true;
02096 }

NLMISC_COMMAND msgin  ,
"Simulate an input message from another service(ex:msgin 128 REGISTER u32 10 b 1 f 1.5)"  ,
"< ServiceName >|< ServiceId >< MessageName > *"  [< ParamType >< Param >]
 

Definition at line 1983 of file unified_network.cpp.

References createMessage(), NLNET::CUnifiedNetwork::findCallback(), NLNET::CMessage::invert(), TUnifiedMsgCallback, and uint16.

01983                                                                          : msgin 128 REGISTER u32 10 b 1 f 1.5)", "<ServiceName>|<ServiceId> <MessageName> [<ParamType> <Param>]*")
01984 {
01985         if(args.size() < 2) return false;
01986         
01987         if (!CUnifiedNetwork::isUsed ())
01988         {
01989                 log.displayNL("Can't do that because the service doesn't use CUnifiedNetwork");
01990                 return false;
01991         }
01992 
01993         uint16 serviceId = atoi (args[0].c_str());
01994         string serviceName = args[0].c_str();
01995         string messageName = args[1].c_str();
01996         
01997         if (serviceId > 255)
01998         {
01999                 log.displayNL ("Service Id %d must be between [1;255]", serviceId);
02000                 return false;
02001         }
02002         
02003         if ((args.size()-2) % 2 != 0)
02004         {
02005                 log.displayNL ("The number of parameter must be a multiple of 2");
02006                 return false;
02007         }
02008 
02009         CMessage msg (messageName);
02010 //      msg.clear ();
02011 
02012         if (!createMessage (msg, args, log))
02013                 return false;
02014 
02015 
02016         msg.invert ();
02017 
02018 
02019 
02020         TUnifiedMsgCallback cb = CUnifiedNetwork::getInstance()->findCallback (messageName);
02021         
02022         if (cb == NULL)
02023         {
02024                 log.displayNL ("Callback for message '%s' is not found", messageName.c_str());
02025         }
02026         else
02027         {
02028                 cb (msg, serviceName, serviceId);
02029         }
02030         
02031                 
02032         return true;
02033 }

NLMISC_COMMAND getUnknownConfigFileVariables  ,
"display the variables from config file that are called but not present"  ,
"" 
 

Definition at line 1504 of file service.cpp.

References uint.

01505 {
01506         log.displayNL ("%d Variables not found in the configfile '%s'", IService::getInstance()->ConfigFile.UnknownVariables.size(), IService::getInstance()->ConfigFile.getFilename().c_str() );
01507         for (uint i = 0; i < IService::getInstance()->ConfigFile.UnknownVariables.size(); i++)
01508         {
01509                 log.displayNL ("  %s", IService::getInstance()->ConfigFile.UnknownVariables[i].c_str());
01510         }
01511         return true;
01512 }

NLMISC_COMMAND displayConfigFile  ,
"display the variables of the default configfile"  ,
"" 
 

Definition at line 1498 of file service.cpp.

01499 {
01500         IService::getInstance()->ConfigFile.display (&log);
01501         return true;
01502 }

NLMISC_COMMAND getWinDisplayerInfo  ,
"display the info about the pos and size of the window displayer"  ,
"" 
 

Definition at line 1490 of file service.cpp.

References uint32, w, x, and y.

01491 {
01492         uint32 x,y,w,h;
01493         IService::getInstance()->WindowDisplayer->getWindowPos (x,y,w,h);
01494         log.displayNL ("Window Displayer : XWinParam = %d; YWinParam = %d; WWinParam = %d; HWinParam = %d;", x, y, w, h);
01495         return true;
01496 }

NLMISC_COMMAND resetMeasures  ,
"reset hierarchical timer"  ,
"" 
 

Definition at line 1484 of file service.cpp.

01485 {
01486         IService::getInstance()->requireResetMeasures();
01487         return true;
01488 }

NLMISC_COMMAND serviceInfo  ,
"display information about this service"  ,
"" 
 

Definition at line 1454 of file service.cpp.

References CompilationMode, and uint.

01455 {
01456         if(args.size() != 0) return false;
01457 
01458         log.displayNL ("Service %s '%s' using NeL ("__DATE__" "__TIME__")", IService::getInstance()->getServiceLongName().c_str(), IService::getInstance()->getServiceUnifiedName().c_str());
01459         log.displayNL ("Service listening port: %d", IService::getInstance()->ListeningPort.get());
01460         log.displayNL ("Service running directory: '%s'", IService::getInstance()->RunningDirectory.c_str());
01461         log.displayNL ("Service log directory: '%s'", IService::getInstance()->LogDirectory.c_str());
01462         log.displayNL ("Service save files directory: '%s'", IService::getInstance()->SaveFilesDirectory.c_str());
01463         log.displayNL ("Service write files directory: '%s'", IService::getInstance()->WriteFilesDirectory.c_str());
01464         log.displayNL ("Service config directory: '%s' config filename: '%s.cfg'", IService::getInstance()->ConfigDirectory.c_str(), IService::getInstance()->_LongName.c_str());
01465         log.displayNL ("Service id: %d", IService::getInstance()->_SId);
01466         log.displayNL ("Service update timeout: %dms", IService::getInstance()->_UpdateTimeout);
01467         log.displayNL ("Service %suse naming service", IService::getInstance()->_DontUseNS?"don't ":"");
01468         log.displayNL ("Service %suse admin executor service", IService::getInstance()->_DontUseAES?"don't ":"");
01469         log.displayNL ("NeL is compiled in %s mode", CompilationMode.c_str());
01470 
01471         log.displayNL ("Services arguments: %d args", IService::getInstance()->_Args.size ());
01472         for (uint i = 0; i < IService::getInstance()->_Args.size (); i++)
01473         {
01474                 log.displayNL ("  argv[%d] = '%s'", i, IService::getInstance()->_Args[i].c_str ());
01475         }
01476 
01477         log.displayNL ("Naming service info: %s", CNamingClient::info().c_str());
01478 
01479         ICommand::execute ("services", log);
01480 
01481         return true;
01482 }

NLMISC_COMMAND brutalQuit  ,
"exit the service brutally"  ,
"" 
 

Definition at line 1424 of file service.cpp.

01425 {
01426         if(args.size() != 0) return false;
01427 
01428         ::exit (0xFFFFFFFF);
01429 
01430         return true;
01431 }

NLMISC_COMMAND quit  ,
"exit the service"  ,
"" 
 

Definition at line 1414 of file service.cpp.

References ExitSignalAsked.

01415 {
01416         if(args.size() != 0) return false;
01417 
01418         log.displayNL("User ask me with a command to quit");
01419         ExitSignalAsked = 0xFFFF;
01420 
01421         return true;
01422 }

NLMISC_COMMAND services  ,
"displays registered services"  ,
"" 
 

Definition at line 557 of file naming_client.cpp.

00558 {
00559         if(args.size() != 0) return false;
00560 
00561         CNamingClient::displayRegisteredServices (&log);
00562 
00563         return true;
00564 }

NLMISC_COMMAND lsPending  ,
"displays the list of all pending users"  ,
"" 
 

Definition at line 452 of file login_server.cpp.

References PendingUsers.

00453 {
00454         if(args.size() != 0) return false;
00455 
00456         log.displayNL ("Display the %d pending users :", PendingUsers.size());
00457         for (list<CPendingUser>::iterator it = PendingUsers.begin(); it != PendingUsers.end (); it++)
00458         {
00459                 log.displayNL ("> %s %s", (*it).Cookie.toString().c_str(), (*it).UserName.c_str());
00460         }
00461         log.displayNL ("End of the list");
00462 
00463         return true;
00464 }

NLMISC_COMMAND lsUsers  ,
"displays the list of all connected users"  ,
"" 
 

Definition at line 431 of file login_server.cpp.

References ModeTcp, and UserIdSockAssociations.

00432 {
00433         if(args.size() != 0) return false;
00434 
00435         if (ModeTcp)
00436         {
00437                 log.displayNL ("Display the %d connected users :", UserIdSockAssociations.size());
00438                 for (map<uint32, TSockId>::iterator it = UserIdSockAssociations.begin(); it != UserIdSockAssociations.end (); it++)
00439                 {
00440                         log.displayNL ("> %u %s", (*it).first, (*it).second->asString().c_str());
00441                 }
00442                 log.displayNL ("End of the list");
00443         }
00444         else
00445         {
00446                 log.displayNL ("No user list in udp mode");
00447         }
00448 
00449         return true;
00450 }

NLMISC_COMMAND getView  ,
"send a view and receive an array as result"  ,
"< varpath >" 
 

Definition at line 892 of file admin.cpp.

References nlassert, serviceGetView(), and uint.

00893 {
00894         if(args.size() != 1) return false;
00895         
00896         vector<pair<vector<string>, vector<string> > > answer;
00897         serviceGetView (0, args[0], answer);
00898         
00899         log.displayNL("have %d answer", answer.size());
00900         for (uint i = 0; i < answer.size(); i++)
00901         {
00902                 log.displayNL("  have %d value", answer[i].first.size());
00903                 
00904                 nlassert (answer[i].first.size() == answer[i].second.size());
00905                 
00906                 for (uint j = 0; j < answer[i].first.size(); j++)
00907                 {
00908                         log.displayNL("    %s -> %s", answer[i].first[j].c_str(), answer[i].second[j].c_str());
00909                 }
00910         }
00911         
00912         return true;
00913 }

NLMISC_COMMAND displayInformations  ,
"displays all admin informations"  ,
"" 
 

Definition at line 875 of file admin.cpp.

References Alarms, GraphUpdates, and uint.

00876 {
00877         uint i;
00878 
00879         log.displayNL("There're %d alarms:", Alarms.size());
00880         for (i = 0; i < Alarms.size(); i++)
00881         {
00882                 log.displayNL(" %d %s %d %s %s", i, Alarms[i].Name.c_str(), Alarms[i].Limit, (Alarms[i].GT?"gt":"lt"), (Alarms[i].Activated?"on":"off"));
00883         }
00884         log.displayNL("There're %d graphupdate:", GraphUpdates.size());
00885         for (i = 0; i < GraphUpdates.size(); i++)
00886         {
00887                 log.displayNL(" %d %s %d %d", i, GraphUpdates[i].Name.c_str(), GraphUpdates[i].Update, GraphUpdates[i].LastUpdate);
00888         }
00889         return true;
00890 }

NLMISC_DYNVARIABLE uint64  ,
SentBytes  ,
"total of bytes sent by this service" 
 

Definition at line 1958 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::getBytesSent(), pointer, and uint64.

01959 {
01960         if (get)
01961         {
01962                 if (!CUnifiedNetwork::isUsed ())
01963                         *pointer = 0;
01964                 else
01965                         *pointer = CUnifiedNetwork::getInstance()->getBytesSent ();
01966         }
01967 }

NLMISC_DYNVARIABLE uint64  ,
ReceivedBytes  ,
"total of bytes received by this service" 
 

Definition at line 1947 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::getBytesReceived(), pointer, and uint64.

01948 {
01949         if (get)
01950         {
01951                 if (!CUnifiedNetwork::isUsed ())
01952                         *pointer = 0;
01953                 else
01954                         *pointer = CUnifiedNetwork::getInstance()->getBytesReceived ();
01955         }
01956 }

NLMISC_DYNVARIABLE uint64  ,
ReceiveQueueSize  ,
"current size in bytes of all receive queues" 
 

Definition at line 1935 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::getReceiveQueueSize(), pointer, and uint64.

01936 {
01937         if (get)
01938         {
01939                 if (!CUnifiedNetwork::isUsed ())
01940                         *pointer = 0;
01941                 else
01942                         *pointer = CUnifiedNetwork::getInstance()->getReceiveQueueSize();
01943         }
01944 }

NLMISC_DYNVARIABLE uint64  ,
SendQueueSize  ,
"current size in bytes of all send queues" 
 

Definition at line 1924 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::getSendQueueSize(), pointer, and uint64.

01925 {
01926         if (get)
01927         {
01928                 if (!CUnifiedNetwork::isUsed ())
01929                         *pointer = 0;
01930                 else
01931                         *pointer = CUnifiedNetwork::getInstance()->getSendQueueSize();
01932         }
01933 }

NLMISC_DYNVARIABLE string  ,
State  ,
"Set this value to 0 to shutdown the service and 1 to start the service" 
 

Definition at line 1520 of file service.cpp.

References ExitSignalAsked, nlinfo, nlwarning, and pointer.

01521 {
01522         static string running = "Online";
01523 
01524         // read or write the variable
01525         if (get)
01526         {
01527                 *pointer = running;
01528         }
01529         else
01530         {
01531                 if (IService::getInstance()->getServiceShortName() == "AES" || IService::getInstance()->getServiceShortName() == "AS")
01532                 {
01533                         nlinfo ("SERVICE: I can't set State=0 because I'm the admin and I should never quit");
01534                 }
01535                 else if (*pointer == "0" || *pointer == "2")
01536                 {
01537                         // ok, we want to set the value to false, just quit
01538                         nlinfo ("SERVICE: User ask me with a command to quit using the State variable");
01539                         ExitSignalAsked = 0xFFFE;
01540                         running = "Quitting";
01541                 }
01542                 else
01543                 {
01544                         nlwarning ("SERVICE: Unknown value for State '%s'", (*pointer).c_str());
01545                 }
01546         }
01547 }

NLMISC_DYNVARIABLE string  ,
Scroller  ,
"current size in bytes of the sent queue size
 

Definition at line 1402 of file service.cpp.

References pointer.

01403 {
01404         if (get)
01405         {
01406                 // display the scroll text
01407                 static string foo =     "Welcome to NeL Service! This scroll is used to see the update frequency of the main function and to see if the service is frozen or not. Have a nice day and hope you'll like NeL!!! "
01408                                                         "Welcome to NeL Service! This scroll is used to see the update frequency of the main function and to see if the service is frozen or not. Have a nice day and hope you'll like NeL!!! ";
01409                 static int pos = 0;
01410                 *pointer = foo.substr ((pos++)%(foo.size()/2), 10);
01411         }
01412 }

NLMISC_DYNVARIABLE string  ,
Uptime  ,
"time from the launching of the program
 

Definition at line 1375 of file service.cpp.

References LaunchingDate, pointer, NLMISC::secondsToHumanReadable(), and NLMISC::toString().

01376 {
01377         if (get)
01378         {
01379                 if (human)
01380                         *pointer = secondsToHumanReadable (CTime::getSecondsSince1970() - LaunchingDate);
01381                 else
01382                         *pointer = NLMISC::toString(CTime::getSecondsSince1970() - LaunchingDate);
01383         }
01384         else
01385         {
01386                 LaunchingDate = CTime::getSecondsSince1970() - atoi ((*pointer).c_str());
01387         }
01388 }

NLMISC_DYNVARIABLE string  ,
LaunchingDate  ,
"date of the launching of the program
 

Definition at line 1370 of file service.cpp.

References LaunchingDate, and pointer.

01371 {
01372         if (get) *pointer = asctime (localtime ((time_t*)&LaunchingDate));
01373 }

NLMISC_DYNVARIABLE string  ,
LSListenAddress  ,
"the listen address sended to the client to connect on this front_end" 
 

Definition at line 467 of file login_server.cpp.

References NLNET::CInetAddress::asIPString(), ListenAddr, NLNET::CBufServer::listenAddress(), nlinfo, nlwarning, pointer, and Server.

00468 {
00469         if (get)
00470         {
00471                 *pointer = ListenAddr;
00472         }
00473         else
00474         {
00475                 if ((*pointer).find (":") == string::npos)
00476                 {
00477                         nlwarning ("LS: You must set the address + port (ie: \"itsalive.nevrax.org:38000\")");
00478                         return;
00479                 }
00480                 else if ((*pointer).empty())
00481                 {
00482                         ListenAddr = Server->listenAddress ().asIPString();
00483                 }
00484                 else
00485                 {
00486                         ListenAddr = *pointer;
00487                 }
00488                 nlinfo ("LS: Listen Address that will be send to client is '%s'", ListenAddr.c_str());
00489         }
00490 }

NLMISC_VARIABLE uint32  ,
TotalCallbackCalled  ,
"Total callback called number on layer 5" 
 

NLMISC_VARIABLE uint32  ,
NbUserUpdate  ,
"number of time the user IService::update() called" 
 

NLMISC_VARIABLE string  ,
CompilationMode  ,
"mode of the compilation" 
 

NLMISC_VARIABLE string  ,
CompilationDate  ,
"date of the compilation" 
 

NLMISC_VARIABLE string  ,
DefaultUserPriv  ,
"Default User priv for people who don't use the login system" 
 

NLMISC_VARIABLE uint32  ,
NbServerReceiveTask  ,
"Number of server receive thread" 
 

NLMISC_VARIABLE uint32  ,
NbServerListenTask  ,
"Number of server listen thread" 
 

NLMISC_VARIABLE uint32  ,
NbNetworkTask  ,
"Number of server and client thread" 
 

NLMISC_VARIABLE uint32  ,
NbClientReceiveTask  ,
"Number of client receive thread" 
 

void nmNewConnection TSockId  from,
void *  arg
[static]
 

Definition at line 62 of file net_manager.cpp.

References NLNET::CBaseStruct::ConnectionCallback, NLNET::CBaseStruct::ConnectionCbArg, from, NLNET::CBaseStruct::Name, nlassert, nldebug, and TSockId.

Referenced by NLNET::CNetManager::addServer().

00063 {
00064         nlassert (arg != NULL);
00065         CBaseStruct *basest = (CBaseStruct *)arg;
00066 
00067         nldebug("HNETL4: nmNewConnection() from service '%s'", basest->Name.c_str ());
00068 
00069         // call the client callback if necessary
00070         if (basest->ConnectionCallback != NULL)
00071                 basest->ConnectionCallback (basest->Name, from, basest->ConnectionCbArg);
00072 }

void nmNewDisconnection TSockId  from,
void *  arg
[static]
 

Definition at line 74 of file net_manager.cpp.

References NLNET::CBaseStruct::DisconnectionCallback, NLNET::CBaseStruct::DisconnectionCbArg, from, NLNET::CBaseStruct::Name, NLNET::CBaseStruct::NetBase, nlassert, nldebug, TSockId, and NLNET::CBaseStruct::Type.

Referenced by NLNET::CNetManager::addClient(), NLNET::CNetManager::addServer(), and NLNET::CNetManager::createConnection().

00075 {
00076         nlassert (arg != NULL);
00077         CBaseStruct *basest = (CBaseStruct *)arg;
00078 
00079         nldebug("HNETL4: nmNewDisconnection() from service '%s'", basest->Name.c_str ());
00080 
00081         // call the client callback if necessary
00082         if (basest->DisconnectionCallback != NULL)
00083                 basest->DisconnectionCallback (basest->Name, from, basest->DisconnectionCbArg);
00084 
00086 
00087         // on a client, we have to clear the associations
00088         if (basest->Type != CBaseStruct::Server)
00089         {
00090                 nlassert (basest->NetBase.size() == 1);
00091                 basest->NetBase[0]->getSIDA ().clear ();
00092         }
00093 }

bool operator< const CInetAddress a1,
const CInetAddress a2
 

Definition at line 153 of file inet_address.cpp.

References NLNET::CInetAddress::_SockAddr, and NLNET::CInetAddress::port().

00154 {
00155 #ifdef NL_OS_WINDOWS
00156         if ( a1._SockAddr->sin_addr.S_un.S_addr == a2._SockAddr->sin_addr.S_un.S_addr )
00157         {
00158                 return ( a1.port() < a2.port() );
00159         }
00160         else
00161         {
00162                 return ( a1._SockAddr->sin_addr.S_un.S_addr < a2._SockAddr->sin_addr.S_un.S_addr );
00163         }
00164 #elif defined NL_OS_UNIX
00165         if ( a1._SockAddr->sin_addr.s_addr == a2._SockAddr->sin_addr.s_addr )
00166         {
00167                 return ( a1.port() < a2.port() );
00168         }
00169         else
00170         {
00171                 return ( a1._SockAddr->sin_addr.s_addr < a2._SockAddr->sin_addr.s_addr );
00172         }
00173 #endif  
00174 }

bool operator== const CLoginCookie &  c1,
const CLoginCookie &  c2
 

Definition at line 40 of file login_cookie.cpp.

References NLNET::CLoginCookie::_UserAddr, NLNET::CLoginCookie::_UserId, NLNET::CLoginCookie::_UserKey, NLNET::CLoginCookie::_Valid, and nlassert.

00041 {
00042         nlassert (c1._Valid && c2._Valid);
00043 
00044         return c1._UserAddr==c2._UserAddr && c1._UserKey==c2._UserKey && c1._UserId==c2._UserId;
00045 }

bool operator== const CInetAddress a1,
const CInetAddress a2
 

Definition at line 143 of file inet_address.cpp.

References NLNET::CInetAddress::_SockAddr.

00144 {
00145         // Compares the sockaddr structure except the last 8 bytes equal to zero.
00146         return ( memcmp( a1._SockAddr, a2._SockAddr, sizeof(sockaddr_in)-8 ) == 0 );
00147 }

void refreshPendingList  ) 
 

Definition at line 79 of file login_server.cpp.

References nlinfo, PendingUsers, TimeBeforeEraseCookie, and uint32.

Referenced by cbWSChooseShard().

00080 {
00081         // delete too old cookie
00082 
00083         list<CPendingUser>::iterator it = PendingUsers.begin();
00084         uint32 Time = CTime::getSecondsSince1970();
00085         while (it != PendingUsers.end ())
00086         {
00087                 if ((*it).Time < Time - TimeBeforeEraseCookie)
00088                 {
00089                         nlinfo("LS: Removing cookie '%s' because too old", (*it).Cookie.toString().c_str());
00090                         it = PendingUsers.erase (it);
00091                 }
00092                 else
00093                 {
00094                         it++;
00095                 }
00096         }
00097 }

void RegistrationBroadcast const std::string &  name,
TServiceId  sid,
const vector< CInetAddress > &  addr
 

Definition at line 131 of file net_manager.cpp.

References addr, NLNET::CNetManager::ItBaseMap, nldebug, TServiceId, uint, and uint16.

Referenced by NLNET::CNetManager::init().

00132 {
00133         nldebug("HNETL4: RegistrationBroadcast() of service %s-%hu", name.c_str (), (uint16)sid);
00134 
00135         // find if this new service is interesting
00136         for (CNetManager::ItBaseMap itbm = CNetManager::_BaseMap.begin (); itbm != CNetManager::_BaseMap.end (); itbm++)
00137         {
00138                 if ((*itbm).second.Type == CBaseStruct::Client && !(*itbm).second.NetBase[0]->connected())
00139                 {
00140                         if (name == (*itbm).first)
00141                         {
00142                                 // ok! it's cool, the service is here, go and connect to him!
00143 // ace warning don't work if more than one connection
00144                                 CNetManager::createConnection ((*itbm).second, addr[0], name);
00145                         }
00146                 }
00147                 else if ((*itbm).second.Type == CBaseStruct::Group)
00148                 {
00149                         // ok, it's a group, try to see if it wants this!
00150                         for (uint i = 0; i < (*itbm).second.ServiceNames.size (); i++)
00151                         {
00152                                 if ((*itbm).second.ServiceNames[i] == name)
00153                                 {
00154 // ace warning don't work if more than one connection
00155                                         CNetManager::createConnection ((*itbm).second, addr[0], name);
00156                                         break;
00157                                 }
00158                         }
00159                 }
00160         }
00161 
00162 }

void sendAdminEmail char *  format,
... 
 

Definition at line 612 of file admin.cpp.

References format, nlinfo, NLMISC_CONVERT_VARGS, NLMISC::CMemStream::serial(), and t.

Referenced by updateAdmin().

00613 {
00614         char *text;
00615         NLMISC_CONVERT_VARGS (text, format, 4096);
00616         
00617         time_t t = time (&t);
00618 
00619         string str;
00620         str  = asctime (localtime (&t));
00621         str += " Server " + CInetAddress::localHost().hostName();
00622         str += " service " + IService::getInstance()->getServiceUnifiedName();
00623         str += " : ";
00624         str += text;
00625 
00626         CMessage msgout("ADMIN_EMAIL");
00627         msgout.serial (str);
00628         if(IService::getInstance ()->getServiceShortName()=="AES")
00629                 CUnifiedNetwork::getInstance ()->send ("AS", msgout);
00630         else
00631                 CUnifiedNetwork::getInstance ()->send ("AES", msgout);
00632 
00633         nlinfo ("ADMIN: Forwarded email to AS with '%s'", str.c_str());
00634 }

bool sendEmail const std::string &  smtpServer,
const std::string &  from,
const std::string &  to,
const std::string &  subject,
const std::string &  body,
const std::string &  attachedFile = "",
bool  onlyCheck = false
 

Send an email

Parameters:
smtpServer must be a smtp email server.
from must be a valid email address. If empty, create a fake email address with anonymous<ipaddress>.com
to must be a valid email address.
subject subject of the email. Can be empty.
body body of the email. Can be empty.
attachedFile a filename that will be send with the email. Can be empty.
onlyCheck If true, It'll not send the mail but only check if it could be send.

bool sendEmail const string &  smtpServer,
const string &  from,
const string &  to,
const string &  subject,
const string &  body,
const string &  attachedFile,
bool  onlyCheck
 

Definition at line 128 of file email.cpp.

References buffer, NLNET::CSock::close(), NLNET::CTcpSock::connect(), NLNET::CSock::connected(), DefaultFrom, DefaultSMTPServer, DefaultTo, from, nlwarning, sendEMailCommand(), size, NLMISC::strlwr(), uint, and uuencode().

Referenced by NLNET::IService::main().

00129 {
00130         bool ok  = false;
00131         CTcpSock sock;
00132         uint i;
00133 
00134         string formatedBody;
00135         string formatedFrom;
00136         string formatedTo;
00137         string formatedSMTPServer;
00138 
00139         try
00140         {
00141 
00142                 if (smtpServer.empty())
00143                 {
00144                         if(DefaultSMTPServer.empty())
00145                         {
00146                                 nlwarning ("EMAIL: Can't send email because no SMTPServer was provided");
00147                                 goto end;
00148                         }
00149                         else
00150                         {
00151                                 formatedSMTPServer = DefaultSMTPServer;
00152                         }
00153                 }
00154                 else
00155                 {
00156                         formatedSMTPServer = smtpServer;
00157                 }
00158 
00159                 sock.connect(CInetAddress(formatedSMTPServer, 25));
00160 
00161                 if (!sock.connected())
00162                 {
00163                         nlwarning ("EMAIL: Can't connect to email server %s", formatedSMTPServer.c_str());
00164                         goto end;
00165                 }
00166 
00167                 if (to.empty())
00168                 {
00169                         if(DefaultTo.empty())
00170                         {
00171                                 nlwarning ("EMAIL: Can't send email because no To was provided");
00172                                 goto end;
00173                         }
00174                         else
00175                         {
00176                                 formatedTo = DefaultTo;
00177                         }
00178                 }
00179                 else
00180                 {
00181                         formatedTo = to;
00182                 }
00183 
00184                 if(from.empty())
00185                 {
00186                         if (DefaultFrom.empty())
00187                         {
00188                                 formatedFrom = CInetAddress::localHost().hostName();
00189                                 formatedFrom += "@gnu.org";
00190                         }
00191                         else
00192                         {
00193                                 formatedFrom = DefaultFrom;
00194                         }
00195                 }
00196                 else
00197                 {
00198                         formatedFrom = from;
00199                 }
00200 
00201                 // we must skip the first line
00202                 formatedBody = "\r\n";
00203 
00204                 // replace \n with \r\n
00205                 for (i = 0; i < body.size(); i++)
00206                 {
00207                         if (body[i] == '\n' && i > 0 && body[i-1] != '\r')
00208                         {
00209                                 formatedBody += '\r';
00210                         }
00211                         formatedBody += body[i];
00212                 }
00213 
00214                 // add attachment if any
00215                 if (!attachedFile.empty())
00216                 {
00217                         string ext = CFile::getExtension(attachedFile);
00218 
00219                         string mimepart;
00220 
00221                         // mime header and main mail text
00222 
00223                         mimepart += "Mime-Version: 1.0\r\n";
00224                         mimepart += "Content-Type: multipart/mixed;\r\n";
00225                         mimepart += " boundary=\"Multipart_nel\"\r\n";
00226                         mimepart += "\r\n";
00227                         mimepart += "This is a multi-part message in MIME format.\r\n";
00228                         mimepart += "\r\n";
00229                         mimepart += "--Multipart_nel\r\n";
00230                         mimepart += "Content-Type: text/plain; charset=us-ascii\r\n";
00231                         mimepart += "Content-Transfer-Encoding: 7bit\r\n";
00232 
00233                         formatedBody = mimepart + formatedBody;
00234 
00235                         // mime attachment
00236 
00237                         formatedBody += "--Multipart_nel\r\n";
00238                         formatedBody += "Content-Disposition: attachment;\r\n";
00239 
00240                         if(strlwr(ext) == "tga")
00241                         {
00242                                 formatedBody += "Content-Type: image/x-targa;\r\n";
00243                         }
00244                         else if(strlwr(ext) == "bmp")
00245                         {
00246                                 formatedBody += "Content-Type: image/bmp;\r\n";
00247                         }
00248                         else if(strlwr(ext) == "png")
00249                         {
00250                                 formatedBody += "Content-Type: image/png;\r\n";
00251                         }
00252                         else if(strlwr(ext) == "jpg" || strlwr(ext) == "jpeg")
00253                         {
00254                                 formatedBody += "Content-Type: image/jpeg;\r\n";
00255                         }
00256                         else
00257                         {
00258                                 formatedBody += "Content-Type: text/plain; charset=us-ascii\r\n";
00259                         }
00260 
00261                         formatedBody += " name=\""+CFile::getFilename(attachedFile)+"\"\r\n";
00262                         formatedBody += "Content-Transfer-Encoding: base64\r\n";
00263                         formatedBody += " filename=\""+CFile::getFilename(attachedFile)+"\"\r\n";
00264                         // empty line to say that it s the end of the header
00265                         formatedBody += "\r\n";
00266 
00267                         static const size_t src_buf_size = 45;// This *MUST* be a multiple of 3
00268                         static const size_t dst_buf_size = 4 * ((src_buf_size + 2) / 3);
00269                         size_t write_size = dst_buf_size;
00270                         char src_buf[src_buf_size + 1];
00271                         char dst_buf[dst_buf_size + 1];
00272                         size_t size;
00273 
00274                         FILE *src_stream = fopen (attachedFile.c_str(), "rb");
00275                         if (src_stream == NULL)
00276                         {
00277                                 nlwarning ("EMAIL: Can't attach file '%s' to the email because the file can't be open", attachedFile.c_str());
00278                         }
00279                         else
00280                         {
00281                                 while ((size = fread(src_buf, 1, src_buf_size, src_stream)) > 0)
00282                                 {
00283                                         if (size != src_buf_size)
00284                                         {
00285                                                 /* write_size is always 60 until the last line */
00286                                                 write_size=(4 * ((size + 2) / 3));
00287                                                 /* pad with 0s so we can just encode extra bits */
00288                                                 memset(&src_buf[size], 0, src_buf_size - size);
00289                                         }
00290                                         /* Encode the buffer we just read in */
00291                                         uuencode(src_buf, dst_buf, size);
00292                                         
00293                                         formatedBody += dst_buf;
00294                                         formatedBody += "\r\n";
00295                                 }
00296                                 fclose (src_stream);
00297                         }
00298                         formatedBody += "--Multipart_nel--";
00299                 }       
00300 
00301                 // debug, display what we send into a file
00302                 //      {       FILE *fp = fopen (CFile::findNewFile("mail.txt").c_str(), "wb");
00303                 //      fwrite (formatedBody.c_str(), 1, formatedBody.size(), fp);
00304                 //      fclose (fp); }
00305                 
00306                 if(!sendEMailCommand (sock, "", 220)) goto end;
00307 
00308                 if(onlyCheck)
00309                 {
00310                         if(!sendEMailCommand (sock, "HELO localhost")) goto end;
00311                         if(!sendEMailCommand (sock, "MAIL FROM: " + formatedFrom)) goto end;
00312                         if(!sendEMailCommand (sock, "RCPT TO: " + formatedTo)) goto end;
00313                         if(!sendEMailCommand (sock, "QUIT", 221)) goto end;
00314 
00315                         ok = true;
00316                 }
00317                 else
00318                 {
00319                         if(!sendEMailCommand (sock, "HELO localhost")) goto end;
00320                         if(!sendEMailCommand (sock, "MAIL FROM: " + formatedFrom)) goto end;
00321                         if(!sendEMailCommand (sock, "RCPT TO: " + formatedTo)) goto end;
00322                         if(!sendEMailCommand (sock, "DATA", 354)) goto end;
00323                         
00324                         string buffer =
00325                                 "From: " + formatedFrom + "\r\n"
00326                                 "To: " + formatedTo + "\r\n"
00327                                 "Subject: " + subject + "\r\n"
00328                                 + formatedBody + "\r\n.";
00329                         
00330                         if(!sendEMailCommand (sock, buffer)) goto end;
00331                         if(!sendEMailCommand (sock, "QUIT", 221)) goto end;
00332 
00333                         ok = true;
00334                 }
00335         }
00336         catch (Exception &e)
00337         {
00338                 nlwarning ("EMAIL: Can't send email: %s", e.what());
00339                 goto end;
00340         }
00341 
00342 end:
00343         if (sock.connected())
00344                 sock.close ();
00345 
00346         return ok;
00347 }

bool sendEMailCommand CTcpSock &  sock,
const std::string &  command,
uint32  code = 250
 

Definition at line 86 of file email.cpp.

References NLNET::CInetAddress::asString(), buffer, nlwarning, NLNET::CSock::receive(), NLNET::CSock::remoteAddr(), res, NLNET::CSock::send(), size, uint32, and uint8.

Referenced by sendEmail().

00087 {
00088         string buffer = command + "\r\n";
00089         uint32 size = buffer.size();
00090         if(!command.empty())
00091         {
00092                 if (sock.send ((uint8 *)buffer.c_str(), size) != CSock::Ok)
00093                 {
00094                         nlwarning ("EMAIL: Can't send data to the server");
00095                         return false;
00096                 }
00097         }
00098 
00099         string res;
00100         char c;
00101         while (true)
00102         {
00103                 size = 1;
00104                 
00105                 if (sock.receive((uint8*)&c, size, false) == CSock::Ok)
00106                 {
00107                         res += c;
00108                         if (c == '\n')
00109                         {
00110                                 uint32 c = atoi (res.c_str());
00111                                 if (c != code)
00112                                 {
00113                                         nlwarning ("EMAIL: EMail command '%s' returned '%s' instead of code %d on sock %s", command.substr(0, 20).c_str(), res.substr(0, res.size()-2).c_str(), code, sock.remoteAddr().asString().c_str());
00114                                         return false;
00115                                 }
00116                                 return true;
00117                         }
00118                 }
00119                 else
00120                 {
00121                         nlwarning ("EMAIL: EMail connection closed before end of line, command '%s' returned '%s' on sock %s (code %d)", command.substr(0, 20).c_str(), res.c_str(), sock.remoteAddr().asString().c_str(), code);
00122                         return false;
00123                 }
00124         }
00125 }

void serviceGetView uint32  rid,
const std::string &  rawvarpath,
std::vector< std::pair< std::vector< std::string >, std::vector< std::string > > > &  answer,
bool  async = false
 

void serviceGetView uint32  rid,
const string &  rawvarpath,
vector< pair< vector< string >, vector< string > > > &  answer,
bool  async
 

Definition at line 386 of file admin.cpp.

References NLMISC::CLog::addDisplayer(), addRequestAnswer(), addRequestWaitingNb(), NLMISC::CMemDisplayer::clear(), CVarPath::Destination, CVarPath::empty(), CVarPath::isFinal(), isRemoteCommand(), NLMISC::CMemDisplayer::lockStrings(), nlinfo, RemoteClientCallback, NLMISC::CMemDisplayer::setParam(), size, uint, uint32, NLMISC::CMemDisplayer::unlockStrings(), value, and y.

Referenced by cbServGetView(), and NLMISC_COMMAND().

00387 {
00388         string str;
00389         CLog logDisplayVars;
00390         CLightMemDisplayer mdDisplayVars;
00391         logDisplayVars.addDisplayer (&mdDisplayVars);
00392         mdDisplayVars.setParam (1024);
00393 
00394         CVarPath varpath(rawvarpath);
00395 
00396         if (varpath.empty())
00397                 return;
00398 
00399         if (varpath.isFinal())
00400         {
00401                 vector<string> vara, vala;
00402 
00403                 // add default row
00404                 vara.push_back ("service");
00405                 vala.push_back (IService::getInstance ()->getServiceUnifiedName());
00406                 
00407                 for (uint j = 0; j < varpath.Destination.size (); j++)
00408                 {
00409                         string cmd = varpath.Destination[j].first;
00410 
00411                         // replace = with space to execute the command
00412                         uint eqpos = cmd.find("=");
00413                         if (eqpos != string::npos)
00414                         {
00415                                 cmd[eqpos] = ' ';
00416                                 vara.push_back(cmd.substr(0, eqpos));
00417                         }
00418                         else
00419                                 vara.push_back(cmd);
00420                         
00421                         mdDisplayVars.clear ();
00422                         ICommand::execute(cmd, logDisplayVars, !ICommand::isCommand(cmd));
00423                         const std::deque<std::string>   &strs = mdDisplayVars.lockStrings();
00424 
00425                         if (ICommand::isCommand(cmd))
00426                         {
00427                                 // we want the log of the command
00428                                 if (j == 0)
00429                                 {
00430                                         vara.clear ();
00431                                         vara.push_back ("__log");
00432                                         vala.clear ();
00433                                 }
00434                                 
00435                                 vala.push_back ("----- Result from "+IService::getInstance()->getServiceUnifiedName()+" of command '"+cmd+"'\n");
00436                                 for (uint k = 0; k < strs.size(); k++)
00437                                 {
00438                                         vala.push_back (strs[k]);
00439                                 }
00440                         }
00441                         else
00442                         {
00443 
00444                                 if (strs.size()>0)
00445                                 {
00446                                         str = strs[0].substr(0,strs[0].size()-1);
00447                                         // replace all spaces into udnerscore because space is a reserved char
00448                                         for (uint i = 0; i < str.size(); i++) if (str[i] == ' ') str[i] = '_';
00449                                         
00450                                 /*
00451                                         uint32 pos = strs[0].find("=");
00452                                         if(pos != string::npos && pos + 2 < strs[0].size())
00453                                         {
00454                                                 uint32 pos2 = string::npos;
00455                                                 if(strs[0][strs[0].size()-1] == '\n')
00456                                                         pos2 = strs[0].size() - pos - 2 - 1;
00457                                                 
00458                                                 str = strs[0].substr (pos+2, pos2);
00459                                                 
00460                                                 // replace all spaces into udnerscore because space is a reserved char
00461                                                 for (uint i = 0; i < str.size(); i++) if (str[i] == ' ') str[i] = '_';
00462                                         }
00463                                         else
00464                                         {
00465                                                 str = "???";
00466                                         }*/
00467                                 }
00468                                 else
00469                                 {
00470                                         str = "???";
00471                                 }
00472                                 vala.push_back (str);
00473                                 nlinfo ("ADMIN: Add to result view '%s' = '%s'", varpath.Destination[j].first.c_str(), str.c_str());
00474                         }
00475                         mdDisplayVars.unlockStrings();
00476                 }
00477 
00478                 if (!async)
00479                         answer.push_back (make_pair(vara, vala));
00480                 else
00481                 {
00482                         addRequestWaitingNb (rid);
00483                         addRequestAnswer (rid, vara, vala);
00484                 }
00485         }
00486         else
00487         {
00488                 // there s an entity in the varpath, manage this case
00489 
00490                 vector<string> *vara=0, *vala=0;
00491                 
00492                 // varpath.Destination          contains the entity number
00493                 // subvarpath.Destination       contains the command name
00494                 
00495                 for (uint i = 0; i < varpath.Destination.size (); i++)
00496                 {
00497                         CVarPath subvarpath(varpath.Destination[i].second);
00498                         
00499                         for (uint j = 0; j < subvarpath.Destination.size (); j++)
00500                         {
00501                                 // set the variable name
00502                                 string cmd = subvarpath.Destination[j].first;
00503 
00504                                 if (isRemoteCommand(cmd))
00505                                 {
00506                                         if (async && RemoteClientCallback != 0)
00507                                         {
00508                                                 // ok we have to send the request to another side, just send and wait
00509                                                 addRequestWaitingNb (rid);
00510                                                 RemoteClientCallback (rid, cmd, varpath.Destination[i].first);
00511                                         }
00512                                 }
00513                                 else
00514                                 {
00515                                         // replace = with space to execute the command
00516                                         uint eqpos = cmd.find("=");
00517                                         if (eqpos != string::npos)
00518                                         {
00519                                                 cmd[eqpos] = ' ';
00520                                                 // add the entity
00521                                                 cmd.insert(eqpos, " "+varpath.Destination[i].first);
00522                                         }
00523                                         else
00524                                         {
00525                                                 // add the entity
00526                                                 cmd += " "+varpath.Destination[i].first;
00527                                         }
00528                                         
00529                                         mdDisplayVars.clear ();
00530                                         ICommand::execute(cmd, logDisplayVars, true);
00531                                         const std::deque<std::string>   &strs = mdDisplayVars.lockStrings();
00532                                         for (uint k = 0; k < strs.size(); k++)
00533                                         {
00534                                                 const string &str = strs[k];
00535 
00536                                                 uint32 pos = str.find(" ");
00537                                                 if(pos == string::npos)
00538                                                         continue;
00539                                                 
00540                                                 string entity = str.substr(0, pos);
00541                                                 string value = str.substr(pos+1, str.size()-pos-2);
00542                                                 for (uint u = 0; u < value.size(); u++) if (value[u] == ' ') value[u] = '_';
00543                                                 
00544                                                 // look in the array if we already have something about this entity
00545 
00546                                                 if (!async)
00547                                                 {
00548                                                         uint y;
00549                                                         for (y = 0; y < answer.size(); y++)
00550                                                         {
00551                                                                 if (answer[y].second[1] == entity)
00552                                                                 {
00553                                                                         // ok we found it, just push_back new stuff
00554                                                                         vara = &(answer[y].first);
00555                                                                         vala = &(answer[y].second);
00556                                                                         break;
00557                                                                 }
00558                                                         }
00559                                                         if (y == answer.size ())
00560                                                         {
00561                                                                 answer.push_back (make_pair(vector<string>(), vector<string>()));
00562 
00563                                                                 vara = &(answer[answer.size()-1].first);
00564                                                                 vala = &(answer[answer.size()-1].second);
00565                                                                 
00566                                                                 // don't add service if we want an entity
00567                 // todo when we work on entity, we don't need service name and server so we should remove them and collapse all var for the same entity
00568                                                                 vara->push_back ("service");
00569                                                                 string name = IService::getInstance ()->getServiceUnifiedName();
00570                                                                 vala->push_back (name);
00571                                                                 
00572                                                                 // add default row
00573                                                                 vara->push_back ("entity");
00574                                                                 vala->push_back (entity);
00575                                                         }
00576 
00577                                                         vara->push_back (cmd.substr(0, cmd.find(" ")));
00578                                                         vala->push_back (value);
00579                                                 }
00580                                                 else
00581                                                 {
00582                                                         addRequestWaitingNb (rid);
00583 
00584                                                         vector<string> vara, vala;
00585                                                         vara.push_back ("service");
00586                                                         string name = IService::getInstance ()->getServiceUnifiedName();
00587                                                         vala.push_back (name);
00588 
00589                                                         // add default row
00590                                                         vara.push_back ("entity");
00591                                                         vala.push_back (entity);
00592 
00593                                                         vara.push_back (cmd.substr(0, cmd.find(" ")));
00594                                                         vala.push_back (value);
00595         
00596                                                         addRequestAnswer (rid, vara, vala);
00597                                                 }
00598                                                 nlinfo ("ADMIN: Add to result view for entity '%s', '%s' = '%s'", varpath.Destination[i].first.c_str(), subvarpath.Destination[j].first.c_str(), str.c_str());
00599                                         }
00600                                         mdDisplayVars.unlockStrings();
00601                                 }
00602                         }
00603                 }
00604         }
00605 }

void NLNET::setDefaultEmailParams const std::string &  smtpServer,
const std::string &  from,
const std::string &  to
 

If you call this function, the default from (when from is "") used in the sendEmail will be the one you set by this function

Definition at line 349 of file email.cpp.

References DefaultFrom, DefaultSMTPServer, DefaultTo, and from.

Referenced by NLNET::IService::main().

00350 {
00351         DefaultSMTPServer = smtpServer;
00352         DefaultFrom = from;
00353         DefaultTo = to;
00354 }

void setInformations const std::vector< std::string > &  alarms,
const std::vector< std::string > &  graphupdate
 

void setInformations const vector< string > &  alarms,
const vector< string > &  graphupdate
 

Definition at line 797 of file admin.cpp.

References Alarms, CVarPath::Destination, GraphUpdates, nlinfo, and uint.

Referenced by cbInfo().

00798 {
00799         uint i;
00800 
00801         // add only commands that I understand
00802         Alarms.clear ();
00803         for (i = 0; i < alarms.size(); i+=3)
00804         {
00805                 CVarPath shardvarpath (alarms[i]);
00806                 if(shardvarpath.Destination.size() == 0 || shardvarpath.Destination[0].second.empty())
00807                         continue;
00808                 CVarPath servervarpath (shardvarpath.Destination[0].second);
00809                 if(servervarpath.Destination.size() == 0 || servervarpath.Destination[0].second.empty())
00810                         continue;
00811                 CVarPath servicevarpath (servervarpath.Destination[0].second);
00812                 if(servicevarpath.Destination.size() == 0 || servicevarpath.Destination[0].second.empty())
00813                         continue;
00814         
00815                 string name = servicevarpath.Destination[0].second;
00816 
00817                 if (IService::getInstance()->getServiceUnifiedName().find(servicevarpath.Destination[0].first) != string::npos && ICommand::exists(name))
00818                 {
00819                         nlinfo ("ADMIN: Adding alarm '%s' limit %d order %s (varpath '%s')", name.c_str(), atoi(alarms[i+1].c_str()), alarms[i+2].c_str(), alarms[i].c_str());
00820                         Alarms.push_back(CAlarm(name, atoi(alarms[i+1].c_str()), alarms[i+2]=="gt"));
00821                 }
00822                 else
00823                 {
00824                         if (IService::getInstance()->getServiceUnifiedName().find(servicevarpath.Destination[0].first) == string::npos)
00825                         {
00826                                 nlinfo ("ADMIN: Skipping alarm '%s' limit %d order %s (varpath '%s') (not for my service, i'm '%s')", name.c_str(), atoi(alarms[i+1].c_str()), alarms[i+2].c_str(), alarms[i].c_str(), IService::getInstance()->getServiceUnifiedName().c_str());
00827                         }
00828                         else
00829                         {
00830                                 nlinfo ("ADMIN: Skipping alarm '%s' limit %d order %s (varpath '%s') (var not exist)", name.c_str(), atoi(alarms[i+1].c_str()), alarms[i+2].c_str(), alarms[i].c_str());
00831                         }
00832                 }
00833         }
00834 
00835         // do the same with graph update
00836         GraphUpdates.clear ();
00837         for (i = 0; i < graphupdate.size(); i+=2)
00838         {
00839                 CVarPath shardvarpath (graphupdate[i]);
00840                 if(shardvarpath.Destination.size() == 0 || shardvarpath.Destination[0].second.empty())
00841                         continue;
00842                 CVarPath servervarpath (shardvarpath.Destination[0].second);
00843                 if(servervarpath.Destination.size() == 0 || servervarpath.Destination[0].second.empty())
00844                         continue;
00845                 CVarPath servicevarpath (servervarpath.Destination[0].second);
00846                 if(servicevarpath.Destination.size() == 0 || servicevarpath.Destination[0].second.empty())
00847                         continue;
00848                 
00849                 string VarName = servicevarpath.Destination[0].second;
00850                 string ServiceName = servicevarpath.Destination[0].first;
00851 
00852                 if (ICommand::exists(VarName) && (ServiceName == "*" || IService::getInstance()->getServiceShortName() == ServiceName))
00853                 {
00854                         nlinfo ("ADMIN: Adding graphupdate '%s' update %d (varpath '%s')", VarName.c_str(), atoi(graphupdate[i+1].c_str()), graphupdate[i].c_str());
00855                         GraphUpdates.push_back(CGraphUpdate(VarName, atoi(graphupdate[i+1].c_str())));
00856                 }
00857                 else
00858                 {
00859                         if (IService::getInstance()->getServiceShortName() != ServiceName)
00860                         {
00861                                 nlinfo ("ADMIN: Skipping graphupdate '%s' limit %d (varpath '%s') (not for my service, i'm '%s')", VarName.c_str(), atoi(graphupdate[i+1].c_str()), graphupdate[i].c_str(), IService::getInstance()->getServiceUnifiedName().c_str());
00862                         }
00863                         else
00864                         {
00865                                 nlinfo ("ADMIN: Skipping graphupdate '%s' limit %d (varpath '%s') (var not exist)", VarName.c_str(), atoi(graphupdate[i+1].c_str()), graphupdate[i].c_str());
00866                         }
00867                 }
00868         }
00869 }

void setListenAddress const string &  la  )  [static]
 

Definition at line 244 of file login_server.cpp.

References NLNET::CInetAddress::asIPString(), ListenAddr, NLNET::CBufServer::listenAddress(), ModeTcp, nlinfo, and Server.

Referenced by cfcbListenAddress(), and NLNET::CLoginServer::init().

00245 {
00246         // if the var is empty or not found, take it from the listenAddress()
00247         if (la.empty() && ModeTcp && Server != NULL)
00248         {
00249                 ListenAddr = Server->listenAddress ().asIPString();
00250         }
00251         else
00252         {
00253                 ListenAddr = la;
00254         }
00255         
00256         nlinfo("LS: Listen Address that will be send to client is now '%s'", ListenAddr.c_str());
00257 }

void NLNET::setRemoteClientCallback TRemoteClientCallback  cb  ) 
 

Definition at line 211 of file admin.cpp.

References RemoteClientCallback, and TRemoteClientCallback.

00212 {
00213         RemoteClientCallback = cb;
00214 }

void sigHandler int  Sig  )  [static]
 

Definition at line 164 of file service.cpp.

References ExitSignalAsked, NLMISC::getThreadId(), nldebug, nlinfo, nlwarning, sigHandler(), SignalisedThread, and SignalName.

Referenced by initSignal(), and sigHandler().

00165 {
00166         // redirect the signal for the next time
00167         signal(Sig, sigHandler);
00168 
00169         // find the signal
00170         for (int i = 0; i < (int)(sizeof(Signal)/sizeof(Signal[0])); i++)
00171         {
00172                 if (Sig == Signal[i])
00173                 {
00174                         if (getThreadId () != SignalisedThread)
00175                         {
00176                                 nldebug ("SERVICE: Not the main thread received the signal (%s, %d), ignore it", SignalName[i],Sig);
00177                                 return;
00178                         }
00179                         else
00180                         {
00181                                 nlinfo ("SERVICE: Signal %s (%d) received", SignalName[i], Sig);
00182                                 switch (Sig)
00183                                 {
00184                                 case SIGABRT :
00185                                 case SIGILL  :
00186                                 case SIGINT  :
00187                                 case SIGSEGV :
00188                                 case SIGTERM :
00189                                 // you should not call a function and system function like printf in a SigHandle because
00190                                 // signal-handler routines are usually called asynchronously when an interrupt occurs.
00191                                 if (ExitSignalAsked == 0)
00192                                 {
00193                                         nlinfo ("SERVICE: Receive a signal that said that i must exit");
00194                                         ExitSignalAsked = Sig;
00195                                         return;
00196                                 }
00197                                 else
00198                                 {
00199                                         nlinfo ("SERVICE: Signal already received, launch the brutal exit");
00200                                         exit (EXIT_FAILURE);
00201                                 }
00202                                 break;
00203                                 }
00204                         }
00205                 }
00206         }
00207         nlwarning ("SERVICE: Unknown signal received (%d)", Sig);
00208 }

string stringFromVectorPart const vector< uint8 > &  v,
uint32  pos,
uint32  len
 

Definition at line 106 of file buf_sock.cpp.

References len, nlassertex, s, uint32, uint8, and v.

00107 {
00108         nlassertex( pos+len <= v.size(), ("pos=%u len=%u size=%u", pos, len, v.size()) );
00109 
00110         string s;
00111         if ( (! v.empty()) && (len!=0) )
00112         {
00113                 // Copy contents
00114                 s.resize( len );
00115                 memcpy( &*s.begin(), &*v.begin()+pos, len );
00116 
00117                 // Replace '\0' characters
00118                 string::iterator is;
00119                 for ( is=s.begin(); is!=s.end(); ++is )
00120                 {
00121                         if ( ! isprint((uint8)(*is)) || (*is) == '%' )
00122                         {
00123                                 (*is) = '?';
00124                         }
00125                 }
00126         }
00127 
00128         return s;
00129 }

TNetworkEvent NLNET::StringToEvent string &  s  ) 
 

string -> TNetworkEvent

Definition at line 54 of file message_recorder.cpp.

References Accepting, Connecting, ConnFailing, Disconnecting, Error, nlstop, Receiving, s, Sending, and TNetworkEvent.

Referenced by NLNET::TMessageRecord::serial().

00055 {
00056         if ( s == "RECV" )
00057                 return Receiving;
00058         else if ( s == "SEND" )
00059                 return Sending;
00060         else if ( s == "DISC" )
00061                 return Disconnecting;
00062         else if ( s == "ACCP" )
00063                 return Accepting;
00064         else if ( s == "CONN" )
00065                 return Connecting;
00066         else if ( s == "CNFL" )
00067                 return ConnFailing;
00068         else 
00069         {
00070                 nlstop;
00071                 return Error;
00072         }
00073 }

uint32 NLNET::stringToInternalIPAddress const std::string &  addr  ) 
 

Take a internet dot string and convert it in an uint32 internal format for example "128.64.32.16" -> 0xF0804020.

Definition at line 522 of file inet_address.cpp.

References addr, and uint32.

Referenced by NLNET::CUnifiedNetwork::addNetworkAssociation().

00523 {
00524         return inet_addr( addr.c_str() );
00525 }

void subRequestWaitingNb uint32  rid  )  [static]
 

Definition at line 237 of file admin.cpp.

References nldebug, nlwarning, Requests, uint, and uint32.

00238 {
00239         for (uint i = 0 ; i < Requests.size (); i++)
00240         {
00241                 if (Requests[i].Id == rid)
00242                 {
00243                         Requests[i].NbWaiting--;
00244                         nldebug ("ADMIN: ++ i %d rid %d NbWaiting- %d NbReceived %d", i, Requests[i].Id, Requests[i].NbWaiting, Requests[i].NbReceived);
00245                         return;
00246                 }
00247         }
00248         nlwarning ("ADMIN: subRequestWaitingNb: can't find the rid %d", rid);
00249 }

string typeToString CTransportClass::TProp  type  ) 
 

Definition at line 77 of file transport_class.cpp.

References type.

Referenced by cbTCReceiveOtherSideClass().

00078 {
00079         string conv[] = {
00080                 "PropUInt8", "PropUInt16", "PropUInt32", "PropUInt64",
00081                 "PropSInt8", "PropSInt16", "PropSInt32", "PropSInt64",
00082                 "PropBool", "PropFloat", "PropDouble", "PropString", "PropDataSetRow", "PropSheetId", "PropUKN" };
00083 //              "PropBool", "PropFloat", "PropDouble", "PropString", "PropDataSetRow", "PropEntityId", "PropSheetId", "PropUKN" };
00084                 
00085         if (type > CTransportClass::PropUKN)
00086                 return "<InvalidType>";
00087         return conv[type];
00088 }

void uncbConnection TSockId  from,
void *  arg
 

Definition at line 172 of file unified_network.cpp.

References AppIdDeadConnection, from, nlinfo, and TSockId.

Referenced by NLNET::CUnifiedNetwork::init().

00173 {
00174         nlinfo ("HNETL5: + connec '%s'", from->asString().c_str());
00175 
00176         from->setAppId (AppIdDeadConnection);
00177 }

void uncbDisconnection TSockId  from,
void *  arg
 

Definition at line 179 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::_UsedConnection, allstuffs, AppIdDeadConnection, AUTOCHECK_DISPLAY, NLNET::CUnifiedNetwork::CUnifiedConnection::AutoRetry, NLNET::CUnifiedNetwork::callServiceDownCallback(), NLNET::CUnifiedNetwork::CUnifiedConnection::Connection, from, NLNET::CUnifiedNetwork::getUnifiedConnection(), NLNET::CUnifiedNetwork::CUnifiedConnection::IsExternal, nlinfo, NLNET::CUnifiedNetwork::removeNamedCnx(), NLNET::CUnifiedNetwork::CUnifiedConnection::reset(), NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceId, NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceName, NLMISC::toString(), TSockId, uint, and uint16.

Referenced by NLNET::CUnifiedNetwork::addService(), and NLNET::CUnifiedNetwork::init().

00180 {
00181         if(from->appId () == AppIdDeadConnection)
00182         {
00183                 nlinfo ("HNETL5: - connec '%s'", from->asString().c_str());
00184                 test.displayNL ("-connect dead conenction");
00185         }
00186         else
00187         {
00188                 CUnifiedNetwork *uni = CUnifiedNetwork::getInstance();
00189                 uint16                  sid = (uint16)from->appId();
00190                 CUnifiedNetwork::CUnifiedConnection *uc = uni->getUnifiedConnection (sid);
00191                 if (uc == 0)
00192                 {
00193                         nlinfo ("HNETL5: - connec '%s' sid %hu", from->asString().c_str(), sid);
00194                         test.displayNL ("-connect '%s' %hu", from->asString ().c_str (), sid);
00195                 }
00196                 else
00197                 {
00198                         nlinfo ("HNETL5: - connec '%s' %s-%hu", from->asString().c_str(), uc->ServiceName.c_str (), sid);
00199                         allstuffs += "-connect "+uc->ServiceName+"-"+toString(sid)+"\n";
00200                         test.displayNL ("-connect %s-%hu", uc->ServiceName.c_str (), (uint16)(uc->ServiceId));
00201 
00202                         if (uc->IsExternal)
00203                         {
00204                                 if (!uc->AutoRetry)
00205                                 {
00206                                         // If it s a external service with no auto retry, remove the connection
00207                                         
00208                                         // call the user callback
00209                                         uni->callServiceDownCallback(uc->ServiceName, uc->ServiceId);
00210                                         
00211                                         /*CUnifiedNetwork::TNameMappedCallback::iterator        it2 = uni->_DownCallbacks.find(uc->ServiceName);
00212 
00213                                         if (it2 != uni->_DownCallbacks.end())
00214                                         {
00215                                                 // call it
00216                                                 TUnifiedNetCallback     cb = (*it2).second.first;
00217                                                 cb(uc->ServiceName, uc->ServiceId, (*it2).second.second);
00218                                         }
00219 
00220                                         for (uint c = 0; c < uni->_DownUniCallback.size (); c++)
00221                                         {
00222                                                 if (uni->_DownUniCallback[c].first != NULL)
00223                                                         uni->_DownUniCallback[c].first(uc->ServiceName, uc->ServiceId, uni->_DownUniCallback[c].second);
00224                                         }*/
00225 
00226                                         uni->removeNamedCnx (uc->ServiceName, uc->ServiceId);
00227         
00228                                         // remove the _UsedConnection
00229                                         bool found = false;
00230                                         for (vector<uint16>::iterator it = uni->_UsedConnection.begin (); it != uni->_UsedConnection.end(); it++)
00231                                         {
00232                                                 if (*it == uc->ServiceId)
00233                                                 {
00234                                                         found = true;
00235                                                         uni->_UsedConnection.erase (it);
00236                                                         break;
00237                                                 }
00238                                         }
00239                                         if (!found) AUTOCHECK_DISPLAY ("HNETL5: can't find the sid %hu in the _UsedConnection", uc->ServiceId);
00240 
00241                                         uc->reset ();
00242                                 }
00243                         }
00244                         else
00245                         {
00246                                 // reset the connection
00247                                 uint i;
00248                                 for (i = 0; i < uc->Connection.size (); i++)
00249                                 {
00250                                         if (uc->Connection[i].valid() && uc->Connection[i].CbNetBase->getSockId(uc->Connection[i].HostId) == from)
00251                                         {
00252                                                 if (uc->Connection[i].IsServerConnection)
00253                                                 {
00254                                                         // we have to remove the stuffs now because HostId will not be accessible later
00255                                                         uc->Connection[i].reset();
00256                                                 }
00257                                                 else
00258                                                 {
00259                                                         // if it s a client, we can't delete now because the callback client is currently in use
00260                                                         // only disconnect
00261                                                         if(uc->Connection[i].CbNetBase->connected ())
00262                                                         {
00263                                                                 uc->Connection[i].CbNetBase->disconnect (uc->Connection[i].HostId);
00264                                                         }
00265                                                 }
00266                                                 break;
00267                                         }
00268                                 }
00269                                 if (i == uc->Connection.size ())
00270                                 {
00271                                         AUTOCHECK_DISPLAY ("HNETL5: received a disconnection from a service but the connection is not in my list!");
00272                                 }
00273                         }
00274                 }
00275 
00276                 from->setAppId (AppIdDeadConnection);
00277         }
00278 }

void uncbMsgProcessing CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
 

Definition at line 406 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::_Callbacks, AppIdDeadConnection, AUTOCHECK_DISPLAY, from, NLNET::CMessage::getName(), NLNET::CUnifiedNetwork::getUnifiedConnection(), H_AUTO, NL_I64, nlwarning, NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceName, TotalCallbackCalled, NLNET::CUnifiedNetwork::CUnifiedConnection::TotalCallbackCalled, TSockId, and uint16.

Referenced by NLNET::CUnifiedNetwork::addService(), and NLNET::CUnifiedNetwork::init().

00407 {
00408         if (from->appId() == AppIdDeadConnection)
00409         {
00410                 AUTOCHECK_DISPLAY ("HNETL5: Receive a message from a dead connection");
00411                 return;
00412         }
00413 
00414         CUnifiedNetwork                                                                 *uni = CUnifiedNetwork::getInstance();
00415         uint16                                                                                  sid = (uint16)from->appId();
00416         CUnifiedNetwork::TMsgMappedCallback::iterator   itcb;
00417 
00418         itcb = uni->_Callbacks.find(msgin.getName());
00419         if (itcb == uni->_Callbacks.end())
00420         {
00421                 // the callback doesn't exist
00422                 nlwarning ("HNETL5: Can't find callback '%s' called by service %hu", msgin.getName().c_str(), sid);
00423         }
00424         else
00425         {
00426                 CUnifiedNetwork::CUnifiedConnection *uc = uni->getUnifiedConnection (sid);
00427 
00428                 if (uc == 0)
00429                 {
00430                         nlwarning ("HNETL5: Received a message from a service %hu that is not ready (bad appid? 0x%"NL_I64"X)", sid, from->appId ());
00431                         return;
00432                 }
00433                 if((*itcb).second == 0)
00434                 {
00435                         nlwarning ("HNETL5: Received message %s from a service %hu but the associated callback is NULL", msgin.getName ().c_str(), sid);
00436                         return;
00437                 }
00438 
00439                 {
00440                         static map<string, CHTimer> timers;
00441                         map<string, CHTimer>::iterator it;
00442                         
00443                         {
00444                                 H_AUTO(L5UCHTimerOverhead);
00445                                 string callbackName = "USRCB_" + msgin.getName();
00446                                 it = timers.find(callbackName);
00447                                 if(it == timers.end())
00448                                 {
00449                                         it = timers.insert(make_pair(callbackName, CHTimer(NULL))).first;
00450                                         (*it).second.setName((*it).first.c_str());
00451                                 }
00452                         }
00453 
00454                         {
00455                                 H_AUTO(L5UserCallback);
00456                                 
00457                                 (*it).second.before();
00458                                 (*itcb).second (msgin, uc->ServiceName, sid);
00459                                 (*it).second.after();
00460                         }
00461                 }
00462 
00463                 uc->TotalCallbackCalled++;
00464                 TotalCallbackCalled++;
00465         }
00466 }

void uncbServiceIdentification CMessage msgin,
TSockId  from,
CCallbackNetBase &  netbase
 

Definition at line 284 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::_DefaultNetwork, NLNET::CUnifiedNetwork::_IdCnx, NLNET::CUnifiedNetwork::_NetworkAssociations, NLNET::CUnifiedNetwork::_UsedConnection, NLNET::CUnifiedNetwork::addNamedCnx(), allstuffs, AppIdDeadConnection, AUTOCHECK_DISPLAY, NLNET::CUnifiedNetwork::callServiceUpCallback(), NLNET::CUnifiedNetwork::CUnifiedConnection::Connection, NLNET::CCallbackNetBase::disconnect(), NLNET::CUnifiedNetwork::CUnifiedConnection::ExtAddress, from, NLNET::CCallbackNetBase::hostAddress(), NL_I64, nlassert, nlinfo, nlstop, nlwarning, NLMISC::CMemStream::serial(), NLMISC::toString(), TSockId, uint, uint16, uint8, and vectorCInetAddressToString().

00285 {
00286         string          inSName;
00287         uint16          inSid;
00288 
00289         if (from->appId () != AppIdDeadConnection)
00290                 AUTOCHECK_DISPLAY ("HNETL5: received a connec ident from an unknown connection 0x%"NL_I64"X", from->appId ());
00291 
00292         // recover the service name and id
00293         msgin.serial(inSName);
00294         msgin.serial(inSid);
00295         uint8 pos;
00296         msgin.serial (pos);
00297         bool isExternal;
00298         msgin.serial (isExternal);
00299 
00300         nlinfo ("HNETL5: + connec ident '%s' %s-%hu pos %hu ext %d", from->asString().c_str(), inSName.c_str(), inSid, (uint16)pos, (uint8)isExternal);
00301         
00302         allstuffs += "+rconnect "+inSName+"-"+toString(inSid)+" pos "+toString((uint16)pos)+"\n";
00303         test.displayNL ("+rconnect %s-%hu pos %hu", inSName.c_str (), (uint16)inSid, (uint16)pos);
00304 
00305         if(isExternal)
00306         {
00307                 nlassert (pos == 0);
00308         }
00309 
00310         if (inSid == 0)
00311         {
00312                 if (isExternal)
00313                 {
00314                         inSid = CUnifiedNetwork::getInstance ()->_ExtSId++;
00315                         nlwarning ("HNETL5: Received a connection from a service with a SId 0, we give him the SId %d", inSid);
00316                 }
00317                 else
00318                 {
00319                         nlwarning ("HNETL5: Received a connection from a service with a SId 0 and wasn't external, disconnecting it");
00320                         netbase.disconnect();
00321                         return;
00322                 }
00323         }
00324 
00325         from->setAppId(inSid);
00326 
00327         // add a new connection to the list
00328         CUnifiedNetwork         *uni= CUnifiedNetwork::getInstance();
00329 
00330         if(inSid >= uni->_IdCnx.size ())
00331         {
00332                 uni->_IdCnx.resize (inSid+1);
00333         }
00334 
00335         switch(uni->_IdCnx[inSid].State)
00336         {
00337         case CUnifiedNetwork::CUnifiedConnection::NotUsed:              // add the new unified connection
00338                 uni->_IdCnx[inSid] = CUnifiedNetwork::CUnifiedConnection(inSName, inSid, isExternal);
00339                 uni->_UsedConnection.push_back (inSid);
00340                 break;
00341         default:
00342                 break;
00343         }
00344 
00345         if (uni->_IdCnx[inSid].IsExternal != isExternal)
00346         {
00347                 AUTOCHECK_DISPLAY ("HNETL5: Receive a connection that is not totally external %d %d", uni->_IdCnx[inSid].IsExternal, isExternal);
00348                 return;
00349         }
00350 
00351         bool FirstConnection = (uni->_IdCnx[inSid].Connection.size () == 0);
00352 
00353         // add the connection to the already inserted unified connection
00354         if (pos >= uni->_IdCnx[inSid].Connection.size ())
00355                 uni->_IdCnx[inSid].Connection.resize(pos+1);
00356         uni->_IdCnx[inSid].Connection[pos] = CUnifiedNetwork::CUnifiedConnection::TConnection(&netbase, from);
00357 
00358         // If the connection is external, we'll never receive the ExtAddress by the naming service, so add it manually
00359         if (isExternal)
00360         {
00361                 uni->_IdCnx[inSid].ExtAddress.push_back (netbase.hostAddress (from));
00362                 uni->_IdCnx[inSid].setupNetworkAssociation (uni->_NetworkAssociations, uni->_DefaultNetwork);
00363         }
00364 
00365 
00366         // todo ace temp to savoir comment c est possible ce cas la
00367         if (uni->_IdCnx[inSid].Connection.size() == 3)
00368         {
00369                 CUnifiedNetwork::CUnifiedConnection *uc = &uni->_IdCnx[inSid];
00370                 nlstop;
00371                 nlinfo ("HNETL5: ext addr %s", vectorCInetAddressToString (uc->ExtAddress).c_str ());
00372                 for(uint i = 0; i < uc->Connection.size(); i++)
00373                         nlinfo ("HNETL5: cnx %s", uc->Connection[i].HostId->asString ().c_str ());
00374                 nlinfo ("HNETL5: %s", allstuffs.c_str ());
00375         }
00376 
00377         // send the callback to the user with the first connection
00378         if (FirstConnection)
00379         {
00380                 // insert the name in the map to be able to send message with the name
00381                 uni->addNamedCnx (inSName, inSid);
00382 
00383                 uni->callServiceUpCallback (inSName, inSid);
00384 /*
00385                 // now we warn the user
00386                 CUnifiedNetwork::TNameMappedCallback::iterator  it = uni->_UpCallbacks.find(inSName);
00387                 if (it != uni->_UpCallbacks.end())
00388                 {
00389                         // call it
00390                         for (list<TCallbackArgItem> it2 = (*it).second.begin(); it2 != (*it).second.end(); it2++)
00391                         {
00392                                 TUnifiedNetCallback     cb = (*it2).first;
00393                                 if (cb) cb(inSName, inSid, (*it2).second);
00394                         }
00395                 }
00396 
00397                 for (uint c = 0; c < uni->_UpUniCallback.size (); c++)
00398                 {
00399                         if (uni->_UpUniCallback[c].first != NULL)
00400                                 uni->_UpUniCallback[c].first (inSName, inSid, uni->_UpUniCallback[c].second);
00401                 }*/
00402         }
00403 }

void uNetRegistrationBroadcast const string &  name,
TServiceId  sid,
const vector< CInetAddress > &  addr
 

Definition at line 58 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::_DefaultNetwork, NLNET::CUnifiedNetwork::_IdCnx, NLNET::CUnifiedNetwork::_NetworkAssociations, NLNET::CUnifiedNetwork::_SId, NLNET::CUnifiedNetwork::_UsedConnection, addr, allstuffs, AUTOCHECK_DISPLAY, nlassert, nldebug, NLMISC::toString(), TServiceId, uint16, and vectorCInetAddressToString().

Referenced by NLNET::CUnifiedNetwork::init().

00059 {
00060         nldebug ("HNETL5: + naming %s-%hu '%s'", name.c_str(), (uint16)sid, vectorCInetAddressToString(addr).c_str ());
00061 
00062         allstuffs += "+naming "+name+"-"+toString(sid)+"\n";
00063         test.displayNL ("+naming %s-%hu", name.c_str (), (uint16)sid);
00064 
00065         CUnifiedNetwork *uni= CUnifiedNetwork::getInstance();
00066 
00067         if (uni->_SId == sid)
00068         {
00069                 allstuffs += "itsme!!!\n";
00070                 test.displayNL ("itsme!!!");
00071                 // it's me! don't add me!!!
00072                 return;
00073         }
00074 
00075         // add the unified connection
00076 
00077         if(sid >= uni->_IdCnx.size ())
00078                 uni->_IdCnx.resize (sid+1);
00079 
00080         if (uni->_IdCnx[sid].State == CUnifiedNetwork::CUnifiedConnection::NotUsed)
00081         {
00082                 uni->_IdCnx[sid] = CUnifiedNetwork::CUnifiedConnection(name, sid, false);
00083                 uni->_UsedConnection.push_back (sid);
00084         }
00085 
00086         if (!uni->_IdCnx[sid].ExtAddress.empty ()) AUTOCHECK_DISPLAY ("HNETL5: %s-%hu already inserted in the table with '%s'", name.c_str(), (uint16)sid, vectorCInetAddressToString (uni->_IdCnx[sid].ExtAddress).c_str ());
00087 
00088 
00089         // set the list of external addresses
00090 
00091         nlassert (!addr.empty());
00092 
00093         uni->_IdCnx[sid].ExtAddress = addr;
00094 
00095         // associate nid with ext address
00096         uni->_IdCnx[sid].setupNetworkAssociation (uni->_NetworkAssociations, uni->_DefaultNetwork);
00097 }

void uNetUnregistrationBroadcast const string &  name,
TServiceId  sid,
const vector< CInetAddress > &  addr
 

Definition at line 100 of file unified_network.cpp.

References NLNET::CUnifiedNetwork::_UsedConnection, addr, allstuffs, AppIdDeadConnection, AUTOCHECK_DISPLAY, NLNET::CUnifiedNetwork::callServiceDownCallback(), NLNET::CUnifiedNetwork::CUnifiedConnection::Connection, NLNET::CUnifiedNetwork::getUnifiedConnection(), nldebug, NLNET::CUnifiedNetwork::removeNamedCnx(), NLNET::CUnifiedNetwork::CUnifiedConnection::reset(), NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceId, NLNET::CUnifiedNetwork::CUnifiedConnection::ServiceName, NLMISC::toString(), TServiceId, uint, uint16, and vectorCInetAddressToString().

Referenced by NLNET::CUnifiedNetwork::init().

00101 {
00102         nldebug ("HNETL5: - naming %s-%hu '%s'", name.c_str(), (uint16)sid, vectorCInetAddressToString (addr).c_str ());
00103 
00104         allstuffs += "-naming "+name+"-"+toString(sid)+"\n";
00105         test.displayNL ("-naming %s-%hu", name.c_str (), (uint16)sid);
00106 
00107         // get the service connection
00108         CUnifiedNetwork *uni = CUnifiedNetwork::getInstance();
00109 
00110         CUnifiedNetwork::CUnifiedConnection *uc = uni->getUnifiedConnection (sid);
00111         if (uc == 0) return;    // should never happen, the getUnifiedConnection() will generate a AUTOCHECK_DISPLAY
00112 
00113         // call the user callback
00114 
00115         uni->callServiceDownCallback(uc->ServiceName, uc->ServiceId);
00116 
00117         /*
00118         CUnifiedNetwork::TNameMappedCallback::iterator  it2 = uni->_DownCallbacks.find(uc->ServiceName);
00119 
00120         if (it2 != uni->_DownCallbacks.end())
00121         {
00122                 // call it
00123                 TUnifiedNetCallback     cb = (*it2).second.first;
00124                 cb(uc->ServiceName, uc->ServiceId, (*it2).second.second);
00125         }
00126 
00127         for (uint c = 0; c < uni->_DownUniCallback.size (); c++)
00128         {
00129                 if (uni->_DownUniCallback[c].first != NULL)
00130                         uni->_DownUniCallback[c].first(uc->ServiceName, uc->ServiceId, uni->_DownUniCallback[c].second);
00131         }*/
00132 
00133         if(!uc->Connection.empty ())
00134         {
00135                 // set all connection to dead, now, all messages received on this socket will be ignored and closed
00136                 for (uint i = 0; i < uc->Connection.size (); ++i)
00137                 {
00138                         if (uc->Connection[i].valid())
00139                                 uc->Connection[i].setAppId (AppIdDeadConnection);
00140                 }
00141 
00142                 //
00143                 // It's the first connection that added the _NamedCnx so if there s no connection, no need to
00144                 // remove entry in _NamedCnx
00145                 //
00146 
00147                 uni->removeNamedCnx (uc->ServiceName, uc->ServiceId);
00148         }
00149 
00150         // remove the _UsedConnection
00151         bool found = false;
00152         for (vector<uint16>::iterator it = uni->_UsedConnection.begin (); it != uni->_UsedConnection.end(); it++)
00153         {
00154                 if (*it == uc->ServiceId)
00155                 {
00156                         found = true;
00157                         uni->_UsedConnection.erase (it);
00158                         break;
00159                 }
00160         }
00161         if (!found) AUTOCHECK_DISPLAY ("HNETL5: can't find the sid %hu in the _UsedConnection", uc->ServiceId);
00162 
00163         // reset the unified connection
00164         uc->reset ();
00165 }

void UnregistrationBroadcast const std::string &  name,
TServiceId  sid,
const vector< CInetAddress > &  addr
[static]
 

Definition at line 164 of file net_manager.cpp.

References addr, nldebug, TServiceId, and uint16.

Referenced by NLNET::CNetManager::init().

00165 {
00166         nldebug("HNETL4: UnregistrationBroadcast() of service %s-%hu", name.c_str (), (uint16)sid);
00167 }

void NLNET::updateAdmin  ) 
 

Definition at line 648 of file admin.cpp.

References NLMISC::CLog::addDisplayer(), AlarmCheckDelay, Alarms, cleanRequest(), NLMISC::CMemDisplayer::clear(), GraphUpdates, NLMISC::humanReadableToBytes(), NLMISC::CMemDisplayer::lockStrings(), nlinfo, nlwarning, sendAdminEmail(), NLMISC::CMemStream::serial(), sint32, size, uint, uint32, and NLMISC::CMemDisplayer::unlockStrings().

Referenced by NLNET::IService::main().

00649 {
00650         string str;
00651         CLog logDisplayVars;
00652         CLightMemDisplayer mdDisplayVars;
00653         logDisplayVars.addDisplayer (&mdDisplayVars);
00654         
00655         uint32 CurrentTime = CTime::getSecondsSince1970();
00656 
00657 
00658         //
00659         // check admin requests
00660         //
00661 
00662         cleanRequest ();
00663 
00664 
00665         //
00666         // Check graph updates
00667         //
00668 
00669         static uint32 lastGraphUpdateCheck = 0;
00670         
00671         if (CurrentTime >= lastGraphUpdateCheck+1)
00672         {
00673                 lastGraphUpdateCheck = CurrentTime;
00674 
00675                 CMessage msgout ("GRAPH_UPDATE");
00676                 bool empty = true;
00677                 for (uint j = 0; j < GraphUpdates.size(); j++)
00678                 {
00679                         if (CurrentTime >= GraphUpdates[j].LastUpdate + GraphUpdates[j].Update)
00680                         {
00681                                 // have to send a new update for this var
00682                                 ICommand::execute(GraphUpdates[j].Name, logDisplayVars, true, false);
00683                                 const std::deque<std::string>   &strs = mdDisplayVars.lockStrings();
00684                                 sint32 val;
00685                                 if (strs.size() != 1)
00686                                   {
00687                                         nlwarning ("ADMIN: The graph update command execution not return exactly 1 line but %d", strs.size());
00688                                         for (uint i = 0; i < strs.size(); i++)
00689                                           nlwarning ("ADMIN: line %d: '%s'", i, strs[i].c_str());
00690                                         val = 0;
00691                                   }
00692                                 else
00693                                   {
00694                                         val = atoi(strs[0].c_str());
00695                                   }
00696                                 mdDisplayVars.unlockStrings ();
00697                                 mdDisplayVars.clear ();
00698                                 
00699                                 string name = IService::getInstance()->getServiceAliasName();
00700                                 if (name.empty())
00701                                         name = IService::getInstance()->getServiceShortName();
00702 
00703                                 if(empty)
00704                                         msgout.serial (CurrentTime);
00705 
00706                                 msgout.serial (name);
00707                                 msgout.serial (GraphUpdates[j].Name);
00708                                 msgout.serial (val);
00709 
00710                                 empty = false;
00711 
00712                                 GraphUpdates[j].LastUpdate = CurrentTime;
00713                         }
00714                 }
00715 
00716                 if(!empty)
00717                 {
00718                         if(IService::getInstance ()->getServiceShortName()=="AES")
00719                                 CUnifiedNetwork::getInstance ()->send ("AS", msgout);
00720                         else
00721                                 CUnifiedNetwork::getInstance ()->send ("AES", msgout);
00722                 }
00723         }
00724 
00725 
00726         //
00727         // Check alarms
00728         //
00729 
00730         static uint32 lastAlarmsCheck = 0;
00731 
00732         if (CurrentTime >= lastAlarmsCheck+AlarmCheckDelay)
00733         {
00734                 lastAlarmsCheck = CTime::getSecondsSince1970();
00735 
00736                 for (uint i = 0; i < Alarms.size(); )
00737                 {
00738                         mdDisplayVars.clear ();
00739                         ICommand::execute(Alarms[i].Name, logDisplayVars, true, false);
00740                         const std::deque<std::string>   &strs = mdDisplayVars.lockStrings();
00741 
00742                         if (strs.size()>0)
00743                         {
00744                                 str = strs[0].substr(0,strs[0].size()-1);
00745                         }
00746                         else
00747                         {
00748                                 str = "???";
00749                         }
00750 
00751                         mdDisplayVars.unlockStrings();
00752                         
00753                         if (str == "???")
00754                         {
00755                                 // variable doesn't exist, remove it from alarms
00756                                 nlwarning ("ADMIN: Alarm problem: variable '%s' returns ??? instead of a good value", Alarms[i].Name.c_str());
00757                                 Alarms.erase (Alarms.begin()+i);
00758                         }
00759                         else
00760                         {
00761                                 // compare the value
00762                                 uint32 err = Alarms[i].Limit;
00763                                 uint32 val = humanReadableToBytes(str);
00764                                 if (Alarms[i].GT && val >= err)
00765                                 {
00766                                         if (!Alarms[i].Activated)
00767                                         {
00768                                                 nlinfo ("ADMIN: VARIABLE TOO BIG '%s' %u >= %u", Alarms[i].Name.c_str(), val, err);
00769                                                 Alarms[i].Activated = true;
00770                                                 sendAdminEmail ("Alarm: Variable %s is %u that is greater or equal than the limit %u", Alarms[i].Name.c_str(), val, err);
00771                                         }
00772                                 }
00773                                 else if (!Alarms[i].GT && val <= err)
00774                                 {
00775                                         if (!Alarms[i].Activated)
00776                                         {
00777                                                 nlinfo ("ADMIN: VARIABLE TOO LOW '%s' %u <= %u", Alarms[i].Name.c_str(), val, err);
00778                                                 Alarms[i].Activated = true;
00779                                                 sendAdminEmail ("Alarm: Variable %s is %u that is lower or equal than the limit %u", Alarms[i].Name.c_str(), val, err);
00780                                         }
00781                                 }
00782                                 else
00783                                 {
00784                                         if (Alarms[i].Activated)
00785                                         {
00786                                                 nlinfo ("ADMIN: variable is ok '%s' %u %s %u", Alarms[i].Name.c_str(), val, (Alarms[i].GT?"<":">"), err);
00787                                                 Alarms[i].Activated = false;
00788                                         }
00789                                 }
00790                                 
00791                                 i++;
00792                         }
00793                 }
00794         }
00795 }

CVariable<uint32> UpdateAssertionThreadTimeout "UpdateAssertionThreadTimeout"  ,
"in  millisecond,
timeout before thread assertion"  ,
,
,
true  ,
UpdateAssertionThreadTimeoutCB 
[static]
 

void UpdateAssertionThreadTimeoutCB IVariable var  )  [static]
 

Definition at line 155 of file service.cpp.

References MyTAT, CTimeoutAssertionThread::timeout(), and NLMISC::IVariable::toString().

00155 { MyTAT.timeout(atoi(var.toString().c_str())); }

uint64 updateStatCounter uint64 counter,
uint64  newvalue
[inline]
 

Definition at line 350 of file buf_client.cpp.

References uint64.

Referenced by NLNET::CBufClient::newBytesDownloaded(), and NLNET::CBufClient::newBytesUploaded().

00351 {
00352         uint64 result = newvalue - counter;
00353         counter = newvalue;
00354         return result;
00355 }

CVariable<sint32> UserSpeedLoop "UserSpeedLoop"  ,
"duration of the last network loop(in ms)"  ,
10  ,
false 
 

Referenced by NLNET::IService::main().

void uuencode const char *  s,
const char *  store,
const int  length
[static]
 

Definition at line 61 of file email.cpp.

References s, and tbl.

Referenced by sendEmail().

00062 {
00063         int i;
00064         unsigned char *p = (unsigned char *)store;
00065         unsigned char *us = (unsigned char *)s;
00066         
00067         /* Transform the 3x8 bits to 4x6 bits, as required by base64.  */
00068         for (i = 0; i < length; i += 3) {
00069                 *p++ = tbl[us[0] >> 2];
00070                 *p++ = tbl[((us[0] & 3) << 4) + (us[1] >> 4)];
00071                 *p++ = tbl[((us[1] & 0xf) << 2) + (us[2] >> 6)];
00072                 *p++ = tbl[us[2] & 0x3f];
00073                 us += 3;
00074         }
00075         /* Pad the result if necessary...  */
00076         if (i == length + 1) {
00077                 *(p - 1) = tbl[64];
00078         }
00079         else if (i == length + 2) {
00080                 *(p - 1) = *(p - 2) = tbl[64];
00081         }
00082         /* ...and zero-terminate it.  */
00083         *p = '\0';
00084 }

std::string NLNET::vectorCInetAddressToString const std::vector< CInetAddress > &  addrs  ) 
 

Definition at line 509 of file inet_address.cpp.

References uint.

Referenced by NLNET::CUnifiedNetwork::addService(), cbRegisterBroadcast(), uncbServiceIdentification(), uNetRegistrationBroadcast(), and uNetUnregistrationBroadcast().

00510 {
00511         string str;
00512 
00513         for (uint i = 0; i < addrs.size(); i++)
00514         {
00515                 if (i != 0)
00516                         str += " ";
00517                 str += addrs[i].asString().c_str ();
00518         }
00519         return str;
00520 }


Variable Documentation

TBroadcastCallback NLNET::_RegistrationBroadcastCallback = NULL [static]
 

Definition at line 55 of file naming_client.cpp.

Referenced by cbRegisterBroadcast(), and NLNET::CNamingClient::setRegistrationBroadcastCallback().

TBroadcastCallback NLNET::_UnregistrationBroadcastCallback = NULL [static]
 

Definition at line 56 of file naming_client.cpp.

Referenced by cbUnregisterBroadcast(), and NLNET::CNamingClient::setUnregistrationBroadcastCallback().

bool NLNET::AcceptInvalidCookie = false [static]
 

Definition at line 56 of file login_server.cpp.

Referenced by cbShardValidation(), and cfcbAcceptInvalidCookie().

const uint32 NLNET::AlarmCheckDelay = 5
 

Definition at line 89 of file admin.cpp.

Referenced by updateAdmin().

std::vector< CAlarm > NLNET::Alarms
 

Definition at line 84 of file admin.cpp.

Referenced by NLMISC_COMMAND(), setInformations(), and updateAdmin().

string NLNET::allstuffs [static]
 

Definition at line 51 of file unified_network.cpp.

Referenced by NLNET::CUnifiedNetwork::addNamedCnx(), NLNET::CUnifiedNetwork::addService(), NLNET::CUnifiedNetwork::removeNamedCnx(), uncbDisconnection(), uncbServiceIdentification(), uNetRegistrationBroadcast(), and uNetUnregistrationBroadcast().

const uint64 NLNET::AppIdDeadConnection = 0xDEAD [static]
 

Definition at line 42 of file unified_network.cpp.

Referenced by uncbConnection(), uncbDisconnection(), uncbMsgProcessing(), uncbServiceIdentification(), and uNetUnregistrationBroadcast().

uint8 NLNET::buffer[10000]
 

Definition at line 236 of file udp_sim_sock.cpp.

queue<CBufferizedOutPacket*> NLNET::BufferizedInPackets [static]
 

Definition at line 93 of file udp_sim_sock.cpp.

Referenced by NLNET::CUdpSimSock::dataAvailable(), and NLNET::CUdpSimSock::receive().

queue<CBufferizedOutPacket*> NLNET::BufferizedOutPackets [static]
 

Definition at line 92 of file udp_sim_sock.cpp.

Referenced by NLNET::CUdpSimSock::sendUDP(), and NLNET::CUdpSimSock::updateBufferizedPackets().

TUnifiedCallbackItem NLNET::builtinServiceCallbacks[]
 

Initial value:

{
        { "R_SH_ID", cbReceiveShardId },
}

Definition at line 266 of file service.cpp.

Referenced by NLNET::IService::main().

TUnifiedCallbackItem NLNET::CallbackArray [static]
 

Initial value:

{
        { "INFO",                       cbInfo },
        { "GET_VIEW",           cbServGetView },
        { "STOPS",                      cbStopService },
        { "EXEC_COMMAND",       cbExecCommand },
        { "ADMIN_PING",         cbAdminPing },
}

Definition at line 316 of file transport_class.cpp.

Referenced by NLNET::CTransportClass::init().

TCallbackItem NLNET::cbnbMessageAssociationArray[] [static]
 

Initial value:

Definition at line 117 of file callback_net_base.cpp.

Referenced by NLNET::CCallbackNetBase::CCallbackNetBase().

const TCallbackItem NLNET::ClientCallbackArray[] [static]
 

Initial value:

{
        { "SV", cbShardValidation },
}

Definition at line 239 of file login_server.cpp.

Referenced by NLNET::CLoginServer::init().

TCallbackItem NLNET::ClientMessageAssociationArray[] [static]
 

Initial value:

{
        { "RAA", cbcMessageRecvAllAssociations },
}

Definition at line 50 of file callback_client.cpp.

Referenced by NLNET::CCallbackClient::CCallbackClient().

CNetDisplayer NLNET::commandDisplayer(false) [static]
 

string NLNET::CompilationDate [static]
 

Definition at line 132 of file service.cpp.

Referenced by NLNET::IService::main().

string NLNET::CompilationMode = "???"
 

Definition at line 146 of file service.cpp.

Referenced by NLMISC_COMMAND().

string NLNET::DefaultFrom [static]
 

Definition at line 40 of file email.cpp.

Referenced by sendEmail(), and setDefaultEmailParams().

string NLNET::DefaultSMTPServer [static]
 

Definition at line 40 of file email.cpp.

Referenced by sendEmail(), and setDefaultEmailParams().

string NLNET::DefaultTo [static]
 

Definition at line 40 of file email.cpp.

Referenced by sendEmail(), and setDefaultEmailParams().

string NLNET::DefaultUserPriv = "" [static]
 

Definition at line 58 of file login_server.cpp.

Referenced by cfcbDefaultUserPriv().

TDisconnectClientCallback NLNET::DisconnectClientCallback = NULL [static]
 

Definition at line 60 of file login_server.cpp.

Referenced by cbWSDisconnectClient(), and NLNET::CLoginServer::init().

TUnifiedCallbackItem NLNET::EmptyCallbackArray = { { "", NULL } }
 

Definition at line 112 of file service.cpp.

sint NLNET::ExitSignalAsked = 0 [static]
 

Definition at line 117 of file service.cpp.

Referenced by NLNET::IService::exit(), NLNET::IService::main(), NLMISC_COMMAND(), NLMISC_DYNVARIABLE(), and sigHandler().

CFileDisplayer NLNET::fd [static]
 

Definition at line 38 of file unified_network.cpp.

Referenced by NLNET::CUnifiedNetwork::init().

TCallbackItem NLNET::FESCallbackArray[] [static]
 

Initial value:

{
        { "SV", cbShardValidate },
}

Definition at line 58 of file login_client.cpp.

Referenced by NLNET::CLoginClient::connectToShard().

bool NLNET::GetClientUniversalTime [static]
 

Definition at line 293 of file unitime.cpp.

Referenced by cbClientGetUniversalTime().

TTime NLNET::GetClientUniversalTimeUniTime [static]
 

Definition at line 294 of file unitime.cpp.

Referenced by cbClientGetUniversalTime().

bool NLNET::GetUniversalTime [static]
 

Definition at line 134 of file unitime.cpp.

Referenced by cbGetUniversalTime().

uint32 NLNET::GetUniversalTimeSecondsSince1970 [static]
 

Definition at line 135 of file unitime.cpp.

Referenced by cbGetUniversalTime().

TTime NLNET::GetUniversalTimeUniTime [static]
 

Definition at line 136 of file unitime.cpp.

Referenced by cbGetUniversalTime().

std::vector< CGraphUpdate > NLNET::GraphUpdates
 

Definition at line 86 of file admin.cpp.

Referenced by NLMISC_COMMAND(), setInformations(), and updateAdmin().

const TSockId NLNET::InvalidSockId = (TSockId) NULL [static]
 

Definition at line 44 of file buf_net_base.h.

uint32 NLNET::LaunchingDate [static]
 

Definition at line 133 of file service.cpp.

Referenced by NLNET::IService::main(), and NLMISC_DYNVARIABLE().

string NLNET::ListenAddr [static]
 

Definition at line 54 of file login_server.cpp.

Referenced by cbWSChooseShard(), NLMISC_DYNVARIABLE(), and setListenAddress().

const char * NLNET::LockedSubMessageError = "a sub message is forbidden"
 

Definition at line 41 of file message.cpp.

Referenced by NLNET::CMessage::clear(), NLNET::CMessage::invert(), and NLNET::CMessage::operator=().

const sint16 NLNET::LOG_CBINDEX = 0
 

Definition at line 42 of file net_displayer.cpp.

bool NLNET::ModeTcp = 0 [static]
 

Definition at line 63 of file login_server.cpp.

Referenced by cbShardValidation(), cbWSDisconnectClient(), NLNET::CLoginServer::clientDisconnected(), NLNET::CLoginServer::init(), NLMISC_COMMAND(), and setListenAddress().

CTimeoutAssertionThread NLNET::MyTAT [static]
 

Definition at line 154 of file service.cpp.

Referenced by NLNET::IService::main(), and UpdateAssertionThreadTimeoutCB().

TCallbackItem NLNET::NamingClientCallbackArray[] [static]
 

Initial value:

{
        { "RG", cbRegister },
        { "QP", cbQueryPort },

        { "RGB", cbRegisterBroadcast },
        { "UNB", cbUnregisterBroadcast }
}

Definition at line 230 of file naming_client.cpp.

Referenced by NLNET::CNamingClient::connect().

uint32 NLNET::NbClientReceiveTask = 0
 

Definition at line 47 of file buf_client.cpp.

Referenced by NLNET::CClientReceiveTask::run().

uint32 NLNET::NbNetworkTask = 0
 

Definition at line 36 of file buf_net_base.cpp.

Referenced by NLNET::CServerReceiveTask::run(), NLNET::CListenTask::run(), and NLNET::CClientReceiveTask::run().

uint32 NLNET::NbServerListenTask = 0
 

Definition at line 48 of file buf_server.cpp.

Referenced by NLNET::CListenTask::run().

uint32 NLNET::NbServerReceiveTask = 0
 

Definition at line 49 of file buf_server.cpp.

Referenced by NLNET::CServerReceiveTask::run().

uint32 NLNET::NbUserUpdate = 0 [static]
 

Definition at line 135 of file service.cpp.

Referenced by NLNET::IService::main().

const char* NLNET::NegFiltersNames[] [static]
 

Initial value:

{
   "NegFiltersDebug",
   "NegFiltersInfo",
   "NegFiltersWarning",
   "NegFiltersAssert",
   "NegFiltersError",
   0
}

Definition at line 97 of file service.cpp.

Referenced by NLNET::IService::main().

CNetLog NLNET::NetLog
 

Definition at line 56 of file net_log.cpp.

TNewClientCallback NLNET::NewClientCallback = NULL
 

Definition at line 71 of file login_server.cpp.

Referenced by cbShardValidation(), and NLNET::CLoginServer::init().

TCallbackItem NLNET::PacsCallbackArray
 

Initial value:

{
        { "PACS_ASW", cbPacsAnswer }
}

Definition at line 572 of file pacs_client.h.

Referenced by NLNET::CPacsClient::connect().

list<CPendingUser> NLNET::PendingUsers [static]
 

Definition at line 51 of file login_server.cpp.

Referenced by cbWSChooseShard(), NLMISC_COMMAND(), and refreshPendingList().

bool NLNET::QueryPort [static]
 

Definition at line 106 of file naming_client.cpp.

Referenced by cbQueryPort(), and NLNET::CNamingClient::queryServicePort().

uint16 NLNET::QueryPortPort [static]
 

Definition at line 107 of file naming_client.cpp.

Referenced by cbQueryPort(), and NLNET::CNamingClient::queryServicePort().

string NLNET::Reason [static]
 

Definition at line 83 of file naming_client.cpp.

Referenced by cbRegister(), and NLNET::CNamingClient::registerService().

bool NLNET::Registered [static]
 

Definition at line 80 of file naming_client.cpp.

Referenced by cbRegister(), NLNET::CNamingClient::registerService(), and NLNET::CNamingClient::registerServiceWithSId().

TServiceId* NLNET::RegisteredSID = NULL [static]
 

Definition at line 82 of file naming_client.cpp.

Referenced by cbRegister(), NLNET::CNamingClient::registerService(), and NLNET::CNamingClient::registerServiceWithSId().

bool NLNET::RegisteredSuccess [static]
 

Definition at line 81 of file naming_client.cpp.

Referenced by cbRegister(), NLNET::CNamingClient::registerService(), and NLNET::CNamingClient::registerServiceWithSId().

TRemoteClientCallback NLNET::RemoteClientCallback = 0
 

Definition at line 82 of file admin.cpp.

Referenced by serviceGetView(), and setRemoteClientCallback().

vector<CRequest> NLNET::Requests
 

Definition at line 91 of file admin.cpp.

Referenced by addRequestAnswer(), addRequestWaitingNb(), cbServGetView(), cleanRequest(), emptyRequest(), and subRequestWaitingNb().

uint32 NLNET::RequestTimeout = 4
 

Definition at line 93 of file admin.cpp.

Referenced by cleanRequest().

CCallbackServer* NLNET::Server = NULL [static]
 

Definition at line 53 of file login_server.cpp.

Referenced by cbShardValidation(), cbWSDisconnectClient(), ClientConnection(), NLNET::CLoginServer::init(), NLMISC_DYNVARIABLE(), and setListenAddress().

TCallbackItem NLNET::ServerTimeServiceCallbackArray[]
 

Initial value:

{
        { "AUT", cbServerAskUniversalTime },
}

Definition at line 275 of file unitime.cpp.

Referenced by NLNET::_CUniTime::installServer().

bool NLNET::ShardValidate
 

Definition at line 46 of file login_client.cpp.

Referenced by cbShardValidate(), and NLNET::CLoginClient::connectToShard().

string NLNET::ShardValidateReason
 

Definition at line 47 of file login_client.cpp.

Referenced by cbShardValidate(), and NLNET::CLoginClient::connectToShard().

const sint NLNET::Signal[] [static]
 

Initial value:

 {
  SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM
}

Definition at line 88 of file service.cpp.

uint NLNET::SignalisedThread [static]
 

Definition at line 126 of file service.cpp.

Referenced by initSignal(), and sigHandler().

const char* NLNET::SignalName[] [static]
 

Initial value:

{
  "SIGABRT", "SIGFPE", "SIGILL", "SIGINT", "SIGSEGV", "SIGTERM"
}

Definition at line 92 of file service.cpp.

Referenced by sigHandler().

char NLNET::tbl[65] [static]
 

Initial value:

 {
        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
        'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
        'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
        'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
        'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
        'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
        'w', 'x', 'y', 'z', '0', '1', '2', '3',
        '4', '5', '6', '7', '8', '9', '+', '/',
        '=' 
}

Definition at line 43 of file email.cpp.

Referenced by uuencode().

CLog NLNET::test(CLog::LOG_INFO)
 

uint NLNET::ThreadCreator = 0 [static]
 

Definition at line 40 of file unified_network.cpp.

Referenced by NLNET::CUnifiedNetwork::addService(), NLNET::CUnifiedNetwork::connect(), NLNET::CUnifiedNetwork::getNetBase(), NLNET::CUnifiedNetwork::init(), NLNET::CUnifiedNetwork::release(), NLNET::CUnifiedNetwork::send(), NLNET::CUnifiedNetwork::sendAll(), and NLNET::CUnifiedNetwork::update().

uint NLNET::TimeBeforeEraseCookie = 120 [static]
 

Definition at line 66 of file login_server.cpp.

Referenced by cfcbTimeBeforeEraseCookie(), and refreshPendingList().

uint32 NLNET::TotalCallbackCalled = 0 [static]
 

Definition at line 44 of file unified_network.cpp.

Referenced by uncbMsgProcessing().

TCallbackItem NLNET::unServerCbArray[]
 

Initial value:

{
        { "UN_SIDENT", uncbServiceIdentification }
}

Definition at line 469 of file unified_network.cpp.

Referenced by NLNET::CUnifiedNetwork::init().

map<uint32, TSockId> NLNET::UserIdSockAssociations
 

contains the correspondance between userid and the sockid

Definition at line 69 of file login_server.cpp.

Referenced by cbShardValidation(), cbWSDisconnectClient(), NLNET::CLoginServer::clientDisconnected(), and NLMISC_COMMAND().

TUnifiedCallbackItem NLNET::WSCallbackArray[] [static]
 

Initial value:

{
        { "CS", cbWSChooseShard },
        { "DC", cbWSDisconnectClient },
}

Definition at line 169 of file login_server.cpp.

Referenced by NLNET::CLoginServer::connectToWS().


Generated on Tue Mar 16 13:51:09 2004 for NeL by doxygen 1.3.6