ANNA Suite  2020b
Multipurpose development suite for Telco applications
Public Member Functions | Protected Member Functions | Friends | List of all members
anna::diameter::comm::Engine Class Reference

#include <Engine.hpp>

Inheritance diagram for anna::diameter::comm::Engine:
Inheritance graph
[legend]
Collaboration diagram for anna::diameter::comm::Engine:
Collaboration graph
[legend]

Public Member Functions

void setOriginRealmName (const std::string &originRealmName)
 
void setOriginHostName (const std::string &originHostName)
 
const std::string & getOriginRealmName () const
 
const std::string & getOriginHostName () const
 
void raiseAutoRecovery (bool autoRecovery=true) noexcept(false)
 
bool getAutoBind () const
 
void setAutoBind (const bool autoBind)
 
void setMaxConnectionDelay (const anna::Millisecond &maxConnectionDelay)
 
const anna::MillisecondgetMaxConnectionDelay ()
 
bool bind () noexcept(false)
 
void setClientCER (const anna::DataBlock &cer) noexcept(false)
 
void setClientCER (const std::string &cerPathFile) noexcept(false)
 
void setClientCER (const anna::U32 &applicationId) noexcept(false)
 
void setClientDWR (const anna::DataBlock &dwr) noexcept(false)
 
void setClientDWR (const std::string &dwrPathFile="") noexcept(false)
 
void setWatchdogPeriod (const anna::Millisecond &wp) noexcept(false)
 
int getNumberOfClientSessionsPerServer () const
 
void setNumberOfClientSessionsPerServer (int numberOfClientSessionsPerServer)
 
