return (anna::diameter::CommandId(code, (flags & Message::RBitMask) != 0x00));
}
-
-bool functions::isRequest(const anna::DataBlock & db) throw(anna::RuntimeException) {
+bool functions::requestBit(const anna::DataBlock & db) throw(anna::RuntimeException) {
if(db.getSize() < Message::HeaderLength)
throw anna::RuntimeException("Not enough bytes to cover command header length", ANNA_FILE_LOCATION);
return (((db.getData())[4] & Message::RBitMask) != 0x00);
}
+bool functions::proxiableBit(const anna::DataBlock & db) throw(anna::RuntimeException) {
+ if(db.getSize() < Message::HeaderLength)
+ throw anna::RuntimeException("Not enough bytes to cover command header length", ANNA_FILE_LOCATION);
+
+ return (((db.getData())[4] & Message::PBitMask) != 0x00);
+}
+
+bool functions::errorBit(const anna::DataBlock & db) throw(anna::RuntimeException) {
+ if(db.getSize() < Message::HeaderLength)
+ throw anna::RuntimeException("Not enough bytes to cover command header length", ANNA_FILE_LOCATION);
+
+ return (((db.getData())[4] & Message::EBitMask) != 0x00);
+}
+
+bool functions::potentiallyReTransmittedMessageBit(const anna::DataBlock & db) throw(anna::RuntimeException) {
+ if(db.getSize() < Message::HeaderLength)
+ throw anna::RuntimeException("Not enough bytes to cover command header length", ANNA_FILE_LOCATION);
+
+ return (((db.getData())[4] & Message::TBitMask) != 0x00);
+}
+
anna::diameter::ApplicationId functions::getApplicationId(const anna::DataBlock & db) throw(anna::RuntimeException) {
if(db.getSize() < Message::HeaderLength)
throw anna::RuntimeException("Not enough bytes to cover command header length", ANNA_FILE_LOCATION);
memcpy((char *)(db.getData() + 16), source, 4);
}
+void functions::setPotentiallyReTransmittedMessageBit(const anna::DataBlock & db, bool activate) throw(anna::RuntimeException) {
+ if(db.getSize() < Message::HeaderLength) {
+ throw anna::RuntimeException("Not enough bytes to cover command header length", ANNA_FILE_LOCATION);
+ }
+
+ static char flags[1];
+ flags[0] = *(db.getData() + 4);
+ if(activate) flags[0] |= Message::TBitMask; else flags[0] &= (~Message::TBitMask);
+ memcpy((char *)(db.getData() + 4), flags, 1);
+}
+