9 #ifndef anna_diameter_codec_Message_hpp 10 #define anna_diameter_codec_Message_hpp 86 int a_insertionPositionForChilds;
114 U24 getLength()
const ;
118 bool flagsOK(
int &rc)
const ;
119 int addChild(
Avp *avp) {
return Avp::addChild(a_avps, a_insertionPositionForChilds, avp); }
122 void setFailedAvp(
const parent_t &
parent,
AvpId wrong,
const char *wrongName = NULL) noexcept(
false);
153 virtual Engine * getEngine() const noexcept(false);
159 virtual
void initialize() ;
199 void setEngine(
Engine *engine) ;
203 static const
int HeaderLength;
217 static const
U8 RBitMask;
218 static const
U8 PBitMask;
219 static const
U8 EBitMask;
220 static const
U8 TBitMask;
242 void setId(
CommandId id) noexcept(false);
247 void setId(const
char *name) noexcept(false);
254 void setVersion(
U8 version) { a_version = version; }
262 void setProxiableBit(
bool activate =
true) {
if(activate) a_flags |= PBitMask;
else a_flags &= (~PBitMask); }
271 void setErrorBit(
bool activate =
true) {
if(isRequest())
return;
if(activate) a_flags |= EBitMask;
else a_flags &= (~EBitMask); }
297 void setApplicationId(
U32 aid) noexcept(
false);
321 if(!request.getId().second)
return;
323 a_engine = request.getEngine();
325 setId(
CommandId(request.getId().first, !request.getId().second));
326 setVersion(request.getVersion());
327 setApplicationId(request.getApplicationId());
328 setHopByHop(request.getHopByHop());
329 setEndToEnd(request.getEndToEnd());
330 setProxiableBit(request.proxiableBit());
400 void setStandardToAnswer(
const Message &request,
const std::string &originHost,
const std::string &originRealm,
int resultCode = helpers::base::AVPVALUES__Result_Code::DIAMETER_SUCCESS) noexcept(
false);
438 void setResultCode(
int rc = helpers::base::AVPVALUES__Result_Code::DIAMETER_SUCCESS) noexcept(
false);
447 int getResultCode()
const ;
457 Avp *
addAvp(
AvpId id) noexcept(
false) {
return Avp::addAvp(a_avps, a_insertionPositionForChilds,
id, getEngine()); }
463 Avp * addAvp(
const char *name) noexcept(
false);
494 bool removeAvp(
const char *name,
int ocurrence = 1) noexcept(
false);
508 virtual void clear(
bool resetEngine =
true) noexcept(
false);
539 bool valid(
Message *ptrAnswer = NULL)
const noexcept(
false);
557 void loadXMLFile(
const std::string &xmlPathFile) noexcept(
false);
568 void loadXMLString(
const std::string &xmlString) noexcept(
false);
619 bool requestBit()
const {
return ((a_flags & RBitMask) != 0x00); }
625 bool errorBit()
const {
return ((a_flags & EBitMask) != 0x00); }
660 return Avp::getAvp(a_avps, (
find_container&)a_finds,
id, ocurrence, getEngine(), emode);
664 return const_cast<Avp*
>(Avp::getAvp(a_avps, (
find_container&)a_finds,
id, ocurrence, getEngine(), emode));
672 return _getAvp(name, ocurrence, emode);
676 return const_cast<Avp*
>(_getAvp(name, ocurrence, emode));
691 int countAvp(
const char *name)
const noexcept(
false);
723 std::string asXMLString(
bool normalize =
false)
const ;
791 bool isLike(
const std::string &pattern)
const ;
Definition: Exception.hpp:26
void setHeaderToAnswer(const Message &request) noexcept(false)
Definition: Message.hpp:320
Avp * getAvp(const char *name, int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:675
int countChilds() const
Definition: Message.hpp:698
avp_container::const_iterator const_avp_iterator
Definition: Avp.hpp:79
Definition: Engine.hpp:42
_v
Definition: Exception.hpp:26
bool proxiableBit() const
Definition: Message.hpp:622
void setHopByHop(U32 hbh)
Definition: Message.hpp:303
void setProxiableBit(bool activate=true)
Definition: Message.hpp:262
bool removeAvp(AvpId id, int ocurrence=1) noexcept(false)
Definition: Message.hpp:488
void setPotentiallyReTransmittedMessageBit(bool activate=true)
Definition: Message.hpp:280
bool isAnswer() const
Definition: Message.hpp:593
uint32_t U32
Definition: defines.hpp:75
bool isRequest() const
Definition: Message.hpp:588
std::pair< S32, S32 > AvpId
Definition: defines.hpp:31
const Avp * getAvp(const char *name, int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) const noexcept(false)
Definition: Message.hpp:671
void setEndToEnd(U32 ete)
Definition: Message.hpp:309
bool requestBit() const
Definition: Message.hpp:619
Engine * a_engine
Definition: Message.hpp:150
Definition: Message.hpp:74
U32 U24
Definition: defines.hpp:96
std::string asXMLString(bool normalize=false) const
int countAvp(AvpId id) const
Definition: Message.hpp:686
const CommandId & getId() const
Definition: Message.hpp:576
const anna::diameter::stack::Command * getStackCommand() const noexcept(false)
Definition: Message.hpp:616
bool potentiallyReTransmittedMessageBit() const
Definition: Message.hpp:628
unsigned char U8
Definition: defines.hpp:62
U8 getVersion() const
Definition: Message.hpp:583
Definition: Command.hpp:48
void setErrorBit(bool activate=true)
Definition: Message.hpp:271
const Avp * getAvp(AvpId id, int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) const noexcept(false)
Definition: Message.hpp:659
Avp * getAvp(AvpId id, int ocurrence=1, anna::Exception::Mode::_v emode=anna::Exception::Mode::Throw) noexcept(false)
Definition: Message.hpp:663
std::pair< U24, bool > CommandId
Definition: defines.hpp:32
bool errorBit() const
Definition: Message.hpp:625
std::map< find_key, Avp * > find_container
Definition: Avp.hpp:83
avp_container::iterator avp_iterator
Definition: Avp.hpp:78
Definition: DataBlock.hpp:24
const U32 & getEndToEnd() const
Definition: Message.hpp:611
Definition: functions.hpp:118
const U32 & getHopByHop() const
Definition: Message.hpp:605
const U32 & getApplicationId() const
Definition: Message.hpp:599
std::map< int, Avp *> avp_container
Definition: Avp.hpp:74
Avp * addAvp(AvpId id) noexcept(false)
Definition: Message.hpp:457