EpcTools
An event based multi-threaded C++ development framework.
Public Member Functions | Protected Member Functions | List of all members
FDMessage Class Reference

Represents a freeDiameter message. More...

#include <efd.h>

Inheritance diagram for FDMessage:
FDMessageAnswer FDMessageRequest

Public Member Functions

FDDictionaryEntryCommandgetCommand ()
 
FDMessageadd (FDAvp &avp)
 Adds the contents of "avp" to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, int32_t v)
 Adds an int32_t value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, int64_t v)
 Adds an int64_t value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, uint32_t v)
 Adds an uint32_t value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, uint64_t v)
 Adds an uint64_t value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, float v)
 Adds a float value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, double v)
 Adds a double value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, const char *v)
 Adds a string value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, const std::string &v)
 Adds a string value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, const char *v, size_t len)
 Adds an octet string value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, const uint8_t *v, size_t len)
 Adds an octet string value to this message. More...
 
FDMessageadd (FDDictionaryEntryAVP &de, const ETime &v)
 Adds a time value to this message. More...
 
FDMessageadd (FDExtractor &e)
 Adds the AVP's associated with the FDExtractor object to this AVP. More...
 
FDMessageadd (FDExtractorList &el)
 Adds the AVP's associated with the FDExtractorList object to this AVP. More...
 
FDMessageadd (FDExtractorAvp &ea)
 Adds the AVP's associated with the FDExtractorAvp object to this AVP. More...
 
FDMessageadd (FDExtractorAvpList &eal)
 Adds the AVP's associated with the FDExtractorAvpList object to this AVP. More...
 
Bool get (FDDictionaryEntryAVP &de, int32_t &v)
 Retrieves the int32_t AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, int64_t &v)
 Retrieves the int64_t AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, uint32_t &v)
 Retrieves the uint32_t AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, uint64_t &v)
 Retrieves the uint64_t AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, float &v)
 Retrieves the float AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, double &v)
 Retrieves the double AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, std::string &v)
 Retrieves the string AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, char *v, size_t &len)
 Retrieves the octet string AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, uint8_t *v, size_t &len)
 Retrieves the octet string AVP value associated with specified dictionary entry. More...
 
Bool get (FDDictionaryEntryAVP &de, ETime &v)
 Retrieves the time AVP value associated with specified dictionary entry. More...
 
FDAvp findAVP (FDDictionaryEntryAVP &de)
 Retrieves the AVP object specified by the dictionary entry from this message. More...
 
FDAvp getFirstAVP (Bool &found)
 Retrieves the first AVP object from this message. More...
 
Void dump ()
 Prints the AVP contents of this message. More...
 
Bool isRequest ()
 Indicates if this message is a request. More...
 
Bool isAnswer ()
 Indicates if this message is an answer. More...
 
struct msg * getMsg ()
 Retrieves the freeDiameter message pointer. More...
 
Void addOrigin ()
 Adds the Origin-Host and Origin-Realm to this message. More...
 
FDMessageaddJson (const char *json)
 Adds the AVP's represented in the JSON string. More...
 
FDMessageaddJson (const std::string &json)
 Adds the AVP's represented in the JSON string. More...
 
Bool getJson (std::string &json)
 Retrieves a JSON string with all of the AVP's represented in it. More...
 

Protected Member Functions

 FDMessage (Bool req2ans, FDDictionaryEntryCommand *de, struct msg *pmsg=NULL, Bool dedel=false, Bool msgdel=true)
 Class constructor. More...
 
 FDMessage (FDDictionaryEntryCommand *de, struct msg *pmsg=NULL, Bool dedel=false)
 Class constructor. More...
 
 FDMessage (FDDictionaryEntryApplication *ade, FDDictionaryEntryCommand *cde, struct msg *pmsg=NULL, Bool dedel=false)
 Class constructor. More...
 
 ~FDMessage ()
 Class destructor. More...
 
FDMessagesendRequest (Void(*anscb)(Void *, struct msg **), FDMessageRequest &req)
 Sends a request message. More...
 
FDMessagesendAnswer ()
 Sends an answer message;. More...
 
