Loading codec/c++/codec.h +1 Changes for codec/c++/codec.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "msrp_codets.h" #include "diameter_codets.h" #include "gtp_codets.h" #include "enum_codets.h" namespace t3devlib { namespace gen { Loading codec/c++/common_debug_log.cpp +48 Changes for codec/c++/common_debug_log.cpp: 48 added lines, 0 removed lines. Original line number Diff line number Diff line #include <cstdio> #include <iostream> #include <fstream> #include <math.h> //compiler switches: #define DEBUG_LOG 1 namespace t3devlib { namespace gen { void debug_log(const char* pFile, const char * value) { #ifdef DEBUG_LOG std::ofstream logfile(pFile, std::ios::app); logfile << value << std::endl; logfile.close(); #endif } void debug_log_PreDecode(const char* pFile, const char * type) { #ifdef DEBUG_LOG std::ofstream logfile(pFile, std::ios::app); logfile << type << "::PreDecode: " << std::endl; logfile.close(); #endif } void debug_log_PreDecodeField(const char* pFile, const char * type, int id) { #ifdef DEBUG_LOG std::ofstream logfile(pFile, std::ios::app); logfile << type << "::PreDecodeField: " << id << std::endl; logfile.close(); #endif } void debug_log_PostDecodeField(const char* pFile, const char * type, int id) { #ifdef DEBUG_LOG std::ofstream logfile(pFile, std::ios::app); logfile << type << "::PostDecodeField: " << id << std::endl; logfile.close(); #endif } }} // namespaces codec/c++/common_debug_log.h +16 Changes for codec/c++/common_debug_log.h: 16 added lines, 0 removed lines. Original line number Diff line number Diff line #ifndef COMMON_DEBUG_LOG_H #define COMMON_DEBUG_LOG_H namespace t3devlib { namespace gen { void debug_log(const char* pFile, const char * value); void debug_log_PreDecode(const char* pFile, const char * type); void debug_log_PreDecodeField(const char* pFile, const char * type, int id); void debug_log_PostDecodeField(const char* pFile, const char * type, int id); }} //namespaces #endif codec/c++/diameter_codets.cpp +64 −38 Changes for codec/c++/diameter_codets.cpp: 64 added lines, 38 removed lines. Original line number Diff line number Diff line #include "diameter_codets.h" #include "common_sip_msrp.h" #include "common_debug_log.h" #include <iostream> #include <fstream> Loading @@ -7,9 +8,8 @@ namespace t3devlib { //compiler switches: //#define DEBUG_LOG 1 //#define DIAMETER_ONLY 1 #define DEBUG_LOG_FILE "C:\\Temp\\LibDiameter.log" #ifdef DIAMETER_ONLY Loading Loading @@ -848,7 +848,7 @@ bool isNextAVP(Buffer & buffer, unsigned int nCode) throw (DecodeError) { return nCode == getAVPCode(buffer); } /* void debug_log(const char * value) { #ifdef DEBUG_LOG Loading Loading @@ -884,6 +884,7 @@ void debug_log_PostDecodeField(const char * type, int id) logfile.close(); #endif } */ FLOAT32::FLOAT32 () :PrimitiveType() Loading Loading @@ -1320,7 +1321,7 @@ void Command_Code::Decode (Buffer& buffer) throw (DecodeError) int nCode = code.GetValue(); #ifdef DEBUG_LOG std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app); std::ofstream logfile(DEBUG_LOG_FILE, ios::app); logfile << "Command_Code::Decode::code == \"" << nCode << '"'; logfile.close(); #endif Loading Loading @@ -1383,7 +1384,7 @@ type union DIAMETER_MSG { }*/ void DIAMETER_MSG::PreDecode (Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("DIAMETER_MSG"); debug_log_PreDecode(DEBUG_LOG_FILE, "DIAMETER_MSG"); Unsigned version(8); Unsigned length(24); Loading Loading @@ -1541,7 +1542,7 @@ void DIAMETER_MSG::PreDecode (Buffer& buffer) throw (DecodeError) //exception handling void DIAMETER_MSG::PostEncode (Buffer& buffer, EncodeError& ex) throw (EncodeError) { std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app); std::ofstream logfile(DEBUG_LOG_FILE, ios::app); logfile << "DIAMETER_MSG:PostEncode:Exception: " << std::endl; logfile << ex << std::endl; logfile.close(); Loading @@ -1550,7 +1551,7 @@ void DIAMETER_MSG::PostEncode (Buffer& buffer, EncodeError& ex) throw (EncodeErr void DIAMETER_MSG::PostDecode (Buffer& buffer, DecodeError& ex) throw (DecodeError) { //#ifdef DEBUG_LOG std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app); std::ofstream logfile(DEBUG_LOG_FILE, ios::app); logfile << "DIAMETER_MSG:PostDecode:Exception: " << std::endl; logfile << ex << std::endl; logfile.close(); Loading Loading @@ -1598,7 +1599,7 @@ static unsigned int skip_AVP(Buffer& buffer) throw (DecodeError) nByteLen = nLen.GetValue(); #ifdef DEBUG_LOG std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app); std::ofstream logfile(DEBUG_LOG_FILE, ios::app); logfile << "Found AVP: " << nAVP_Code <<", Len: "<< nByteLen <<", at: " << (nStartPos / 8) << std::endl; logfile.close(); #endif Loading @@ -1612,16 +1613,25 @@ static unsigned int skip_AVP(Buffer& buffer) throw (DecodeError) return nAVP_Code; } #ifdef DIAMETER_ONLY #define DIAMETER_MSG_PreDecode(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError) \ { \ m_nStartingPosition = buffer.GetPosition(); \ Get_header().Get_cmdcode().SetHypChosenId(DiameterCommandCode::id_known_code); \ } #else #define DIAMETER_MSG_PreDecode(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError) \ { \ m_nStartingPosition = buffer.GetPosition(); \ } #endif #define DIAMETER_MSG_PostDecodeField(type) \ void type::PostDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PostDecodeField(#type, field_id); \ debug_log_PostDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_header) \ { \ unsigned int nFirstAVP_Offset = buffer.GetPosition(); \ Loading Loading @@ -1654,7 +1664,7 @@ static unsigned int skip_AVP(Buffer& buffer) throw (DecodeError) #define DIAMETER_MSG_PreDecodeField_START(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(false) {} #define DIAMETER_MSG_PreDecodeField_SINGLE_MANDATORY(fid, avpcode) \ Loading Loading @@ -1753,7 +1763,15 @@ static unsigned int skip_AVP(Buffer& buffer) throw (DecodeError) DiameterHeader header, set_of_AVP_Type aVP_Type optional }*/ #ifdef DIAMETER_ONLY void UNKNOWN_MSG::PreDecode(Buffer& buffer) throw (DecodeError) { m_nStartingPosition = buffer.GetPosition(); Get_header().Get_cmdcode().SetHypChosenId(DiameterCommandCode::id_unknown_code); } #else DIAMETER_MSG_PreDecode(UNKNOWN_MSG) #endif DIAMETER_MSG_PreDecodeField_START(UNKNOWN_MSG) DIAMETER_MSG_PreDecodeField_REMAINING DIAMETER_MSG_PreDecodeField_END(UNKNOWN_MSG) Loading @@ -1761,7 +1779,7 @@ DIAMETER_MSG_PreDecodeField_END(UNKNOWN_MSG) //DIAMETER_MSG_PostDecodeField(UNKNOWN_MSG) void UNKNOWN_MSG::PostDecodeField(int field_id, Buffer& buffer) throw (DecodeError) { debug_log_PostDecodeField("UNKNOWN_MSG", field_id); debug_log_PostDecodeField(DEBUG_LOG_FILE, "UNKNOWN_MSG", field_id); if(field_id == id_header) { unsigned int nFirstAVP_Offset = buffer.GetPosition(); Loading Loading @@ -3665,11 +3683,19 @@ type record DiameterHeader { }*/ void DiameterHeader::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("DiameterHeader", field_id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "DiameterHeader", field_id); switch (field_id) { case id_cmdcode: unsigned char buff = Get_cmdflags().Get_r_bit().GetValue().at(0); int nV_flag = (buff >> 7); if(nV_flag) #ifdef DIAMETER_ONLY if(Get_cmdcode().GetHypChosenId() == DiameterCommandCode::id_known_code) Get_cmdcode().Get_known_code().SetRequest(); #else Get_cmdcode().SetRequest(); #endif break; break; case id_hopid://mandatory in the standard Loading Loading @@ -3869,7 +3895,7 @@ void AVP_Data::PostEncode(Buffer& buffer) throw (EncodeError) } void AVP_Data::PreDecode (Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("AVP_Data"); debug_log_PreDecode(DEBUG_LOG_FILE, "AVP_Data"); int nSelectedFieldId = id_oCTETSTRING;//unknown data if(m_nExpectedData == 1)//if, by any chance I might know what the data contains... then Loading Loading @@ -3905,7 +3931,7 @@ void AVP_Data::PreDecode (Buffer& buffer) throw (DecodeError) };*/ void GROUPED::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) { debug_log_PostDecodeField("GROUPED", field_id); debug_log_PostDecodeField(DEBUG_LOG_FILE, "GROUPED", field_id); if(field_id == id_aVP_Type) {//TODO: optimize Loading Loading @@ -3962,7 +3988,7 @@ void set_of_AVP_Type::SetRemaining(std::vector<unsigned int> lAVP_Codes, std::ve void set_of_AVP_Type::PreDecode(Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("set_of_AVP_Type"); debug_log_PreDecode(DEBUG_LOG_FILE, "set_of_AVP_Type"); m_nStartingPosition = buffer.GetPosition();//TODO: for set of undecoded items, this might not work... SetHypSize(m_lAVP_Codes.size()); Loading @@ -3979,12 +4005,12 @@ void set_of_AVP_Type::PreDecode(Buffer& buffer) throw (DecodeError) } void set_of_AVP_Type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("set_of_AVP_Type", buffer.GetPosition()); debug_log_PreDecodeField(DEBUG_LOG_FILE, "set_of_AVP_Type", buffer.GetPosition()); } void set_of_AVP_Type::PostDecodeField(int id, Buffer& buffer) throw (DecodeError) { debug_log_PostDecodeField("set_of_AVP_Type", id); debug_log_PostDecodeField(DEBUG_LOG_FILE, "set_of_AVP_Type", id); if(m_lAVP_Offsets.size() > (id + 1)) { Loading Loading @@ -4053,20 +4079,20 @@ void Diameter_IpAddress::PostEncode(Buffer& buffer) throw (EncodeError) void Diameter_IpAddress::PreDecode (Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("Diameter_IpAddress"); debug_log_PreDecode(DEBUG_LOG_FILE, "Diameter_IpAddress"); } //type record length (4) of UInt8 IPv4Addr; void IPv4Addr::PreDecode(Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("IPv4Addr"); debug_log_PreDecode(DEBUG_LOG_FILE, "IPv4Addr"); SetHypSize(4); } //type record length (8) of UInt16 IPv6Addr; void IPv6Addr::PreDecode(Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("IPv6Addr"); debug_log_PreDecode(DEBUG_LOG_FILE, "IPv6Addr"); SetHypSize(8); } Loading @@ -4076,7 +4102,7 @@ void IPv6Addr::PreDecode(Buffer& buffer) throw (DecodeError) #define ADDRESS_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -4246,7 +4272,7 @@ type record DiameterURI{ */ void DiameterURI::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("DiameterURI", id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "DiameterURI", id); static Regex reg_scheme ("^(aaa://|aaas://)"); //static Regex reg_FQHN ("^[a-zA-Z][0-9a-zA-Z.:-_]+"); Loading Loading @@ -4555,7 +4581,7 @@ void SIP_AOR_Type::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) #define DIAMETER_URI_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -4686,7 +4712,7 @@ DIAMETER_URI_AVP_SET_COMMON_PostDecode(SIP_Credit_Control_Server_URI_AVP) #define OCTETSTRING_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -5125,7 +5151,7 @@ OCTETSTRING_AVP_COMMON_PostDecode(MPS_Identifier_AVP) #define UTF8STRING_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -5427,7 +5453,7 @@ UTF8STRING_AVP_COMMON_PostDecode(Cost_Unit_AVP) #define SPECIAL_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_Text) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -5645,7 +5671,7 @@ SPECIAL_AVP_COMMON_PostDecode(Digest_Response_Auth_AVP) #define DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -5737,7 +5763,7 @@ DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Proxy_Host_AVP) #define TIME_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } /*type record Tariff_Time_Change_AVP{ Loading Loading @@ -5851,7 +5877,7 @@ void IP_AddressMask::PostDecodeField (int id, Buffer& buffer) throw (DecodeError } void IP_AddressMask::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("IP_AddressMask", id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "IP_AddressMask", id); static Regex reg_addr_v4("^[ \t\v\f]*([!][ \t\v\f]*)?[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); static Regex reg_addr_v6("^[ \t\v\f]*([!][ \t\v\f]*)?[a-fA-F0-9:.]+"); Loading Loading @@ -6179,7 +6205,7 @@ void IPFilterRule_Type::PostDecodeField (int id, Buffer& buffer) throw (DecodeEr } void IPFilterRule_Type::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("IPFilterRule_Type", id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "IPFilterRule_Type", id); /* UTF8String action_, Loading Loading @@ -6279,7 +6305,7 @@ void QoSFilterRule::PreEncodeField (int field_id, Buffer& buffer) throw (EncodeE void QoSFilterRule::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("IPFilterRule_Type", id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "IPFilterRule_Type", id); static Regex reg_action ("^(" DIAREG_PERMIT_OR_DENY ")"); static Regex reg_direction ("^(" DIAREG_IN_OR_OUT ")"); Loading Loading @@ -6371,13 +6397,13 @@ void QoSFilterRule::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) #define INT32_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } #define UINT32_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } /*type record Supported_Vendor_Id_AVP{ Loading Loading @@ -7275,13 +7301,13 @@ UINT32_AVP_COMMON(Flow_Status_AVP) #define INT64_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } #define UINT64_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } /*type record Value_Digits_AVP{ Loading Loading @@ -7368,7 +7394,7 @@ UINT64_AVP_COMMON(CC_Sub_Session_Id_AVP) #define SET_OF_AVP_COMMON_PreDecode(type, avp_id) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ SetHypSize(m_lAVP_Offsets.size());\ if(m_lAVP_Offsets.size() > 0) \ buffer.SetPosition(m_lAVP_Offsets.at(0)); \ Loading @@ -7377,7 +7403,7 @@ UINT64_AVP_COMMON(CC_Sub_Session_Id_AVP) #define SET_OF_AVP_COMMON_PostDecodeField(type, avp_id) \ void type::PostDecodeField(int id, Buffer& buffer) throw (DecodeError)\ {\ debug_log_PostDecodeField(#type, id);\ debug_log_PostDecodeField(DEBUG_LOG_FILE, #type, id);\ if(m_lAVP_Offsets.size() > (id + 1)) \ buffer.SetPosition(m_lAVP_Offsets.at(id+1)); \ } Loading Loading @@ -7777,7 +7803,7 @@ SET_OF_AVP_COMMON_PostDecodeField(record_of_Tunnel_Header_Filter_AVP, AVP_CODE_T #define GROUPED_PreDecodeField_START(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(false) {} #define GROUPED_PreDecodeField_SINGLE_MANDATORY(avpcode, fid) \ Loading codec/c++/enum_codets.cpp +617 File added.Preview size limit exceeded, changes collapsed. Show changes Loading
codec/c++/codec.h +1 Changes for codec/c++/codec.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "msrp_codets.h" #include "diameter_codets.h" #include "gtp_codets.h" #include "enum_codets.h" namespace t3devlib { namespace gen { Loading
codec/c++/common_debug_log.cpp +48 Changes for codec/c++/common_debug_log.cpp: 48 added lines, 0 removed lines. Original line number Diff line number Diff line #include <cstdio> #include <iostream> #include <fstream> #include <math.h> //compiler switches: #define DEBUG_LOG 1 namespace t3devlib { namespace gen { void debug_log(const char* pFile, const char * value) { #ifdef DEBUG_LOG std::ofstream logfile(pFile, std::ios::app); logfile << value << std::endl; logfile.close(); #endif } void debug_log_PreDecode(const char* pFile, const char * type) { #ifdef DEBUG_LOG std::ofstream logfile(pFile, std::ios::app); logfile << type << "::PreDecode: " << std::endl; logfile.close(); #endif } void debug_log_PreDecodeField(const char* pFile, const char * type, int id) { #ifdef DEBUG_LOG std::ofstream logfile(pFile, std::ios::app); logfile << type << "::PreDecodeField: " << id << std::endl; logfile.close(); #endif } void debug_log_PostDecodeField(const char* pFile, const char * type, int id) { #ifdef DEBUG_LOG std::ofstream logfile(pFile, std::ios::app); logfile << type << "::PostDecodeField: " << id << std::endl; logfile.close(); #endif } }} // namespaces
codec/c++/common_debug_log.h +16 Changes for codec/c++/common_debug_log.h: 16 added lines, 0 removed lines. Original line number Diff line number Diff line #ifndef COMMON_DEBUG_LOG_H #define COMMON_DEBUG_LOG_H namespace t3devlib { namespace gen { void debug_log(const char* pFile, const char * value); void debug_log_PreDecode(const char* pFile, const char * type); void debug_log_PreDecodeField(const char* pFile, const char * type, int id); void debug_log_PostDecodeField(const char* pFile, const char * type, int id); }} //namespaces #endif
codec/c++/diameter_codets.cpp +64 −38 Changes for codec/c++/diameter_codets.cpp: 64 added lines, 38 removed lines. Original line number Diff line number Diff line #include "diameter_codets.h" #include "common_sip_msrp.h" #include "common_debug_log.h" #include <iostream> #include <fstream> Loading @@ -7,9 +8,8 @@ namespace t3devlib { //compiler switches: //#define DEBUG_LOG 1 //#define DIAMETER_ONLY 1 #define DEBUG_LOG_FILE "C:\\Temp\\LibDiameter.log" #ifdef DIAMETER_ONLY Loading Loading @@ -848,7 +848,7 @@ bool isNextAVP(Buffer & buffer, unsigned int nCode) throw (DecodeError) { return nCode == getAVPCode(buffer); } /* void debug_log(const char * value) { #ifdef DEBUG_LOG Loading Loading @@ -884,6 +884,7 @@ void debug_log_PostDecodeField(const char * type, int id) logfile.close(); #endif } */ FLOAT32::FLOAT32 () :PrimitiveType() Loading Loading @@ -1320,7 +1321,7 @@ void Command_Code::Decode (Buffer& buffer) throw (DecodeError) int nCode = code.GetValue(); #ifdef DEBUG_LOG std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app); std::ofstream logfile(DEBUG_LOG_FILE, ios::app); logfile << "Command_Code::Decode::code == \"" << nCode << '"'; logfile.close(); #endif Loading Loading @@ -1383,7 +1384,7 @@ type union DIAMETER_MSG { }*/ void DIAMETER_MSG::PreDecode (Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("DIAMETER_MSG"); debug_log_PreDecode(DEBUG_LOG_FILE, "DIAMETER_MSG"); Unsigned version(8); Unsigned length(24); Loading Loading @@ -1541,7 +1542,7 @@ void DIAMETER_MSG::PreDecode (Buffer& buffer) throw (DecodeError) //exception handling void DIAMETER_MSG::PostEncode (Buffer& buffer, EncodeError& ex) throw (EncodeError) { std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app); std::ofstream logfile(DEBUG_LOG_FILE, ios::app); logfile << "DIAMETER_MSG:PostEncode:Exception: " << std::endl; logfile << ex << std::endl; logfile.close(); Loading @@ -1550,7 +1551,7 @@ void DIAMETER_MSG::PostEncode (Buffer& buffer, EncodeError& ex) throw (EncodeErr void DIAMETER_MSG::PostDecode (Buffer& buffer, DecodeError& ex) throw (DecodeError) { //#ifdef DEBUG_LOG std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app); std::ofstream logfile(DEBUG_LOG_FILE, ios::app); logfile << "DIAMETER_MSG:PostDecode:Exception: " << std::endl; logfile << ex << std::endl; logfile.close(); Loading Loading @@ -1598,7 +1599,7 @@ static unsigned int skip_AVP(Buffer& buffer) throw (DecodeError) nByteLen = nLen.GetValue(); #ifdef DEBUG_LOG std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app); std::ofstream logfile(DEBUG_LOG_FILE, ios::app); logfile << "Found AVP: " << nAVP_Code <<", Len: "<< nByteLen <<", at: " << (nStartPos / 8) << std::endl; logfile.close(); #endif Loading @@ -1612,16 +1613,25 @@ static unsigned int skip_AVP(Buffer& buffer) throw (DecodeError) return nAVP_Code; } #ifdef DIAMETER_ONLY #define DIAMETER_MSG_PreDecode(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError) \ { \ m_nStartingPosition = buffer.GetPosition(); \ Get_header().Get_cmdcode().SetHypChosenId(DiameterCommandCode::id_known_code); \ } #else #define DIAMETER_MSG_PreDecode(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError) \ { \ m_nStartingPosition = buffer.GetPosition(); \ } #endif #define DIAMETER_MSG_PostDecodeField(type) \ void type::PostDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PostDecodeField(#type, field_id); \ debug_log_PostDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_header) \ { \ unsigned int nFirstAVP_Offset = buffer.GetPosition(); \ Loading Loading @@ -1654,7 +1664,7 @@ static unsigned int skip_AVP(Buffer& buffer) throw (DecodeError) #define DIAMETER_MSG_PreDecodeField_START(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(false) {} #define DIAMETER_MSG_PreDecodeField_SINGLE_MANDATORY(fid, avpcode) \ Loading Loading @@ -1753,7 +1763,15 @@ static unsigned int skip_AVP(Buffer& buffer) throw (DecodeError) DiameterHeader header, set_of_AVP_Type aVP_Type optional }*/ #ifdef DIAMETER_ONLY void UNKNOWN_MSG::PreDecode(Buffer& buffer) throw (DecodeError) { m_nStartingPosition = buffer.GetPosition(); Get_header().Get_cmdcode().SetHypChosenId(DiameterCommandCode::id_unknown_code); } #else DIAMETER_MSG_PreDecode(UNKNOWN_MSG) #endif DIAMETER_MSG_PreDecodeField_START(UNKNOWN_MSG) DIAMETER_MSG_PreDecodeField_REMAINING DIAMETER_MSG_PreDecodeField_END(UNKNOWN_MSG) Loading @@ -1761,7 +1779,7 @@ DIAMETER_MSG_PreDecodeField_END(UNKNOWN_MSG) //DIAMETER_MSG_PostDecodeField(UNKNOWN_MSG) void UNKNOWN_MSG::PostDecodeField(int field_id, Buffer& buffer) throw (DecodeError) { debug_log_PostDecodeField("UNKNOWN_MSG", field_id); debug_log_PostDecodeField(DEBUG_LOG_FILE, "UNKNOWN_MSG", field_id); if(field_id == id_header) { unsigned int nFirstAVP_Offset = buffer.GetPosition(); Loading Loading @@ -3665,11 +3683,19 @@ type record DiameterHeader { }*/ void DiameterHeader::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("DiameterHeader", field_id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "DiameterHeader", field_id); switch (field_id) { case id_cmdcode: unsigned char buff = Get_cmdflags().Get_r_bit().GetValue().at(0); int nV_flag = (buff >> 7); if(nV_flag) #ifdef DIAMETER_ONLY if(Get_cmdcode().GetHypChosenId() == DiameterCommandCode::id_known_code) Get_cmdcode().Get_known_code().SetRequest(); #else Get_cmdcode().SetRequest(); #endif break; break; case id_hopid://mandatory in the standard Loading Loading @@ -3869,7 +3895,7 @@ void AVP_Data::PostEncode(Buffer& buffer) throw (EncodeError) } void AVP_Data::PreDecode (Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("AVP_Data"); debug_log_PreDecode(DEBUG_LOG_FILE, "AVP_Data"); int nSelectedFieldId = id_oCTETSTRING;//unknown data if(m_nExpectedData == 1)//if, by any chance I might know what the data contains... then Loading Loading @@ -3905,7 +3931,7 @@ void AVP_Data::PreDecode (Buffer& buffer) throw (DecodeError) };*/ void GROUPED::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) { debug_log_PostDecodeField("GROUPED", field_id); debug_log_PostDecodeField(DEBUG_LOG_FILE, "GROUPED", field_id); if(field_id == id_aVP_Type) {//TODO: optimize Loading Loading @@ -3962,7 +3988,7 @@ void set_of_AVP_Type::SetRemaining(std::vector<unsigned int> lAVP_Codes, std::ve void set_of_AVP_Type::PreDecode(Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("set_of_AVP_Type"); debug_log_PreDecode(DEBUG_LOG_FILE, "set_of_AVP_Type"); m_nStartingPosition = buffer.GetPosition();//TODO: for set of undecoded items, this might not work... SetHypSize(m_lAVP_Codes.size()); Loading @@ -3979,12 +4005,12 @@ void set_of_AVP_Type::PreDecode(Buffer& buffer) throw (DecodeError) } void set_of_AVP_Type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("set_of_AVP_Type", buffer.GetPosition()); debug_log_PreDecodeField(DEBUG_LOG_FILE, "set_of_AVP_Type", buffer.GetPosition()); } void set_of_AVP_Type::PostDecodeField(int id, Buffer& buffer) throw (DecodeError) { debug_log_PostDecodeField("set_of_AVP_Type", id); debug_log_PostDecodeField(DEBUG_LOG_FILE, "set_of_AVP_Type", id); if(m_lAVP_Offsets.size() > (id + 1)) { Loading Loading @@ -4053,20 +4079,20 @@ void Diameter_IpAddress::PostEncode(Buffer& buffer) throw (EncodeError) void Diameter_IpAddress::PreDecode (Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("Diameter_IpAddress"); debug_log_PreDecode(DEBUG_LOG_FILE, "Diameter_IpAddress"); } //type record length (4) of UInt8 IPv4Addr; void IPv4Addr::PreDecode(Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("IPv4Addr"); debug_log_PreDecode(DEBUG_LOG_FILE, "IPv4Addr"); SetHypSize(4); } //type record length (8) of UInt16 IPv6Addr; void IPv6Addr::PreDecode(Buffer& buffer) throw (DecodeError) { debug_log_PreDecode("IPv6Addr"); debug_log_PreDecode(DEBUG_LOG_FILE, "IPv6Addr"); SetHypSize(8); } Loading @@ -4076,7 +4102,7 @@ void IPv6Addr::PreDecode(Buffer& buffer) throw (DecodeError) #define ADDRESS_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -4246,7 +4272,7 @@ type record DiameterURI{ */ void DiameterURI::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("DiameterURI", id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "DiameterURI", id); static Regex reg_scheme ("^(aaa://|aaas://)"); //static Regex reg_FQHN ("^[a-zA-Z][0-9a-zA-Z.:-_]+"); Loading Loading @@ -4555,7 +4581,7 @@ void SIP_AOR_Type::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) #define DIAMETER_URI_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -4686,7 +4712,7 @@ DIAMETER_URI_AVP_SET_COMMON_PostDecode(SIP_Credit_Control_Server_URI_AVP) #define OCTETSTRING_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -5125,7 +5151,7 @@ OCTETSTRING_AVP_COMMON_PostDecode(MPS_Identifier_AVP) #define UTF8STRING_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -5427,7 +5453,7 @@ UTF8STRING_AVP_COMMON_PostDecode(Cost_Unit_AVP) #define SPECIAL_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_Text) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -5645,7 +5671,7 @@ SPECIAL_AVP_COMMON_PostDecode(Digest_Response_Auth_AVP) #define DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(field_id == id_aVP_Data) \ { \ unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \ Loading Loading @@ -5737,7 +5763,7 @@ DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Proxy_Host_AVP) #define TIME_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } /*type record Tariff_Time_Change_AVP{ Loading Loading @@ -5851,7 +5877,7 @@ void IP_AddressMask::PostDecodeField (int id, Buffer& buffer) throw (DecodeError } void IP_AddressMask::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("IP_AddressMask", id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "IP_AddressMask", id); static Regex reg_addr_v4("^[ \t\v\f]*([!][ \t\v\f]*)?[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); static Regex reg_addr_v6("^[ \t\v\f]*([!][ \t\v\f]*)?[a-fA-F0-9:.]+"); Loading Loading @@ -6179,7 +6205,7 @@ void IPFilterRule_Type::PostDecodeField (int id, Buffer& buffer) throw (DecodeEr } void IPFilterRule_Type::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("IPFilterRule_Type", id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "IPFilterRule_Type", id); /* UTF8String action_, Loading Loading @@ -6279,7 +6305,7 @@ void QoSFilterRule::PreEncodeField (int field_id, Buffer& buffer) throw (EncodeE void QoSFilterRule::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) { debug_log_PreDecodeField("IPFilterRule_Type", id); debug_log_PreDecodeField(DEBUG_LOG_FILE, "IPFilterRule_Type", id); static Regex reg_action ("^(" DIAREG_PERMIT_OR_DENY ")"); static Regex reg_direction ("^(" DIAREG_IN_OR_OUT ")"); Loading Loading @@ -6371,13 +6397,13 @@ void QoSFilterRule::PreDecodeField (int id, Buffer& buffer) throw (DecodeError) #define INT32_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } #define UINT32_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } /*type record Supported_Vendor_Id_AVP{ Loading Loading @@ -7275,13 +7301,13 @@ UINT32_AVP_COMMON(Flow_Status_AVP) #define INT64_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } #define UINT64_AVP_COMMON(type) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ } /*type record Value_Digits_AVP{ Loading Loading @@ -7368,7 +7394,7 @@ UINT64_AVP_COMMON(CC_Sub_Session_Id_AVP) #define SET_OF_AVP_COMMON_PreDecode(type, avp_id) \ void type::PreDecode(Buffer& buffer) throw (DecodeError)\ {\ debug_log_PreDecode(#type);\ debug_log_PreDecode(DEBUG_LOG_FILE, #type);\ SetHypSize(m_lAVP_Offsets.size());\ if(m_lAVP_Offsets.size() > 0) \ buffer.SetPosition(m_lAVP_Offsets.at(0)); \ Loading @@ -7377,7 +7403,7 @@ UINT64_AVP_COMMON(CC_Sub_Session_Id_AVP) #define SET_OF_AVP_COMMON_PostDecodeField(type, avp_id) \ void type::PostDecodeField(int id, Buffer& buffer) throw (DecodeError)\ {\ debug_log_PostDecodeField(#type, id);\ debug_log_PostDecodeField(DEBUG_LOG_FILE, #type, id);\ if(m_lAVP_Offsets.size() > (id + 1)) \ buffer.SetPosition(m_lAVP_Offsets.at(id+1)); \ } Loading Loading @@ -7777,7 +7803,7 @@ SET_OF_AVP_COMMON_PostDecodeField(record_of_Tunnel_Header_Filter_AVP, AVP_CODE_T #define GROUPED_PreDecodeField_START(type) \ void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError) \ { \ debug_log_PreDecodeField(#type, field_id); \ debug_log_PreDecodeField(DEBUG_LOG_FILE, #type, field_id); \ if(false) {} #define GROUPED_PreDecodeField_SINGLE_MANDATORY(avpcode, fid) \ Loading
codec/c++/enum_codets.cpp +617 File added.Preview size limit exceeded, changes collapsed. Show changes