ClientSessionfindClientSession (const std::string &addr, int port, int socketId, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
ClientSessionfindClientSession (const std::string &key, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
ServerfindServer (const std::string &addr, int port, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
EntityfindEntity (const socket_v &socketList, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
EntityfindEntity (const std::string &addr1, int port1, const std::string &addr2, int port2, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
EntitycreateEntity (const socket_v &socketList, const std::string &description="") noexcept(false)
 
EntitycreateEntity (const std::string &addr1, int port1, const std::string &addr2, int port2, const std::string &description="") noexcept(false)
 
LocalServerfindLocalServer (const std::string &addr, int port, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
ServerSessionfindServerSession (int socketId, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
 
LocalServercreateLocalServer (const std::string &addr, int port=Session::DefaultPort, int maxConnections=-1, const anna::Millisecond &allowedInactivityTime=ServerSession::DefaultAllowedInactivityTime, int category=1, const std::string &description="") noexcept(false)
 
void close (bool destroy=false) noexcept(false)
 
void closeEntities (bool destroy=false) noexcept(false)
 
void closeEntity (Entity *entity, bool destroy=false) noexcept(false)
 
void closeLocalServers (bool destroy=false) noexcept(false)
 
void closeLocalServer (LocalServer *localServer, bool destroy=false) noexcept(false)
 
int getOTARequestsForEntities () const
 
int getOTARequestsForLocalServers () const
 
int getOTARequests () const
 
bool idleForEntities () const
 
bool idleForLocalServers () const
 
bool idle () const
 
bool broadcastEntities (const Message *message) noexcept(false)
 
bool broadcastEntities (const Message &message) noexcept(false)
 
bool broadcastLocalServers (const Message *message) noexcept(false)
 
bool broadcastLocalServers (const Message &message) noexcept(false)
 
virtual std::string asString (void) const
 
virtual anna::xml::NodeasXML (anna::xml::Node *parent) const
 
virtual void bindingClientSession (const ClientSession *) const
 
virtual void readDPA (anna::DataBlock &dpa, const anna::DataBlock &dpr) const
 
void setCEA (const std::string &ceaPathfile)
 
const std::string & getCEA () const
 
virtual void readCEA (anna::DataBlock &cea, const anna::DataBlock &cer) const
 
virtual void readDWA (anna::DataBlock &dwa, const anna::DataBlock &dwr) const
 
const ResponsesendRealmHost (const Message *message, const std::string &destinationRealm, const std::string &destinationHost="") noexcept(false)
 
void resetStatistics ()
 
void lazyInitialize () noexcept(false)
 
- Public Member Functions inherited from anna::app::Component
virtual ~Component ()
 
void attach () noexcept(false)
 
- Public Member Functions inherited from anna::Component
const char * getClassName () const
 
- Public Member Functions inherited from anna::Mutex
 Mutex (const Mode::_v mode=Mode::Recursive)
 
virtual ~Mutex ()
 
virtual void lock () noexcept(false)
 
virtual void unlock ()
 
bool trylock () noexcept(false)
 
 operator const pthread_mutex_t * () const
 

Protected Member Functions

 Engine (const char *className, const stack::Dictionary *baseProtocolDictionary)
 
ServercreateServer (Entity *, const socket_t &) noexcept(false)
 
void closeServer (Server *, bool) noexcept(false)
 
ClientSessioncreateClientSession (Server *, int) noexcept(false)
 
void closeClientSession (ClientSession *, bool) noexcept(false)
 
ServerallocateServer ()
 
void releaseServer (Server *)
 
ClientSessionallocateClientSession ()
 
void releaseClientSession (ClientSession *)
 
virtual EntityallocateEntity ()
 
virtual void releaseEntity (Entity *)
 
virtual LocalServerallocateLocalServer ()
 
virtual void releaseLocalServer (LocalServer *)
 
codec::EnginegetBaseProtocolCodecEngine () const
 
- Protected Member Functions inherited from anna::app::Component
 Component (const char *className)
 
State::_v getState () const
 
void addPredecessor (const char *componentName)
 
void initialize () noexcept(false)
 
void stop ()
 
virtual void kill ()
 
- Protected Member Functions inherited from anna::Component
 Component (const char *className)
 
 Component (const Component &other)
 
- Protected Member Functions inherited from anna::Safe
 Safe ()
 

Friends

class Session
 
class ClientSession
 
class ServerSession
 
class ServerSocket
 
class Server
 
class Entity
 
class LocalServer
 

Additional Inherited Members

- Protected Attributes inherited from anna::Component
const std::string a_className
 

Detailed Description

General manager for connections to several diameter servers and from diameter clients.

Optimizes creation, finding and releasing of established client-sessions to a certain number of diameter servers through entities. Optimizes creation, finding and releasing of established server-sessions from a certain number of diameter clients through local servers.

Implementation example:

class MyEngine : public diameter::comm::Engine {
public:
MyEngine () {;}
private:
anna::diameter::comm::Entity* allocateEntity () { return a_entities.create (); }
MyEntity* aux = static_cast <MyEntity*> (entity);
a_entities.release (aux);
}
anna::diameter::comm::LocalServer* allocateLocalServer () { return a_localServers.create (); }
MyLocalServer* aux = static_cast <MyLocalServer*> (localServer);
a_localServers.release (aux);
}
};

Constructor & Destructor Documentation

◆ Engine()

anna::diameter::comm::Engine::Engine ( const char *  className,
const stack::Dictionary baseProtocolDictionary 
)
protected

Constructor.

Parameters
classNameComponent class name
baseProtocolDictionaryThis will be used internally when calling @readCEA, @readDPA and @readDWA on servers, and also used during base protocol messages tracing (if debug traces are enabled). You could provide NULL, but you must be sure that neither of the former situations are going to happen or an exception will be thrown (using setClientCER and setClientDWR with DataBlock arguments, expects externally encoded messages and could help). It is recommended to set a base protocol dictionary loading 'source/diameter/stack/setups' dictionaries (for example 'avps_ietf.xml' plus 'commands_baseProtocol.xml'), or using the dictionary creation API. The dictionary could also be an application stack, the only condition is containing the resources to build base protocol messages.

Member Function Documentation

◆ allocateClientSession()

ClientSession* anna::diameter::comm::Engine::allocateClientSession ( )
protected

◆ allocateEntity()

virtual Entity* anna::diameter::comm::Engine::allocateEntity ( )
inlineprotectedvirtual

Entity allocator method.

It is recommended to use anna::Recycler for entities creation/releasing.

See also
anna::Recycler
653 { return NULL; }

◆ allocateLocalServer()

virtual LocalServer* anna::diameter::comm::Engine::allocateLocalServer ( )
inlineprotectedvirtual

Local server allocator method.

It is recommended to use anna::Recycler for entities creation/releasing.

See also
anna::Recycler
670 { return NULL; }

◆ allocateServer()

Server* anna::diameter::comm::Engine::allocateServer ( )
protected

◆ asString()

virtual std::string anna::diameter::comm::Engine::asString ( void  ) const
virtual

Class string representation

Returns
String with class content

Reimplemented from anna::app::Component.

◆ asXML()

virtual anna::xml::Node* anna::diameter::comm::Engine::asXML ( anna::xml::Node parent) const
virtual

Class XML representation.

Parameters
parentXML node over which we will put instance information.
Returns
XML documentcon with class content.

Reimplemented from anna::app::Component.

◆ bind()

bool anna::diameter::comm::Engine::bind ( )
noexcept

Binds engine entities.

Returns
Returns true if all client-session were successfully bound

◆ bindingClientSession()

virtual void anna::diameter::comm::Engine::bindingClientSession ( const ClientSession ) const
inlinevirtual

When a subyacent client session is going to be bound, this method is invoked before. Default implementation do nothing.

519 {;}

◆ broadcastEntities() [1/2]

bool anna::diameter::comm::Engine::broadcastEntities ( const Message message)
noexcept

Sent a message to all the engine entities. It is used, i.e., in Disconnect-Peer-Request procedure over the engine.

Parameters
messageMessage which is being sent.
Returns
Returns true (success) only when broadcast is success over all the engine entities. If any entity fails, then false is returned. Broadcast try to send all over the resources in spite of any fail.

◆ broadcastEntities() [2/2]

bool anna::diameter::comm::Engine::broadcastEntities ( const Message message)
inlinenoexcept
487 { return broadcastEntities(&message); }
bool broadcastEntities(const Message *message) noexcept(false)
Here is the call graph for this function:

◆ broadcastLocalServers() [1/2]

bool anna::diameter::comm::Engine::broadcastLocalServers ( const Message message)
noexcept

Sent a message through all the engine local servers. It is used, i.e., in Disconnect-Peer-Request procedure over the engine.

Parameters
messageMessage which is being sent.
Returns
Returns true (success) only when broadcast is success over all the engine local servers. If any local server fails, then false is returned. Broadcast try to send all over the resources in spite of any fail.

◆ broadcastLocalServers() [2/2]

bool anna::diameter::comm::Engine::broadcastLocalServers ( const Message message)
inlinenoexcept
499 { return broadcastLocalServers(&message); }
bool broadcastLocalServers(const Message *message) noexcept(false)
Here is the call graph for this function:

◆ close()

void anna::diameter::comm::Engine::close ( bool  destroy = false)
inlinenoexcept

Close all the engine resources (entities and local servers) Optionally all resources may be freed passing true

Parameters
destroyFree all engine entity resources
394 { closeEntities(destroy); closeLocalServers(destroy); }
void closeEntities(bool destroy=false) noexcept(false)
void closeLocalServers(bool destroy=false) noexcept(false)

◆ closeClientSession()

void anna::diameter::comm::Engine::closeClientSession ( ClientSession ,
bool   
)
protectednoexcept

◆ closeEntities()

void anna::diameter::comm::Engine::closeEntities ( bool  destroy = false)
noexcept

Close all the engine entities (close servers, then close client-sessions within them). Depending on client-session configuration ('OnDisconnect' behaviour), pending answers will be wait (graceful) or ignored (immediate-abrupt close). Optionally all entities resources may be freed passing true; in this case, close is immediately performed:

Parameters
destroyFree all engine entity resources

◆ closeEntity()

void anna::diameter::comm::Engine::closeEntity ( Entity entity,
bool  destroy = false 
)
noexcept

Close entity servers (then, client-sessions included) and optionally free resources including entity itself. If entity is null, this operation has no effect.

Parameters
entityDiameter entity to be closed.
destroyDeletes entity over the engine and all its resources.

◆ closeLocalServer()

void anna::diameter::comm::Engine::closeLocalServer ( LocalServer localServer,
bool  destroy = false 
)
noexcept

Close local server socket and its children server sessions. This is useful when detecting service lost. When service is ready to handle traffic, a new server socket would be created by mean #LocalServer::enable() and new connections could be accepted. Optionally local server resources may be freed passing true.

Parameters
localServerLocal server to be closed.
destroyDeletes local server over engine and all its resources (server sessions within it).

◆ closeLocalServers()

void anna::diameter::comm::Engine::closeLocalServers ( bool  destroy = false)
noexcept

Close all the engine local server sockets including their children server sessions. Optionally all local server resources may be freed passing true.

Parameters
destroyFree all engine local servers resources and server sessions within them.

◆ closeServer()

void anna::diameter::comm::Engine::closeServer ( Server ,
bool   
)
protectednoexcept

◆ createClientSession()

ClientSession* anna::diameter::comm::Engine::createClientSession ( Server ,
int   
)
protectednoexcept

◆ createEntity() [1/2]

Entity* anna::diameter::comm::Engine::createEntity ( const socket_v socketList,
const std::string &  description = "" 
)
noexcept

Creates a diameter entity with provided parameters.

Depending on auto-bind configuration, capabilities exchange request will be or won't be performed over the entity client-sessions.

Parameters
socketListDiameter server priority list (priority-ordered) in order to define whole entity.
descriptionOptional entity description (empty by default)
Returns
The entity created or exception when any server (address/port) already exists for another entity.
Warning
The entity won't be almost operative until a notification by mean 'ClientSession::eventResponse' indicates that 'ClassCode::Bind' has been correctly performed for any included client-session.

◆ createEntity() [2/2]

Entity* anna::diameter::comm::Engine::createEntity ( const std::string &  addr1,
int  port1,
const std::string &  addr2,
int  port2,
const std::string &  description = "" 
)
noexcept

Creates a standard (dual) diameter entity with provided parameters.

Depending on auto-bind configuration, capabilities exchange request will be or won't be performed over the entity client-sessions.

Parameters
addr1Diameter primary server address (ip or hostname).
port1Diameter primary server port.
addr2Diameter secondary server address (ip or hostname).
port2Diameter secondary server port.
descriptionOptional entity description (empty by default)
Returns
The standard entity created or exception when any server (address/port) already exists for another entity.
Warning
The entity won't be almost operative until a notification by mean 'ClientSession::eventResponse' indicates that 'ClassCode::Bind' has been correctly performed for any included client-session.

◆ createLocalServer()

LocalServer* anna::diameter::comm::Engine::createLocalServer ( const std::string &  addr,
int  port = Session::DefaultPort,
int  maxConnections = -1,
const anna::Millisecond allowedInactivityTime = ServerSession::DefaultAllowedInactivityTime,
int  category = 1,
const std::string &  description = "" 
)
noexcept

Creates a diameter local server with provided parameters.

Server socket address could be an IPv4 or hostname. Default port will be standard 3868 for diameter agents, but any other could be configured. Socket server could be created with any max accepted connections: zero value means temporarily disabled and negative values assume no limit (shared bind) for incomming connections.

Parameters
addrDiameter server socket address (ip or hostname).
portDiameter server socket port (standard 3868 by default).
maxConnectionsDiameter server max sessions allowed (no limit by default).
allowedInactivityTimeMax inactivity time for server sessions over the local server before being reset.
categoryOptional socket server category (1 by default).
descriptionOptional socket server description (empty by default).
Returns
The local server created or exception when is already created.

◆ createServer()

Server* anna::diameter::comm::Engine::createServer ( Entity ,
const socket_t  
)
protectednoexcept

◆ findClientSession() [1/2]

ClientSession* anna::diameter::comm::Engine::findClientSession ( const std::string &  addr,
int  port,
int  socketId,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
noexcept

Returns client-session instance identified by (address, port, socketId) provided.

Parameters
addrDiameter server address (ip or hostname).
portDiameter server port.
socketIdDiameter server socket id.
emodeAction when no client-session is found with provided parameters (Throw/Ignore).
Returns
The client-session instance identified by (address, port, socketId) provided.
Warning
If no client-session found, an exception is launched by default.

◆ findClientSession() [2/2]

ClientSession* anna::diameter::comm::Engine::findClientSession ( const std::string &  key,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
noexcept

Same as findClientSession, but providing client session key (<address>:<port>|<socket id>="">)

◆ findEntity() [1/2]

Entity* anna::diameter::comm::Engine::findEntity ( const socket_v socketList,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
noexcept

Returns entity instance identified by internal index.

Parameters
socketListDiameter entity servers list.
emodeAction when no client-session is found with provided parameters (Throw/Ignore).
Returns
The entity instance identified by id provided.
Warning
If no entity found, an exception is launched by default.

◆ findEntity() [2/2]

Entity* anna::diameter::comm::Engine::findEntity ( const std::string &  addr1,
int  port1,
const std::string &  addr2,
int  port2,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
noexcept

Returns entity instance identified by internal index.

Parameters
addr1Diameter primary server address (ip or hostname).
port1Diameter primary server port.
addr2Diameter secondary server address (ip or hostname).
port2Diameter secondary server port.
emodeAction when no client-session is found with provided parameters (Throw/Ignore).
Returns
The entity instance identified by id provided.
Warning
If no entity found, an exception is launched by default.

◆ findLocalServer()

LocalServer* anna::diameter::comm::Engine::findLocalServer ( const std::string &  addr,
int  port,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
noexcept

Returns local server instance identified by pair (address, port) provided.

Parameters
addrDiameter server socket address (ip or hostname).
portDiameter server socket port.
emodeAction when no local server is found with provided parameters (Throw/Ignore).
Returns
The local server instance identified by pair (address, port) provided.
Warning
If no local server found, an exception is launched by default.

◆ findServer()

Server* anna::diameter::comm::Engine::findServer ( const std::string &  addr,
int  port,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
noexcept

Returns server instance identified by pair (address, port) provided.

Parameters
addrDiameter server address (ip or hostname).
portDiameter server port.
emodeAction when no client-session is found with provided parameters (Throw/Ignore).
Returns
The server instance identified by pair (address, port) provided.
Warning
If no server found, an exception is launched by default.

◆ findServerSession()

ServerSession* anna::diameter::comm::Engine::findServerSession ( int  socketId,
anna::Exception::Mode::_v  emode = anna::Exception::Mode::Throw 
)
noexcept

Returns server-session instance identified by INetAddress serialization provided.

Parameters
socketIdHash for Client Socket INetAddress serialization
emodeAction when no server-session is found with provided parameters (Throw/Ignore).
Returns
The server-session instance identified by global unique socketId provided.
Warning
If no server-session found, an exception is launched by default.

◆ getAutoBind()

bool anna::diameter::comm::Engine::getAutoBind ( ) const
inline

Returns automatic bind indicator for client-sessions. By default true will be used.

Returns
Value for automatic connection bind.
152 { return a_autoBind; }

◆ getBaseProtocolCodecEngine()

codec::Engine* anna::diameter::comm::Engine::getBaseProtocolCodecEngine ( ) const
inlineprotected
685 { return const_cast<codec::Engine *>(&a_baseProtocolCodecEngine); }
Here is the call graph for this function:

◆ getCEA()

const std::string& anna::diameter::comm::Engine::getCEA ( ) const
inline

Gets optional CEA from file, when default is not enough

Returns
Path file for the CEA xml message provided
545 { return a_ceaPathfile; }

◆ getMaxConnectionDelay()

const anna::Millisecond& anna::diameter::comm::Engine::getMaxConnectionDelay ( )
inline

Gets the milliseconds wait to achieve a client connection to server by mean connect primitive. Returns the global engine value, but it could be overwritten through each client session (#ClientSession::setMaxConnectionDelay). Default value is 'anna::comm::ClientSocket::DefaultMaxConnectionDelay'.

Returns
Milliseconds wait to get connection
179 { return a_maxConnectionDelay; }

◆ getNumberOfClientSessionsPerServer()

int anna::diameter::comm::Engine::getNumberOfClientSessionsPerServer ( ) const
inline

Gets the number of client-sessions per server.

Returns
numberOfClientSessionsPerServer Number of client-sessions per server.
236 { return a_numberOfClientSessionsPerServer; }

◆ getOriginHostName()

const std::string& anna::diameter::comm::Engine::getOriginHostName ( ) const
inline

Gets the configured diameter application origin host

Returns
Diameter application node origin host
133 { return a_originHost; }

◆ getOriginRealmName()

const std::string& anna::diameter::comm::Engine::getOriginRealmName ( ) const
inline

Gets the configured diameter application node origin realm

Returns
Diameter application node origin realm
126 { return a_originRealm; }

◆ getOTARequests()

int anna::diameter::comm::Engine::getOTARequests ( ) const
inline

Gets the number of requests messages over-the-air for entities plus local servers.

Returns
OTA messages.

◆ getOTARequestsForEntities()

int anna::diameter::comm::Engine::getOTARequestsForEntities ( ) const

Gets the number of requests messages over-the-air for entities.

Returns
OTA messages.

◆ getOTARequestsForLocalServers()

int anna::diameter::comm::Engine::getOTARequestsForLocalServers ( ) const

Gets the number of requests messages over-the-air for local servers.

Returns
OTA messages.

◆ idle()

bool anna::diameter::comm::Engine::idle ( ) const
inline

Returns idle state (no pending answers for entities or local servers).

Returns
Idle state.
475 { return (getOTARequests() == 0); }
int getOTARequests() const
Definition: Engine.hpp:454

◆ idleForEntities()

bool anna::diameter::comm::Engine::idleForEntities ( ) const
inline

Returns idle state (no pending answers) for entities.

Returns
Idle state.
461 { return (getOTARequestsForEntities() == 0); }
int getOTARequestsForEntities() const

◆ idleForLocalServers()

bool anna::diameter::comm::Engine::idleForLocalServers ( ) const
inline

Returns idle state (no pending answers).

Returns
Idle state.
468 { return (getOTARequestsForLocalServers() == 0); }
int getOTARequestsForLocalServers() const

◆ lazyInitialize()

void anna::diameter::comm::Engine::lazyInitialize ( )
noexcept

Engine lazy initialization. Used if the engine is created when application is already running; for example on dynamic realms registration. At the moment is not actually needed (nothing is done at initialization), but it is recommended to start the component and set its state as 'running' from the point of view of the application.

◆ raiseAutoRecovery()

void anna::diameter::comm::Engine::raiseAutoRecovery ( bool  autoRecovery = true)
noexcept

Propagate auto recovery configuration to entities within engine. Recovery period is configured at anna::comm::Communicator::setRecoveryTime (5 seconds by default). All the client client-sessions created throught createEntity, will be created based on the engine auto-recovery value (enabled by default). You could access entities, servers or client-sessions independently to use this method, but recovery time should be updated through communicator and will apply for new created connections.

Parameters
autoRecoveryAuto recovery indicator. True by default.

◆ readCEA()

virtual void anna::diameter::comm::Engine::readCEA ( anna::DataBlock cea,
const anna::DataBlock cer 
) const
virtual

Class user should implement this method in order to define Capabilities-Exchange-Answer for received CER over server socket. Origin-Host and Origin-Realm are configured at comm::Engine with hostname and FQDN (Fully Qualified Domain Name). Default implementation imply CEA with DIAMETER_SUCCESS Result-Code, and own domain node parameters, but application should analyze the CER message in order to accept it or not (with apropiate non-success Result-Code). If was invoked, a message from file is used instead of default implementation. Any other implementation is responsible to build a valid CEA diameter message, even ignoring a possible cea from file when is used:

If one peer sends a CER message to another Peer and receiver does not have support for

1) any common application then it must return the CEA with Result-Code Avp set to DIAMETER_NO_COMMON_APPLICATION and should disconnect the transport layer connection (automatically done by diameter::comm module). 2) no common security mechanism then it must return the CEA with Result-Code Avp set to DIAMETER_NO_COMMON_SECURITY and should disconnect the transport layer connection (automatically done by diameter::comm module). 3) if CER is received from any unknown peer then receiver should discard the message, or send the CEA with the Result-Code Avp set to DIAMETER_UNKNOWN_PEER.

If the local implementation policy permits to receive CER from unknown hosts, a successful CEA MAY be returned, and the life time of the peer entry in PEER-Table is equal to the lifetime of the transport connection. If in any case transport connection fails then all the pending transactions destined to the unknown peer can be discarded.

The CER and CEA messages MUST NOT be proxied, redirected or relayed. Since CER/CEA messages can not be proxied, but still it is possible that proxy will receive a CER message and proxy does not have any peer to handle the application requested in CER, in this case proxy set the E bit in CEA and set the Result-Code Avp to DIAMETER_UNABLE_TO_DELIVER, sends back to CER generator peer.

Parameters
ceaCEA datablock passed as reference. Empty cea implies to discard CER received.
cerCorresponding CER received (sequence values must be taken into account in order to build CEA)

◆ readDPA()

virtual void anna::diameter::comm::Engine::readDPA ( anna::DataBlock dpa,
const anna::DataBlock dpr 
) const
virtual

Class user should implement this method in order to define Disconnect-Peer-Answer for last received DPR. Origin-Host and Origin-Realm are configured at comm::Engine with hostname and FQDN (Fully Qualified Domain Name). Default implementation imply DPA with DIAMETER_SUCCESS Result-Code, allowing remote disconnection. Any other implementation is responsible to build a valid DPA diameter message. DPR/DPA procedure is disabled with empty definition of this method: no DPA will be sent when DPR is received.

Parameters
dpaDPA datablock passed as reference
dprCorresponding DPR received (sequence values must be taken into account in order to build DPA)

◆ readDWA()

virtual void anna::diameter::comm::Engine::readDWA ( anna::DataBlock dwa,
const anna::DataBlock dwr 
) const
virtual

Class user should implement this method in order to define Device-Watchdog-Answer for received DWR over server socket. Origin-Host and Origin-Realm are configured at comm::Engine with hostname and FQDN (Fully Qualified Domain Name). Default implementation imply DWA with DIAMETER_SUCCESS Result-Code, and own domain node parameters. Any other implementation is responsible to build a valid DWA diameter message.

Parameters
dwaDWA datablock passed as reference
dwrCorresponding DWR received (sequence values must be taken into account in order to build DWA)

◆ releaseClientSession()

void anna::diameter::comm::Engine::releaseClientSession ( ClientSession )
protected

◆ releaseEntity()

virtual void anna::diameter::comm::Engine::releaseEntity ( Entity )
inlineprotectedvirtual

Invoked to free entities.

See also
anna::Recycler
660 {;}

◆ releaseLocalServer()

virtual void anna::diameter::comm::Engine::releaseLocalServer ( LocalServer )
inlineprotectedvirtual

Invoked to free local servers.

See also
anna::Recycler
677 {;}

◆ releaseServer()

void anna::diameter::comm::Engine::releaseServer ( Server )
protected

◆ resetStatistics()

void anna::diameter::comm::Engine::resetStatistics ( )

Reset engine statistics. At the moment, only diameter servers processing time is observed.

◆ sendRealmHost()

const Response* anna::diameter::comm::Engine::sendRealmHost ( const Message message,
const std::string &  destinationRealm,
const std::string &  destinationHost = "" 
)
noexcept

DRA basics: CER information is gathered on every server session managed by the diameter comm engine. You could send the message to a specific realm, and optionally you could restrict a host inside it. This is common for requests (answers are normally sent through the same source server session where the request was received). Exception will be thrown if not found an available server session for the Destination-Realm and/or Destination-Host provided

Parameters
destinationRealmIf empty, NULL is returned, because is nonsense to specify a host out of realm context
destinationHostIf empty, no restriction is applied within the target realm node. Random delivery is applied for the available server sessions
Returns
transactional response reference, or NULL if answer is sent

◆ setAutoBind()

void anna::diameter::comm::Engine::setAutoBind ( const bool  autoBind)
inline

Sets automatic connection bind indicator for client-sessions. If not asigned, it will be true.

Parameters
autoBindValue for automatic connection bind.

In order to change bind timer, first client-session must be created without autobind, modify time parameter and then invoking bind.

161 { a_autoBind = autoBind; }

◆ setCEA()

void anna::diameter::comm::Engine::setCEA ( const std::string &  ceaPathfile)
inline

Sets optional CEA from file, when default is not enough

Parameters
&ceaPathfilePath file for the CEA xml message provided
538 { a_ceaPathfile = ceaPathfile; }

◆ setClientCER() [1/3]

void anna::diameter::comm::Engine::setClientCER ( const anna::DataBlock cer)
noexcept

Sets CER diameter messages to be used over created client-sessions.

Parameters
cerCapabilities-Exchange-Request message (encoded) for the client-sessions bind.

◆ setClientCER() [2/3]

void anna::diameter::comm::Engine::setClientCER ( const std::string &  cerPathFile)
noexcept

Sets CER diameter messages to be used over created client-sessions.

Parameters
cerPathFileCapabilities-Exchange-Request xml message path file for the client-sessions bind.

◆ setClientCER() [3/3]

void anna::diameter::comm::Engine::setClientCER ( const anna::U32 applicationId)
noexcept

Sets DEFAULT CER diameter messages to be used over created client-sessions.

Parameters
applicationIdApplication-Id for the Auth-Application-Id AVP.

◆ setClientDWR() [1/2]

void anna::diameter::comm::Engine::setClientDWR ( const anna::DataBlock dwr)
noexcept

Sets DWR for diameter keep-alive over client-sessions

Parameters
dwrDevice-Watchdog-Request message (encoded) for the client-sessions keep-alive.

◆ setClientDWR() [2/2]

void anna::diameter::comm::Engine::setClientDWR ( const std::string &  dwrPathFile = "")
noexcept

Sets DWR for diameter keep-alive over client-sessions

Parameters
cerPathFileDevice-Watchdog-Request xml message path file for the client-sessions keep-alive. If empty provided, a DEFAULT DWR will be built.

◆ setMaxConnectionDelay()

void anna::diameter::comm::Engine::setMaxConnectionDelay ( const anna::Millisecond maxConnectionDelay)
inline

Sets the milliseconds wait to achieve a client connection to server by mean connect primitive. This is a general value for born client-sessions over engine. Particular configuration could be done through #ClientSession::setMaxConnectionDelay.

Parameters
maxConnectionDelayMilliseconds wait to get connection
170 { a_maxConnectionDelay = maxConnectionDelay; }

◆ setNumberOfClientSessionsPerServer()

void anna::diameter::comm::Engine::setNumberOfClientSessionsPerServer ( int  numberOfClientSessionsPerServer)
inline

Sets the number of client-sessions per server. Its recommended to set this global configuration although it is possible to configure each client-session separately.

Parameters
numberOfClientSessionsPerServerNumber of client-sessions per server.
243 { a_numberOfClientSessionsPerServer = numberOfClientSessionsPerServer; }

◆ setOriginHostName()

void anna::diameter::comm::Engine::setOriginHostName ( const std::string &  originHostName)

Diameter application origin host

Parameters
originHostNameUsed to configure the Origin-Host for outgoing messages. If not configured or empty string provided, hostname (system name) will be set.

◆ setOriginRealmName()

void anna::diameter::comm::Engine::setOriginRealmName ( const std::string &  originRealmName)

Diameter application node origin realm

Parameters
originRealmNameUsed to configure the Origin-Realm for outgoing messages. If not configured or empty string provided, host domainname will be set.

◆ setWatchdogPeriod()

void anna::diameter::comm::Engine::setWatchdogPeriod ( const anna::Millisecond wp)
noexcept

Sets the watchdog period (DWR) for client-sessions. Its recommended to set this global configuration although it is possible to configure each client-session separately.

Parameters
wpWatchdog period.

Friends And Related Function Documentation

◆ ClientSession

friend class ClientSession
friend

◆ Entity

friend class Entity
friend

◆ LocalServer

friend class LocalServer
friend

◆ Server

friend class Server
friend

◆ ServerSession

friend class ServerSession
friend

◆ ServerSocket

friend class ServerSocket
friend

◆ Session

friend class Session
friend

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