Void setMsgDelete (Bool v)
 Sets value indicating if the freeDiameter message object is to be deleted when this object is destroyed. More...
 

Detailed Description

Represents a freeDiameter message.

Constructor & Destructor Documentation

◆ FDMessage() [1/3]

FDMessage::FDMessage ( Bool  req2ans,
FDDictionaryEntryCommand de,
struct msg *  pmsg = NULL,
Bool  dedel = false,
Bool  msgdel = true 
)
protected

Class constructor.

Parameters
req2ansindicates to construct an answer message based on the provided request message pointer.
dethe associated command dictionary entry.
pmsgpointer to the freeDiameter message object.
dedelindicates if the dictionary entry object is to be destroyed when this object is destroyed.
msgdelindicates if the freeDiameter message object is to be free'ed when this object is destroyed.
Exceptions
FDException

◆ FDMessage() [2/3]

FDMessage::FDMessage ( FDDictionaryEntryCommand de,
struct msg *  pmsg = NULL,
Bool  dedel = false 
)
protected

Class constructor.

Parameters
dethe associated command dictionary entry.
pmsgpointer to the freeDiameter message object.
dedelindicates if the dictionary entry object is to be destroyed when this object is destroyed.
Exceptions
FDException

◆ FDMessage() [3/3]

FDMessage::FDMessage ( FDDictionaryEntryApplication ade,
FDDictionaryEntryCommand cde,
struct msg *  pmsg = NULL,
Bool  dedel = false 
)
protected

Class constructor.

Parameters
adethe application dictionary entry.
cdethe associated command dictionary entry.
pmsgpointer to the freeDiameter message object.
dedelindicates if the dictionary entry object is to be destroyed when this object is destroyed.
Exceptions
FDException

◆ ~FDMessage()

FDMessage::~FDMessage ( )
protected

Class destructor.

Member Function Documentation

◆ add() [1/16]

FDMessage& FDMessage::add ( FDAvp avp)
inline

Adds the contents of "avp" to this message.

Parameters
avpthe AVP to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [2/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
const char *  v 
)
inline

Adds a string value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [3/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
const char *  v,
size_t  len 
)
inline

Adds an octet string value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
lenthe length of the octet string to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [4/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
const ETime v 
)
inline

Adds a time value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [5/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
const std::string &  v 
)
inline

Adds a string value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [6/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
const uint8_t *  v,
size_t  len 
)
inline

Adds an octet string value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
lenthe length of the octet string to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [7/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
double  v 
)
inline

Adds a double value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [8/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
float  v 
)
inline

Adds a float value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [9/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
int32_t  v 
)
inline

Adds an int32_t value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [10/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
int64_t  v 
)
inline

Adds an int64_t value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [11/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
uint32_t  v 
)
inline

Adds an uint32_t value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [12/16]

FDMessage& FDMessage::add ( FDDictionaryEntryAVP de,
uint64_t  v 
)
inline

Adds an uint64_t value to this message.

Parameters
dethe dictionary entry of the AVP to add.
vthe value to add.
Returns
a reference to this message object.
Exceptions
FDException

◆ add() [13/16]

FDMessage & FDMessage::add ( FDExtractor e)

Adds the AVP's associated with the FDExtractor object to this AVP.

Parameters
ethe FDExtractor object reference to copy.
Returns
reference to this message object.
Exceptions
FDException

◆ add() [14/16]

FDMessage & FDMessage::add ( FDExtractorAvp ea)

Adds the AVP's associated with the FDExtractorAvp object to this AVP.

Parameters
eathe FDExtractorAvp object reference to copy.
Returns
reference to this message object.
Exceptions
FDException

◆ add() [15/16]

FDMessage & FDMessage::add ( FDExtractorAvpList eal)

Adds the AVP's associated with the FDExtractorAvpList object to this AVP.

Parameters
ealthe FDExtractorAvpList object reference to copy.
Returns
reference to this message object.
Exceptions
FDException

◆ add() [16/16]

FDMessage & FDMessage::add ( FDExtractorList el)

Adds the AVP's associated with the FDExtractorList object to this AVP.

