#include <LocalServer.hpp>
◆ LocalServer()
anna::diameter::comm::LocalServer::LocalServer |
( |
| ) |
|
◆ ~LocalServer()
anna::diameter::comm::LocalServer::~LocalServer |
( |
| ) |
|
|
inline |
Destructor
void close() noexcept(false)
◆ asString()
std::string anna::diameter::comm::LocalServer::asString |
( |
| ) |
const |
Class string representation
- Returns
- String with relevant information for this instance.
◆ asXML()
Class xml representation
- Parameters
-
parent | Parent XML node on which hold this instance information. |
- Returns
- XML document with relevant information for this instance.
◆ broadcast() [1/2]
bool anna::diameter::comm::LocalServer::broadcast |
( |
const Message * |
message | ) |
|
|
noexcept |
Sent a message to all the server sessions. It is used, i.e., in Disconnect-Peer-Request procedure over a certain entity.
- Parameters
-
message | Message which is being sent. |
- Returns
- Returns true (success) only when broadcast is success over all the entity servers. If any server fails, then false is returned.
◆ broadcast() [2/2]
bool anna::diameter::comm::LocalServer::broadcast |
( |
const Message & |
message | ) |
|
|
inlinenoexcept |
bool broadcast(const Message *message) noexcept(false)
◆ close()
void anna::diameter::comm::LocalServer::close |
( |
| ) |
|
|
noexcept |
Close the local server means two things: close the server socket and close all the server sessions born from this local server freeing such server sessions resources.
◆ disable()
void anna::diameter::comm::LocalServer::disable |
( |
bool |
lock = false | ) |
|
|
noexcept |
Disables local server socket (listener) keeping current server sessions alive. Note that applications should not close the listen port directly to keep coherence (see resetConnectionsMargin)
- Parameters
-
lock | Locks disabled state (make it permanent even if new connections margin is reached). Used during diameter agent isolation (lost of service, maintenance, etc.) |
◆ enable()
void anna::diameter::comm::LocalServer::enable |
( |
bool |
unlock = false | ) |
|
|
noexcept |
Enables local server socket (listener)
- Parameters
-
unlock | Unlocks permanent disabled states |
◆ eventDPA()
|
protectedpure virtualnoexcept |
Handler for diameter client Disconnect-Peer-Answer messages
- Parameters
-
serverSession | ServerSession from which request has been received |
response | Answer data block object without context match |
myNode | Own origin host |
◆ eventPeerShutdown()
virtual void anna::diameter::comm::LocalServer::eventPeerShutdown |
( |
const ServerSession * |
serverSession | ) |
|
|
protectedvirtual |
Handler about event break connection from diameter client over this server-session. When notified, ANNA.diameter.comm generates an diameter::comm::ServerSession::eventResponse for every request with pending answers. Default implementation traces warning event
- Parameters
-
◆ eventRequest()
|
protectedpure virtualnoexcept |
Handler for diameter client requests
- Parameters
-
serverSession | ServerSession from which request has been received |
request | Request data block object for corresponding diameter reception |
myNode | Own origin host |
◆ eventRequestRetransmission()
virtual void anna::diameter::comm::LocalServer::eventRequestRetransmission |
( |
const ServerSession * |
serverSession, |
|
|
Message * |
request |
|
) |
| |
|
protectedvirtual |
Handler about a request retransmission over the server-session. Default implementation traces warning event
- Parameters
-
serverSession | ServerSession from which retransmission happened |
request | Retransmitted request message |
◆ eventResponse()
|
protectedpure virtualnoexcept |
Handler for diameter client responses
- Parameters
-
response | Answer container object for corresponding diameter request |
myNode | Own origin host |
◆ eventUnknownResponse()
|
protectedpure virtualnoexcept |
Handler for diameter client responses out of context
- Parameters
-
serverSession | ServerSession from which request has been received |
response | Answer data block object without context match |
myNode | Own origin host |
◆ findServerSession() [1/2]
Returns server-session instance identified by client socket provided.
- Parameters
-
clientSocket | Client socket associated to the server session |
emode | Action when no client-session is found with provided parameters (Throw/Ignore). |
- Returns
- The server-session instance identified by client socket provided.
- Warning
- If no server-session found, an exception is launched by default.
◆ findServerSession() [2/2]
Returns server-session instance identified by socket id provided (hash over serialized client socket information).
- Parameters
-
socketId | Socket id which is key for the server session |
emode | Action when no client-session is found with provided parameters (Throw/Ignore). |
- Returns
- The server-session instance identified by client socket provided.
- Warning
- If no server-session found, an exception is launched by default.
◆ getAllowedInactivityTime()
const anna::Millisecond& anna::diameter::comm::LocalServer::getAllowedInactivityTime |
( |
| ) |
const |
|
inline |
Gets the maximum allowed inactivity time on server sessions born over the local server before being reset
- Returns
- Inactivity time allowed
210 {
return a_allowedInactivityTime; }
◆ getCurrentConnections()
int anna::diameter::comm::LocalServer::getCurrentConnections |
( |
| ) |
const |
|
inline |
Gets the number of current connections being established through server socket
203 {
return a_currentConnections; }
◆ getKey()
const socket_t& anna::diameter::comm::LocalServer::getKey |
( |
| ) |
const |
|
inline |
◆ getLastUsedResource()
ServerSession* anna::diameter::comm::LocalServer::getLastUsedResource |
( |
| ) |
const |
|
inline |
Gets the last used resource (server session) during sending. Broadcast doesn't updates this information.
306 {
return (a_lastUsedResource); }
◆ getMaxConnections()
int anna::diameter::comm::LocalServer::getMaxConnections |
( |
| ) |
const |
|
inline |
Gets the number of maximum accepted connections that server socket is configured to handle
198 {
return a_maxConnections; }
◆ getOTARequests()
int anna::diameter::comm::LocalServer::getOTARequests |
( |
| ) |
const |
Gets the number of requests messages over-the-air.
- Returns
- OTA messages.
◆ idle()
bool anna::diameter::comm::LocalServer::idle |
( |
| ) |
const |
|
inline |
Returns idle state (no pending answers).
- Returns
- Idle state.
int getOTARequests() const
◆ isAvailable()
bool anna::diameter::comm::LocalServer::isAvailable |
( |
| ) |
const |
|
inline |
Returns true when any of the server-sessions is Bound. False when all not-bound.
215 {
return a_available; }
◆ readSocketId()
virtual int anna::diameter::comm::LocalServer::readSocketId |
( |
const Message * |
message | ) |
const |
|
inlinevirtual |
Before sending a message over each local server, socketId could be specified to select which session within such server will manage the message.
Default implementation performs round-robin (value '-1' for socketId) but any other kind of application could re-implement this method and change the behaviour.
- Parameters
-
message | Message which is being sent. |
- Returns
- Socket-id (hash over serialized client socket information). Value '-1' if round-robin is desired. If socket-id is unkonwn, send procedure will throw an exception.
◆ resetConnectionsMargin()
void anna::diameter::comm::LocalServer::resetConnectionsMargin |
( |
| ) |
|
|
inlinenoexcept |
Performs coherent server socket close procedure zeroing margin between current established connections and maximum allowed.
void setMaxConnections(int maxConnections) noexcept(false)
◆ send() [1/2]
bool anna::diameter::comm::LocalServer::send |
( |
const Message * |
, |
|
|
int |
socketId = -1 |
|
) |
| |
|
noexcept |
Sent a message to the client using a certain server-session provided or defined by readSocketId if not. 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 #LocalServer::eventResponse. This timeout value will be configured at setClassCodeTimeout.
- Parameters
-
message | Message sent. |
socketId | Server session socket id INetAddress serialization. By default, readSocketId is invoked to get the socket id used (which uses round-robin if not re-implemented) |
- Returns
- Boolean about success in send operation. True when any of the server sessions could send the message. False, when neither of the server sessions was available or fail to send the message. Broadcast try to send all over the resources in spite of any fail. If a specific socket id is provided, only this socket is used without trying any other and returning false if fails.
◆ send() [2/2]
bool anna::diameter::comm::LocalServer::send |
( |
const Message & |
message, |
|
|
int |
socketId = -1 |
|
) |
| |
|
inlinenoexcept |
300 {
return send(&message, socketId); }
bool send(const Message *, int socketId=-1) noexcept(false)
◆ setAllowedInactivityTime()
void anna::diameter::comm::LocalServer::setAllowedInactivityTime |
( |
const anna::Millisecond & |
allowedInactivityTime | ) |
|
|
inline |
Sets the maximum allowed inactivity time on server sessions born over the local server before being reset. Communication engine assign a default value of 90000 msecs.
- Parameters
-
allowedInactivityTime | Inactivity time allowed |
179 { a_allowedInactivityTime = allowedInactivityTime; }
◆ setCategory()
void anna::diameter::comm::LocalServer::setCategory |
( |
int |
category | ) |
|
|
inline |
Sets the server socket optional category
- Parameters
-
description | Server socket category |
161 { a_category = category; }
◆ setClassCodeTimeout()
Set timeout to consider failed a request.
- Parameters
-
v | Requests class code. |
millisecond | Milliseconds wait before considering the requests failed. |
Timers are internally managed and automatically activated.
◆ setDescription()
void anna::diameter::comm::LocalServer::setDescription |
( |
const std::string |
description | ) |
|
|
inline |
Sets the server socket optional description
- Parameters
-
description | Server socket description |
145 { a_description = description; }
◆ setEngine()
void anna::diameter::comm::LocalServer::setEngine |
( |
Engine * |
e | ) |
|
|
inline |
◆ setKey()
void anna::diameter::comm::LocalServer::setKey |
( |
const socket_t & |
key | ) |
|
|
inline |
Sets the local server key
- Parameters
-
◆ setMaxConnections()
void anna::diameter::comm::LocalServer::setMaxConnections |
( |
int |
maxConnections | ) |
|
|
noexcept |
Sets the maximum supported connections. If provided value is negative or lesser than the number of current connections, an exception will be launched. If all the connections was established, a new maximum will open the listen port. when margin is zeroed (maximum configured is equal to current connections), listen port will be closed.
- Parameters
-
maxConnections | Number of maximum connections allowed |
◆ updateProcessingTimeStatisticConcept()
void anna::diameter::comm::LocalServer::updateProcessingTimeStatisticConcept |
( |
const double & |
value, |
|
|
const anna::diameter::CommandId & |
cid |
|
) |
| |
◆ updateReceivedMessageSizeStatisticConcept()
void anna::diameter::comm::LocalServer::updateReceivedMessageSizeStatisticConcept |
( |
const double & |
value, |
|
|
const anna::diameter::CommandId & |
cid |
|
) |
| |
◆ anna::diameter::comm::Timer
◆ Engine
◆ ServerSession
◆ ServerSessionReceiver
◆ ServerSocket
The documentation for this class was generated from the following file: