ANNA Suite
2020b
Multipurpose development suite for Telco applications
|
#include <Entity.hpp>
Classes | |
struct | SessionBasedModelsType |
Public Member Functions | |
Entity (int maxServers=2) | |
void | setMaxServers (int maxServers) |
int | getMaxServers () const |
void | setDescription (const std::string &description) |
const std::string & | getDescription () const |
void | setEngine (Engine *e) |
Engine * | getEngine () const |
void | addServer (const socket_t &serverId) noexcept(false) |
bool | bind () noexcept(false) |
void | raiseAutoRecovery (bool autoRecovery=true) noexcept(false) |
void | setClassCodeTimeout (const ClassCode::_v v, const anna::Millisecond &millisecond) |
void | setCategory (int category) |
int | getCategory () const |
Server * | getLastUsedResource () const |
void | setBalance (bool balance) |
bool | getBalance () const |
bool | send (const Message *message) noexcept(false) |
bool | send (const Message &message) noexcept(false) |
void | setSessionBasedModelsType (const SessionBasedModelsType::_v sessionBasedModelsType) |
SessionBasedModelsType::_v | getSessionBasedModelsType () const |
virtual int | readSocketId (const Message *message, int maxClientSessions) const |
bool | broadcast (const Message *message) noexcept(false) |
bool | broadcast (const Message &message) noexcept(false) |
bool | isAvailable () const |
bool | isDeprecated () const |
void | setDeprecated (bool deprecated=true) |
int | getOTARequests () const |
bool | idle () const |
std::vector< Server * >::iterator | begin () |
std::vector< Server * >::iterator | end () |
std::vector< Server * >::const_iterator | begin () const |
std::vector< Server * >::const_iterator | end () const |
void | close () noexcept(false) |
int | getNumberOfServers () const |
int | getMaxServerss () const |
socket_v | getAddressPortList () const |
void | hide () |
void | show () |
bool | hidden () const |
bool | shown () const |
std::string | asString () const |
anna::xml::Node * | asXML (anna::xml::Node *parent) const |
Protected Member Functions | |
virtual void | eventPeerShutdown (const ClientSession *clientSession) |
virtual void | eventRequestRetransmission (const ClientSession *clientSession, Message *request) |
virtual void | eventResponse (const Response &response, const anna::diameter::comm::OriginHost *myNode) noexcept(false)=0 |
virtual void | eventRequest (ClientSession *clientSession, const anna::DataBlock &request, const anna::diameter::comm::OriginHost *myNode) noexcept(false)=0 |
virtual void | eventUnknownResponse (ClientSession *clientSession, const anna::DataBlock &response, const anna::diameter::comm::OriginHost *myNode) noexcept(false)=0 |
virtual void | eventDPA (ClientSession *clientSession, const anna::DataBlock &response, const anna::diameter::comm::OriginHost *myNode) noexcept(false)=0 |
Friends | |
class | Engine |
class | Server |
Generic diameter server list (N-servers entity)
|
inline |
Default constructor. Entities should be create through diameter::comm::Engine
maxServers | Maximum number of servers managed by the entity. Default is 2 (standard/dual entity). The value -1, means no limit to add servers. |
|
noexcept |
Add a server to the entity and create all the servers configured at #setSocketsPerDiameterServer within that server.
serverId | Diameter server ip/port. |
std::string anna::diameter::comm::Entity::asString | ( | ) | const |
Class string representation
anna::xml::Node* anna::diameter::comm::Entity::asXML | ( | anna::xml::Node * | parent | ) | const |
Class xml representation
parent | Parent XML node on which hold this instance information. |
|
inline |
|
inline |
|
noexcept |
Binds entity servers.
|
noexcept |
Sent a message to all the entity servers. It is used, i.e., in Disconnect-Peer-Request procedure over a certain entity.
message | Message which is being sent. |
|
inlinenoexcept |
|
inlinenoexcept |
Close all the entity servers (close client-sessions within them). Depending on client-session configuration ('OnDisconnect' behaviour), pending answers will be wait (graceful) or ignored (immediate-abrupt close). Resources are not destroyed.
|
inline |
|
inline |
|
protectedpure virtualnoexcept |
Handler for diameter session Disconnect-Peer-Answer messages
clientSession | ClientSession from which request has been received |
response | Answer data block object without context match |
myNode | Own origin host |
|
protectedvirtual |
Handler about event break connection from diameter server (server) over this entity. When notified, ANNA.diameter.comm generates an diameter::comm::Entity::eventResponse for every request with pending answers. Default implementation traces warning event
clientSession | ClientSession from which shutdown has been received |
|
protectedpure virtualnoexcept |
Handler for diameter server (server) requests
clientSession | ClientSession from which request has been received |
request | Diameter request message received |
myNode | Own origin host |
|
protectedvirtual |
Handler about a request retransmission over the session. Default implementation traces warning event
clientSession | ClientSession from which retransmission happened |
request | Retransmitted request message |
|
protectedpure virtualnoexcept |
Handler for diameter server (server) responses
response | Answer container object for corresponding diameter request |
myNode | Own origin host |
|
protectedpure virtualnoexcept |
Handler for diameter session responses out of context
clientSession | ClientSession from which request has been received |
response | Answer data block object without context match |
myNode | Own origin host |
socket_v anna::diameter::comm::Entity::getAddressPortList | ( | ) | const |
List of (address,port) pairs defining entity servers
|
inline |
|
inline |
Gets entity category. Used by application in order to categorize or clasify.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int anna::diameter::comm::Entity::getOTARequests | ( | ) | const |
Gets the number of requests messages over-the-air.
|
inline |
Returns sessions based models type.
bool anna::diameter::comm::Entity::hidden | ( | ) | const |
Returns true when all its servers resources are hidden for application messages delivery
void anna::diameter::comm::Entity::hide | ( | ) |
Deny resources for delivery restriction. Deny all its servers
|
inline |
Returns idle state (no pending answers).
|
inline |
|
inline |
|
noexcept |
Propagate auto recovery configuration to servers within entity
autoRecovery | Auto recovery indicator. True by default. |
|
virtual |
Before sending a message over each entity server, socketId could be specified to select which client session within such server will manage the message.
Default implementation has been focused on charging applications but any other kind of application could re-implement this method and change the behaviour:
Charging involves two peers:
Charging Trigger Function (CTF): Makes decisions on how to charge the user for specific services, issues requests to the server (OCF). Online Charging Function (OCF): Performs actual charging based on received message type, service logic and user profile information.
There are three main scenarios:
Immediate Event Charging (IEC): The CTF sends a one time request. This request contains a predefined set of AVPs indicating which service has been activated or how many units have been consumed (this depends on application logic).
Event Charging with Unit Reservation (ECUR): The CTF issues a request which indicates the desired unit count for reservation. On service delivery, the CTF issues another request which indicates how many units were actually consumed. Units can be of any type, as they are application specific.
Session Charging with Unit Reservation(SCUR): As above, however reservation can happen more than once.
In order to minimize race conditions within trasactions, default implementation will select the connection fixed by an stickiness value (Session-Id will be used) for ECUR and SCUR models (Data, Voice and Content traffic). IEC model, represented by SMS ans MMS traffic will use round-robin between sockets. The type of traffic will be analyzed by mean Service-Context-Id AVP. If traffic type is not reconized, value of '-1' will be returned doing round-robin socket selection within active server.
Diameter session-oriented load balancing enables to distribute Diameter signaling traffic across multiple client sessions for the selected entity server. Application could re-implement different load balancing policies, including support for session stickiness and business decisions, and subscriber and service aware contextual load balancing strategies. By default, Session-Id avp is used to select the resource. Session-Id is split into 4 sections: diameter identity, high part, low part and optional part. Default implementation analizes 'low' part, returning its value as reference for socket selection. Use to change this behaviour.
When server is configured as single client session (max client sessions equal to 1), entity will ignore this method being more efficient, because former algorithms would not affect the session selection.
message | Message which is being sent. |
maxClientSessions | Number of client-sessions on specific server prepared for send. |
|
noexcept |
Sent a message to the entity. First uses primary server, secondary if fails and so on to the last defined resource (server) within entity. Another sending algorithm (non standard) could be enabled (balance boolean parameter): it consist in round-robin server selection without trying any one if fails (standard behaviour tries all servers from FIRST defined). Anyway, last used delivery resource could be known through getLastUsedResource().
When the message is a request, a timer will be set automatically to control the response time. If expires, the ResultCode Timeout will be finally notified on #Entity::eventResponse. This timeout value will be configured at setClassCodeTimeout.
message | Message sent. |
balance | False by default (standard beaviour), but useful to balance over servers within entity. |
When the message is a request, a timer will be set automatically to control the response time. If expires, the ResultCode Timeout will be finally notified on #Entity::eventResponse. This timeout value will be configured at setClassCodeTimeout.
message | Message sent. |
|
inlinenoexcept |
|
inline |
|
inline |
Sets entity category. Used by application in order to categorize or clasify.
category | Entity category |
void anna::diameter::comm::Entity::setClassCodeTimeout | ( | const ClassCode::_v | v, |
const anna::Millisecond & | millisecond | ||
) |
Sets timeout for wait responses for any class code request for all entity servers
v | Diameter request type. |
millisecond | Milliseconds for timeout |
|
inline |
|
inline |
Sets the entity description.
description | Entity description. Empty by default. |
|
inline |
|
inline |
|
inline |
Sets sessions based models type.
sessionBasedModelsType | Session based models type: RoundRobin, SessionIdLowPart (default), SessionIdHighPart or SessionIdOptionalPart. |
void anna::diameter::comm::Entity::show | ( | ) |
Allow resource for delivery permission. Allow all its servers
bool anna::diameter::comm::Entity::shown | ( | ) | const |
Returns true when all its servers resources are shown for application messages delivery
|
friend |
|
friend |