Parameters
elthe FDExtractor object reference to copy.
Returns
reference to this message object.
Exceptions
FDException

◆ addJson() [1/2]

FDMessage & FDMessage::addJson ( const char *  json)

Adds the AVP's represented in the JSON string.

Parameters
jsonthe JSON string.
Returns
reference to this message object.
Exceptions
FDException

◆ addJson() [2/2]

FDMessage& FDMessage::addJson ( const std::string &  json)
inline

Adds the AVP's represented in the JSON string.

Parameters
jsonthe JSON string.
Returns
reference to this message object.
Exceptions
FDException

◆ addOrigin()

Void FDMessage::addOrigin ( )

Adds the Origin-Host and Origin-Realm to this message.

Exceptions
FDException

◆ dump()

Void FDMessage::dump ( )

Prints the AVP contents of this message.

◆ findAVP()

FDAvp FDMessage::findAVP ( FDDictionaryEntryAVP de)

Retrieves the AVP object specified by the dictionary entry from this message.

Parameters
dethe AVP dictionary entry to search for.
Returns
the FDAvp object.
Exceptions
FDException

◆ get() [1/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
char *  v,
size_t &  len 
)
inline

Retrieves the octet string AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
lenthe maximum length of the octet string.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [2/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
double &  v 
)
inline

Retrieves the double AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [3/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
ETime v 
)
inline

Retrieves the time AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [4/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
float &  v 
)
inline

Retrieves the float AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [5/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
int32_t &  v 
)
inline

Retrieves the int32_t AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [6/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
int64_t &  v 
)
inline

Retrieves the int64_t AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [7/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
std::string &  v 
)
inline

Retrieves the string AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [8/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
uint32_t &  v 
)
inline

Retrieves the uint32_t AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [9/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
uint64_t &  v 
)
inline

Retrieves the uint64_t AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ get() [10/10]

Bool FDMessage::get ( FDDictionaryEntryAVP de,
uint8_t *  v,
size_t &  len 
)
inline

Retrieves the octet string AVP value associated with specified dictionary entry.

Parameters
dethe dictionary entry of the AVP to retrieve.
vthe variable to populate.
lenthe maximum length of the octet string.
Returns
True if the value was retrieved, otherwise False.
Exceptions
FDException

◆ getCommand()

FDDictionaryEntryCommand* FDMessage::getCommand ( )
inline

◆ getFirstAVP()

FDAvp FDMessage::getFirstAVP ( Bool &  found)

Retrieves the first AVP object from this message.

Parameters
foundindicates if the first entry was found.
Returns
the FDAvp object.
Exceptions
FDException

◆ getJson()

Bool FDMessage::getJson ( std::string &  json)

Retrieves a JSON string with all of the AVP's represented in it.

Parameters
jsonthe JSON string object to populate.
Returns
True if the AVP's were successfully converted to a string, otherwise False.

◆ getMsg()

struct msg* FDMessage::getMsg ( )
inline

Retrieves the freeDiameter message pointer.

Returns
the freeDiameter message pointer.

◆ isAnswer()

Bool FDMessage::isAnswer ( )
inline

Indicates if this message is an answer.

Returns
True if this message is an answer, otherwise False.

◆ isRequest()

Bool FDMessage::isRequest ( )
inline

Indicates if this message is a request.

Returns
True if this message is a request, otherwise False.

◆ sendAnswer()

FDMessage & FDMessage::sendAnswer ( )
protected

Sends an answer message;.

Returns
reference to this message object.
Exceptions
FDException

◆ sendRequest()

FDMessage & FDMessage::sendRequest ( Void(*)(Void *, struct msg **)  anscb,
FDMessageRequest req 
)
protected

Sends a request message.

Parameters
anscban answer callback function pointer.
reqThe request message to send.
Returns
reference to this message object.
Exceptions
FDException

◆ setMsgDelete()

Void FDMessage::setMsgDelete ( Bool  v)
inlineprotected

Sets value indicating if the freeDiameter message object is to be deleted when this object is destroyed.

Parameters
vTrue to delete the freeDiameter message pointer, otherwise False.

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