#include "diameter_codets.h"
#include "gen_classes.h"

#ifdef VS2013
//used only for development in VS
//#include "../../adapter/tmp/gen/gen_classes.h"
//#include
#endif
//#include "t3devlib/t3devlib.h"

#include <iostream>
#include <fstream>

namespace t3devlib { namespace gen {

//AVP codes from RFC 3588
#define AVP_CODE_Accounting_Realtime_Required 483
#define AVP_CODE_Acct_Multi_Session_Id 50
#define AVP_CODE_Accounting_Record_Number 485
#define AVP_CODE_Accounting_Record_Type 480
#define AVP_CODE_Accounting_Session_Id 44
#define AVP_CODE_Accounting_Sub_Session_Id 287
#define AVP_CODE_Acct_Application_Id 259
#define AVP_CODE_Auth_Application_Id 258
#define AVP_CODE_Auth_Request_Type 274
#define AVP_CODE_Authorization_Lifetime 291
#define AVP_CODE_Auth_Grace_Period 276
#define AVP_CODE_Auth_Session_State 277
#define AVP_CODE_Re_Auth_Request_Type 285
#define AVP_CODE_Class 25
#define AVP_CODE_Destination_Host 293
#define AVP_CODE_Destination_Realm 283
#define AVP_CODE_Disconnect_Cause 273
#define AVP_CODE_E2E_Sequence AVP 300
#define AVP_CODE_Error_Message 281
#define AVP_CODE_Error_Reporting_Host 294
#define AVP_CODE_Event_Timestamp 55
#define AVP_CODE_Experimental_Result 297
#define AVP_CODE_Experimental_Result_Code 298
#define AVP_CODE_Failed_AVP 279
#define AVP_CODE_Firmware_Revision 267
#define AVP_CODE_Host_IP_Address 257
#define AVP_CODE_Inband_Security_Id 299
#define AVP_CODE_Multi_Round_Time_Out 272
#define AVP_CODE_Origin_Host 264
#define AVP_CODE_Origin_Realm 296
#define AVP_CODE_Origin_State_Id 278
#define AVP_CODE_Product_Name 269
#define AVP_CODE_Proxy_Host 280
#define AVP_CODE_Proxy_Info 284
#define AVP_CODE_Proxy_State 33
#define AVP_CODE_Redirect_Host 292
#define AVP_CODE_Redirect_Host_Usage 261
#define AVP_CODE_Redirect_Max_Cache_Time 262
#define AVP_CODE_Result_Code 268
#define AVP_CODE_Route_Record 282
#define AVP_CODE_Session_Id 263
#define AVP_CODE_Session_Timeout 27
#define AVP_CODE_Session_Binding 270
#define AVP_CODE_Session_Server_Failover 271
#define AVP_CODE_Supported_Vendor_Id 265
#define AVP_CODE_Termination_Cause 295
#define AVP_CODE_User_Name 1
#define AVP_CODE_Vendor_Id 266
#define AVP_CODE_Vendor_Specific_Application_Id 260

//AVP codes from RFC 4740
#define AVP_CODE_SIP_Accounting_Information 368
#define AVP_CODE_SIP_Accounting_Server_URI 369
#define AVP_CODE_SIP_Credit_Control_Server_URI 370
#define AVP_CODE_SIP_Server_URI 371
#define AVP_CODE_SIP_Server_Capabilities 372
#define AVP_CODE_SIP_Mandatory_Capability 373
#define AVP_CODE_SIP_Optional_Capability 374
#define AVP_CODE_SIP_Server_Assignment_Type 375
#define AVP_CODE_SIP_Auth_Data_Item 376
#define AVP_CODE_SIP_Authentication_Scheme 377
#define AVP_CODE_SIP_Item_Number 378
#define AVP_CODE_SIP_Authenticate 379
#define AVP_CODE_SIP_Authorization 380
#define AVP_CODE_SIP_Authentication_Info 381
#define AVP_CODE_SIP_Number_Auth_Items 382
#define AVP_CODE_SIP_Deregistration_Reason 383
#define AVP_CODE_SIP_Reason_Code 384
#define AVP_CODE_SIP_Reason_Info 385
#define AVP_CODE_SIP_Visited_Network_Id 386
#define AVP_CODE_SIP_User_Authorization_Type 387
#define AVP_CODE_SIP_Supported_User_Data_Type 388
#define AVP_CODE_SIP_User_Data 389
#define AVP_CODE_SIP_User_Data_Type 390
#define AVP_CODE_SIP_User_Data_Contents 391
#define AVP_CODE_SIP_User_Data_Already_Available 392
//#define AVP_CODE_SIP_Method 393//TODO: this is redefined in another standard with a different ID

//AVP codes from 129.214
#define AVP_CODE_Abort_Cause 500
#define AVP_CODE_Access_Network_Charging_Address 501
#define AVP_CODE_Access_Network_Charging_Identifier 502
#define AVP_CODE_Access_Network_Charging_Identifier_Value 503
#define AVP_CODE_Acceptable_Service_Info 526
#define AVP_CODE_AF_Application_Identifier 504
#define AVP_CODE_AF_Charging_Identifier 505
#define AVP_CODE_Application_Service_Provider_Identity 532
#define AVP_CODE_Codec_Data 524
#define AVP_CODE_Flow_Description 507
#define AVP_CODE_Flow_Number 509
#define AVP_CODE_Flows 510
#define AVP_CODE_Flow_Status 511
#define AVP_CODE_Flow_Usage 512
#define AVP_CODE_Service_URN 525
#define AVP_CODE_Specific_Action 513
#define AVP_CODE_Max_Requested_Bandwidth_DL 515
#define AVP_CODE_Max_Requested_Bandwidth_UL 516
#define AVP_CODE_Media_Component_Description 517
#define AVP_CODE_Media_Component_Number 518
#define AVP_CODE_Media_Sub_Component 519
#define AVP_CODE_Media_Type 520
#define AVP_CODE_MPS_Identifier 528
#define AVP_CODE_Min_Requested_Bandwidth_DL 534
#define AVP_CODE_Min_Requested_Bandwidth_UL 535
#define AVP_CODE_RR_Bandwidth 521
#define AVP_CODE_RS_Bandwidth 522
#define AVP_CODE_Service_Info_Status 527
#define AVP_CODE_SIP_Forking_Indication 523
#define AVP_CODE_Sponsor_Identity 531
#define AVP_CODE_Sponsored_Connectivity_Data 530
#define AVP_CODE_AF_Signalling_Protocol 529
#define AVP_CODE_Required_Access_Info 536
#define AVP_CODE_Rx_Request_Type 533


//AVP codes RFC 4006
#define AVP_CODE_CC_Correlation_Id 411
#define AVP_CODE_CC_Input_Octets 412
#define AVP_CODE_CC_Money 413
#define AVP_CODE_CC_Output_Octets 414
#define AVP_CODE_CC_Request_Number 415
#define AVP_CODE_CC_Request_Type 416
#define AVP_CODE_CC_Service_Specific_Units 417
#define AVP_CODE_CC_Session_Failover 418
#define AVP_CODE_CC_Sub_Session_Id 419
#define AVP_CODE_CC_Time 420
#define AVP_CODE_CC_Total_Octets 421
#define AVP_CODE_CC_Unit_Type 454
#define AVP_CODE_Check_Balance_Result 422
#define AVP_CODE_Cost_Information 423
#define AVP_CODE_Cost_Unit 424
#define AVP_CODE_Credit_Control 426
#define AVP_CODE_Credit_Control_Failure_Handling 427
#define AVP_CODE_Currency_Code 425
#define AVP_CODE_Direct_Debiting_Failure_Handling 428
#define AVP_CODE_Exponent 429
#define AVP_CODE_Final_Unit_Action 449
#define AVP_CODE_Final_Unit_Indication 430
#define AVP_CODE_Granted_Service_Unit 431
#define AVP_CODE_G_S_U_Pool_Identifier  453
#define AVP_CODE_G_S_U_Pool_Reference 457
#define AVP_CODE_Multiple_Services_Credit_Control 456
#define AVP_CODE_Multiple_Services_Indicator 455
#define AVP_CODE_Rating_Group 432
#define AVP_CODE_Redirect_Address_Type 433
#define AVP_CODE_Redirect_Server 434
#define AVP_CODE_Redirect_Server_Address 435
#define AVP_CODE_Requested_Action 436
#define AVP_CODE_Requested_Service_Unit 437
#define AVP_CODE_Restriction_Filter_Rule 438
#define AVP_CODE_Service_Context_Id 461
#define AVP_CODE_Service_Identifier 439
#define AVP_CODE_Service_Parameter_Info  440
#define AVP_CODE_Service_Parameter_Type 441
#define AVP_CODE_Service_Parameter_Value 442
#define AVP_CODE_Subscription_Id 443
#define AVP_CODE_Subscription_Id_Data 444
#define AVP_CODE_Subscription_Id_Type 450
#define AVP_CODE_Tariff_Change_Usage 452
#define AVP_CODE_Tariff_Time_Change 451
#define AVP_CODE_Unit_Value 445
#define AVP_CODE_Used_Service_Unit 446
#define AVP_CODE_User_Equipment_Info 458
#define AVP_CODE_User_Equipment_Info_Type 459
#define AVP_CODE_User_Equipment_Info_Value 460
#define AVP_CODE_Value_Digits 447
#define AVP_CODE_Validity_Time 448

//AVP codes from 129.212
#define AVP_CODE_Access_Network_Charging_Identifier_Gx 1022
#define AVP_CODE_Allocation_Retention_Priority 1034
#define AVP_CODE_AN_GW_Address 1050
#define AVP_CODE_APN_Aggregate_Max_Bitrate_DL 1040
#define AVP_CODE_APN_Aggregate_Max_Bitrate_UL 1041
#define AVP_CODE_Bearer_Control_Mode 1023
#define AVP_CODE_Bearer_Identifier 1020
#define AVP_CODE_Bearer_Operation 1021
#define AVP_CODE_Bearer_Usage 1000
#define AVP_CODE_Charging_Rule_Install 1001
#define AVP_CODE_Charging_Rule_Remove 1002
#define AVP_CODE_Charging_Rule_Definition 1003
#define AVP_CODE_Charging_Rule_Base_Name 1004
#define AVP_CODE_Charging_Rule_Name 1005
#define AVP_CODE_Charging_Rule_Report 1018
#define AVP_CODE_Charging_Correlation_Indicator 1073
#define AVP_CODE_CoA_IP_Address 1035
#define AVP_CODE_CoA_Information 1039
#define AVP_CODE_CSG_Information_Reporting 1071
#define AVP_CODE_Default_EPS_Bearer_QoS 1049
#define AVP_CODE_Event_Report_Indication 1033
#define AVP_CODE_Event_Trigger 1006
#define AVP_CODE_Flow_Direction 1072
#define AVP_CODE_Flow_Information 1058
#define AVP_CODE_Flow_Label 1057
#define AVP_CODE_IP_CAN_Type 1027
#define AVP_CODE_Guaranteed_Bitrate_DL 1025
#define AVP_CODE_Guaranteed_Bitrate_UL 1026
#define AVP_CODE_Metering_Method 1007
#define AVP_CODE_Monitoring_Key 1066
#define AVP_CODE_Network_Request_Support 1024
#define AVP_CODE_Offline 1008
#define AVP_CODE_Online 1009
#define AVP_CODE_Packet_Filter_Content 1059
#define AVP_CODE_Packet_Filter_Identifier 1060
#define AVP_CODE_Packet_Filter_Information 1061
#define AVP_CODE_Packet_Filter_Operation 1062
#define AVP_CODE_Packet_Filter_Usage 1072
#define AVP_CODE_PDN_Connection_ID 1065
#define AVP_CODE_Precedence 1010
#define AVP_CODE_Pre_emption_Capability 1047
#define AVP_CODE_Pre_emption_Vulnerability 1048
#define AVP_CODE_Priority_Level 1046
#define AVP_CODE_Reporting_Level 1011
#define AVP_CODE_PCC_Rule_Status 1019
#define AVP_CODE_Session_Release_Cause 1045
#define AVP_CODE_QoS_Class_Identifier 1028
#define AVP_CODE_QoS_Information 1016
#define AVP_CODE_QoS_Negotiation 1029
#define AVP_CODE_Qos_Upgrade 1030
#define AVP_CODE_Resource_Allocation_Notification 1063
#define AVP_CODE_Rule_Failure_Code 1031
#define AVP_CODE_Security_Parameter_Index 1056
#define AVP_CODE_TFT_Filter 1012
#define AVP_CODE_TFT_Packet_Filter_Information 1013
#define AVP_CODE_ToS_Traffic_Class 1014
#define AVP_CODE_Tunnel_Header_Filter 1036
#define AVP_CODE_Tunnel_Header_Length 1037
#define AVP_CODE_Tunnel_Information 1038
#define AVP_CODE_RAT_Type 1032
#define AVP_CODE_Revalidation_Time 1042
#define AVP_CODE_Rule_Activation_Time 1043
#define AVP_CODE_Usage_Monitoring_Information 1067
#define AVP_CODE_Rule_DeActivation_Time 1044
#define AVP_CODE_Usage_Monitoring_Level 1068
#define AVP_CODE_Usage_Monitoring_Report 1069
#define AVP_CODE_Usage_Monitoring_Support 1070

//AVP codes from 132.299
#define AVP_CODE_Accounting_Input_Octets 363
#define AVP_CODE_Accounting_Input_Packets 365
#define AVP_CODE_Accounting_Output_Octets 364
#define AVP_CODE_Accounting_Output_Packets 366
#define AVP_CODE_Accounting_Realtime_Required 483
#define AVP_CODE_Accounting_Record_Number 485
#define AVP_CODE_Accounting_Record_Type 480
#define AVP_CODE_Accounting_Sub_Session_Id 287
#define AVP_CODE_Acct_Application_Id 259
#define AVP_CODE_Acct_Interim_Interval 85
#define AVP_CODE_Acct_Multi_Session_Id 50
#define AVP_CODE_Acct_Session_Id 44
#define AVP_CODE_Auth_Application_Id 258
#define AVP_CODE_Called_Station_Id 30
#define AVP_CODE_CC_Correlation_Id 411
#define AVP_CODE_CC_Input_Octets 412
#define AVP_CODE_CC_Money 413
#define AVP_CODE_CC_Output_Octets 414
#define AVP_CODE_CC_Request_Number 415
#define AVP_CODE_CC_Request_Type 416
#define AVP_CODE_CC_Service_Specific_Units 417
#define AVP_CODE_CC_Session_Failover 418
#define AVP_CODE_CC_Sub_Session_Id 419
#define AVP_CODE_CC_Time 420
#define AVP_CODE_CC_Total_Octets 421
#define AVP_CODE_CC_Unit_Type 454
#define AVP_CODE_Check_Balance_Result 422
#define AVP_CODE_Cost_Information 423
#define AVP_CODE_Cost_Unit 424
#define AVP_CODE_Credit_Control 426
#define AVP_CODE_Credit_Control_Failure_Handling 427
#define AVP_CODE_Currency_Code 425
#define AVP_CODE_Destination_Host 293
#define AVP_CODE_Destination_Realm 283
#define AVP_CODE_Direct_Debiting_Failure_Handling 428
#define AVP_CODE_Error_Message 281
#define AVP_CODE_Error_Reporting_Host 294
#define AVP_CODE_Event_Timestamp 55
#define AVP_CODE_Exponent 429
#define AVP_CODE_Failed_AVP 279
#define AVP_CODE_Filter_Id 11
#define AVP_CODE_Final_Unit_Action 449
#define AVP_CODE_Final_Unit_Indication 430
#define AVP_CODE_Granted_Service_Unit 431
#define AVP_CODE_G_S_U_Pool_Identifier 453
#define AVP_CODE_G_S_U_Pool_Reference 457
#define AVP_CODE_Multiple_Services_Credit_Control 456
#define AVP_CODE_Multiple_Services_Indicator 455
#define AVP_CODE_Origin_Host 264
#define AVP_CODE_Origin_Realm 296
#define AVP_CODE_Origin_State_Id 278
#define AVP_CODE_Proxy_Info 284
#define AVP_CODE_Proxy_Host 280
#define AVP_CODE_Proxy_State 33
#define AVP_CODE_Rating_Group 432
#define AVP_CODE_Redirect_Address_Type 433
#define AVP_CODE_Redirect_Host 292
#define AVP_CODE_Redirect_Host_Usage 261
#define AVP_CODE_Redirect_Max_Cache_Time 262
#define AVP_CODE_Redirect_Server 434
#define AVP_CODE_Redirect_Server_Address 435
#define AVP_CODE_Requested_Action 436
#define AVP_CODE_Requested_Service_Unit 437
#define AVP_CODE_Restriction_Filter_Rule 438
#define AVP_CODE_Result_Code 268
#define AVP_CODE_Route_Record 282
#define AVP_CODE_Service_Context_Id 461
#define AVP_CODE_Service_Identifier 439
#define AVP_CODE_Service_Parameter_Info 440
#define AVP_CODE_Service_Parameter_Type 441
#define AVP_CODE_Service_Parameter_Value 442
#define AVP_CODE_Session_Id 263
#define AVP_CODE_Subscription_Id 443
#define AVP_CODE_Subscription_Id_Data 444
#define AVP_CODE_Subscription_Id_Type 450
#define AVP_CODE_Tariff_Change_Usage 452
#define AVP_CODE_Tariff_Time_Change 451
#define AVP_CODE_Termination_Cause 295
#define AVP_CODE_Unit_Value 445
#define AVP_CODE_Used_Service_Unit 446
#define AVP_CODE_User_Equipment_Info 458
#define AVP_CODE_User_Equipment_Info_Type 459
#define AVP_CODE_User_Equipment_Info_Value 460
#define AVP_CODE_User_Name 1
#define AVP_CODE_Value_Digits 447
#define AVP_CODE_Validity_Time 448
#define AVP_CODE_Vendor_Id 266
#define AVP_CODE_Vendor_Specific_Application_Id 260

//do not quite remember where this is from
#define AVP_CODE_Access_Network_Information 1263
#define AVP_CODE_Account_Expiration 2309
#define AVP_CODE_Accumulated_Cost 2052
#define AVP_CODE_Adaptations 1217
#define AVP_CODE_Additional_Content_Information 1207
#define AVP_CODE_Additional_Type_Information 1205
#define AVP_CODE_Address_Data 897
#define AVP_CODE_Address_Domain 898
#define AVP_CODE_Addressee_Type 1208
#define AVP_CODE_Address_Type 899
#define AVP_CODE_AF_Charging_Identifier 505
#define AVP_CODE_AF_Correlation_Information 1276
#define AVP_CODE_Allocation_Retention_Priority 1034
#define AVP_CODE_Alternate_Charged_Party_Address 1280
#define AVP_CODE_AoC_Cost_Information 2053
#define AVP_CODE_AoC_Format 2310
#define AVP_CODE_AoC_Information 2054
#define AVP_CODE_AoC_Request_Type 2055
#define AVP_CODE_AoC_Service 2311
#define AVP_CODE_AoC_Service_Obligatory_Type 2312
#define AVP_CODE_AoC_Service_Type 2313
#define AVP_CODE_AoC_Subscription_Information 2314
#define AVP_CODE_Application_provided_calledparty_address 837
#define AVP_CODE_Application_Server 836
#define AVP_CODE_Application_Server_ID 2101
#define AVP_CODE_Application_Service_Provider_Identity 532
#define AVP_CODE_Application_Server_Information 850
#define AVP_CODE_Application_Service_Type 2102
#define AVP_CODE_Application_Session_ID 2103
#define AVP_CODE_Applic_ID 1218
#define AVP_CODE_Associated_Party_Address 2035
#define AVP_CODE_Associated_URI 856
#define AVP_CODE_Authorised_QoS 849
#define AVP_CODE_Aux_Applic_Info 1219
#define AVP_CODE_Base_Time_Interval 1265
#define AVP_CODE_Bearer_Service 854
#define AVP_CODE_Called_Asserted_Identity 1250
#define AVP_CODE_Called_Party_Address 832
#define AVP_CODE_Calling_Party_Address 831
#define AVP_CODE_Carrier_Select_Routing_Information 2023
#define AVP_CODE_Cause_Code 861
#define AVP_CODE_CG_Address 846
#define AVP_CODE_Change_Condition 2037
#define AVP_CODE_Change_Time 2038
#define AVP_CODE_Charged_Party 857
#define AVP_CODE_Charging_Characteristics_Selection_Mode 2066
#define AVP_CODE_Charging_Rule_Base_Name 1004
#define AVP_CODE_Class_Identifier 1214
#define AVP_CODE_Client_Address 2018
#define AVP_CODE_CN_IP_Multicast_Distribution 921
#define AVP_CODE_Content_Class 1220
#define AVP_CODE_Content_Disposition 828
#define AVP_CODE_Content_ID 2116
#define AVP_CODE_Content_Provider_ID 2117
#define AVP_CODE_Content_Length 827
#define AVP_CODE_Content_Size 1206
#define AVP_CODE_CSG_Access_Mode 2317
#define AVP_CODE_CSG_Id 1437
#define AVP_CODE_CSG_Membership_Indication 2318
#define AVP_CODE_Content_Type 826
#define AVP_CODE_Current_Tariff 2056
#define AVP_CODE_CUG_Information 2304
#define AVP_CODE_Data_Coding_Scheme 2001
#define AVP_CODE_DCD_Information 2115
#define AVP_CODE_Deferred_Location_Event_Type 1230
#define AVP_CODE_Delivery_Report_Requested 1216
#define AVP_CODE_Delivery_Status 2104
#define AVP_CODE_Destination_Interface 2002
#define AVP_CODE_Diagnostics 2039
#define AVP_CODE_Domain_Name 1200
#define AVP_CODE_DRM_Content 1221
#define AVP_CODE_Dynamic_Address_Flag 2051
#define AVP_CODE_Dynamic_Address_Flag_Extension 2068
#define AVP_CODE_Early_Media_Description 1272
#define AVP_CODE_Envelope 1266
#define AVP_CODE_Envelope_End_Time 1267
#define AVP_CODE_Envelope_Reporting 1268
#define AVP_CODE_Envelope_Start_Time 1269
#define AVP_CODE_Event 825
#define AVP_CODE_Event_Charging_TimeStamp 1258
#define AVP_CODE_Event_Type 823
#define AVP_CODE_Expires 888
#define AVP_CODE_File_Repair_Supported 1224
#define AVP_CODE_Flows 510
#define AVP_CODE_GGSN_Address 847
#define AVP_CODE_Guaranteed_Bitrate_UL 1026
#define AVP_CODE_IM_Information 2110
#define AVP_CODE_IMS_Application_Reference_Identifier 2601
#define AVP_CODE_IMS_Charging_Identifier 841
#define AVP_CODE_IMS_Communication_Service_Identifier 1281
#define AVP_CODE_IMS_Information 876
#define AVP_CODE_IMSI_Unauthenticated_Flag 2308
#define AVP_CODE_Incoming_Trunk_Group_Id 852
#define AVP_CODE_Incremental_Cost 2062
#define AVP_CODE_Initial_IMS_Charging_Identifier 2321
#define AVP_CODE_Interface_Id 2003
#define AVP_CODE_Interface_Port 2004
#define AVP_CODE_Interface_Text 2005
#define AVP_CODE_Interface_Type 2006
#define AVP_CODE_Inter_Operator_Identifier 838
#define AVP_CODE_IP_Realm_Default_Indication 2603
#define AVP_CODE_LCS_APN 1231
#define AVP_CODE_LCS_Client_Dialed_By_MS 1233
#define AVP_CODE_LCS_Client_External_ID 1234
#define AVP_CODE_LCS_Client_Id 1232
#define AVP_CODE_LCS_Client_Name 1235
#define AVP_CODE_LCS_Client_Type 1241
#define AVP_CODE_LCS_Data_Coding_Scheme 1236
#define AVP_CODE_LCS_Format_Indicator 1237
#define AVP_CODE_LCS_Information 878
#define AVP_CODE_LCS_Name_String 1238
#define AVP_CODE_LCS_Requestor_Id 1239
#define AVP_CODE_LCS_Requestor_Id_String 1240
#define AVP_CODE_Local_GW_Inserted_Indication 2604
#define AVP_CODE_Local_Sequence_Number 2063
#define AVP_CODE_Location_Estimate 1242
#define AVP_CODE_Location_Estimate_Type 1243
#define AVP_CODE_Location_Type 1244
#define AVP_CODE_Low_Balance_Indication 2020
#define AVP_CODE_Low_Priority_Indicator 2602
#define AVP_CODE_Mandatory_Capability 604
#define AVP_CODE_Max_Requested_Bandwidth_DL 515
#define AVP_CODE_Max_Requested_Bandwidth_UL 516
#define AVP_CODE_MBMS_2G_3G_Indicator 907
#define AVP_CODE_MBMS GW_Address 2307
#define AVP_CODE_MBMS_Information 880
#define AVP_CODE_MBMS_Service_Area 903
#define AVP_CODE_MBMS_Service_Type 906
#define AVP_CODE_MBMS_Session_Identity 908
#define AVP_CODE_MBMS_User_Service_Type 1225
#define AVP_CODE_Media_Initiator_Flag 882
#define AVP_CODE_Media_Initiator_Party 1288
#define AVP_CODE_Message_Body 889
#define AVP_CODE_Message_Class 1213
#define AVP_CODE_Message_ID 1210
#define AVP_CODE_Message_Size 1212
#define AVP_CODE_Message_Type 1211
#define AVP_CODE_MMBox_Storage_Requested 1248
#define AVP_CODE_MM_Content_Type 1203
#define AVP_CODE_MMS_Information 877
#define AVP_CODE_MMTel_Information 2030
#define AVP_CODE_MSISDN 701
#define AVP_CODE_Neighbour_Node_Address 2705
#define AVP_CODE_Next_Tariff 2057
#define AVP_CODE_NNI_Information 2703
#define AVP_CODE_NNI_Type 2704
#define AVP_CODE_Node_Functionality 862
#define AVP_CODE_Node_Id 2064
#define AVP_CODE_Number_Of_Diversions 2034
#define AVP_CODE_Number_Of_Messages_Sent 2019
#define AVP_CODE_Number_Of_Messages_Successfully_Exploded 2111
#define AVP_CODE_Number_Of_Messages_Successfully_Sent 2112
#define AVP_CODE_Number_Of_Participants 885
#define AVP_CODE_Number_Of_Received_Talk_Bursts 1282
#define AVP_CODE_Number_Of_Talk_Bursts 1283
#define AVP_CODE_Number_Portability_Routing_Information 2024
#define AVP_CODE_Offline_Charging 1278
#define AVP_CODE_Online_Charging_Flag 2303
#define AVP_CODE_Optional_Capability 605
#define AVP_CODE_Originating_IOI 839
#define AVP_CODE_Originator_SCCP_Address 2008
#define AVP_CODE_Originator 864
#define AVP_CODE_Originator_Address 886
#define AVP_CODE_Originator_Received_Address 2027
#define AVP_CODE_Originator_Interface 2009
#define AVP_CODE_Outgoing_Session_Id 2320
#define AVP_CODE_Outgoing_Trunk_Group_Id 853
#define AVP_CODE_Participant_Access_Priority 1259
#define AVP_CODE_Participant_Action_Type 2049
#define AVP_CODE_Participant_Group 1260
#define AVP_CODE_Participants_Involved 887
#define AVP_CODE_PDG_Address 895
#define AVP_CODE_PDG_Charging_Id 896
#define AVP_CODE_PDN_Connection_Charging_ID 2050
#define AVP_CODE_PDP_Address 1227
#define AVP_CODE_PDP_Context_Type 1247
#define AVP_CODE_PDP_Address_Prefix_Length 2606
#define AVP_CODE_PoC_Change_Condition 1261
#define AVP_CODE_PoC_Change_Time 1262
#define AVP_CODE_PoC_Controlling_Address 858
#define AVP_CODE_PoC_Event_Type 2025
#define AVP_CODE_PoC_Group_Name 859
#define AVP_CODE_PoC_Information 879
#define AVP_CODE_PoC_Server_Role 883
#define AVP_CODE_PoC_Session_Id 1229
#define AVP_CODE_PoC_Session_Initiation_type 1277
#define AVP_CODE_PoC_Session_Type 884
#define AVP_CODE_PoC_User_Role 1252
#define AVP_CODE_PoC_User_Role_IDs 1253
#define AVP_CODE_PoC_User_Role_info_Units 1254
#define AVP_CODE_Positioning_Data 1245
#define AVP_CODE_Preferred_AoC_Currency 2315
#define AVP_CODE_Priority 1209
#define AVP_CODE_Priority_Level 1046
#define AVP_CODE_PS_Append_Free_Format_Data 867
#define AVP_CODE_PS_Free_Format_Data 866
#define AVP_CODE_PS_Furnish_Charging_Information 865
#define AVP_CODE_PS_Information 874
#define AVP_CODE_QoS_Information 1016
#define AVP_CODE_QoS_Class_Identifier 1028
#define AVP_CODE_Quota_Consumption_Time 881
#define AVP_CODE_Quota_Holding_Time 871
#define AVP_CODE_RAI 909
#define AVP_CODE_Rate_Element 2058
#define AVP_CODE_RAT_Type 1032
#define AVP_CODE_Read_Reply_Report_Requested 1222
#define AVP_CODE_Reason_Code 2316
#define AVP_CODE_Real_Time_Tariff_Information 2305
#define AVP_CODE_Received_Talk_Burst_Time 1284
#define AVP_CODE_Received_Talk_Burst_Volume 1285
#define AVP_CODE_Recipient_Address 1201
#define AVP_CODE_Recipient_Info 2026
#define AVP_CODE_Recipient_Received_Address 2028
#define AVP_CODE_Recipient_SCCP_Address 2010
#define AVP_CODE_Refund_Information 2022
#define AVP_CODE_Relationship_Mode 2706
#define AVP_CODE_Remaining_Balance 2021
#define AVP_CODE_Reply_Applic_ID 1223
#define AVP_CODE_Reply_Path_Requested 2011
#define AVP_CODE_Reporting_Reason 872
#define AVP_CODE_Requested_Party_Address 1251
#define AVP_CODE_Required_MBMS_Bearer_Capabilities 901
#define AVP_CODE_Role_Of_Node 829
#define AVP_CODE_Scale_Factor 2059
#define AVP_CODE_SDP_Answer_Timestamp 1275
#define AVP_CODE_SDP_Media_Component 843
#define AVP_CODE_SDP_Media_Description 845
#define AVP_CODE_SDP_Media_Name 844
#define AVP_CODE_SDP_Offer_Timestamp 1274
#define AVP_CODE_SDP_Session_Description 842
#define AVP_CODE_SDP_TimeStamps 1273
#define AVP_CODE_SDP_Type 2036
#define AVP_CODE_Session_Direction 2707
#define AVP_CODE_Served_Party_IP_Address 848
#define AVP_CODE_Server_Capabilities 603
#define AVP_CODE_Server_Name 602
#define AVP_CODE_Service_Data_Container 2040
#define AVP_CODE_Service_Generic_Information 1256
#define AVP_CODE_Service_Id 855
#define AVP_CODE_Service_Information 873
#define AVP_CODE_Service_Mode 2032
#define AVP_CODE_Service_Specific_Data 863
#define AVP_CODE_Service_Specific_Info 1249
#define AVP_CODE_Service_Specific_Type 1257
#define AVP_CODE_Serving_Node_Type 2047
#define AVP_CODE_Service_Type 2031
#define AVP_CODE_Session_Priority 650
#define AVP_CODE_SGSN_Address 1228
#define AVP_CODE_SGW_Address 2067
#define AVP_CODE_SGW_Change 2065
//#define AVP_CODE_SIP_Method 824 //TODO: this is redefined in another standard with a different ID
#define AVP_CODE_SIP_Request_Timestamp_Fraction 2301
#define AVP_CODE_SIP_Request_Timestamp 834
#define AVP_CODE_SIP_Response_Timestamp_Fraction 2302
#define AVP_CODE_SIP_Response_Timestamp 835
#define AVP_CODE_SM_Discharge_Time 2012
#define AVP_CODE_SM_Message_Type 2007
#define AVP_CODE_SM_Protocol_ID 2013
#define AVP_CODE_SMSC_Address 2017
#define AVP_CODE_SMS_Information 2000
#define AVP_CODE_SMS_Node 2016
#define AVP_CODE_SM_Service_Type 2029
#define AVP_CODE_SM_Status 2014
#define AVP_CODE_SM_User_Data_Header 2015
#define AVP_CODE_Sponsor_Identify 531
#define AVP_CODE_Start_Time 2041
#define AVP_CODE_Status 2702
#define AVP_CODE_Stop_Time 2042
#define AVP_CODE_Submission_Time 1202
#define AVP_CODE_Subscriber_Role 2033
#define AVP_CODE_Supplementary_Service 2048
#define AVP_CODE_Talk_Burst_Exchange 1255
#define AVP_CODE_Talk_Burst_Time 1286
#define AVP_CODE_Talk_Burst_Volume 1287
#define AVP_CODE_Tariff_Information 2060
#define AVP_CODE_Tariff_XML 2306
#define AVP_CODE_Terminal_Information 1401
#define AVP_CODE_Terminating_IOI 840
#define AVP_CODE_Time_First_Usage 2043
#define AVP_CODE_Time_Last_Usage 2044
#define AVP_CODE_Time_Quota_Mechanism 1270
#define AVP_CODE_Time_Quota_Threshold 868
#define AVP_CODE_Time_Quota_Type 1271
#define AVP_CODE_Time_Stamps 833
#define AVP_CODE_Time_Usage 2045
#define AVP_CODE_TMGI 900
#define AVP_CODE_Token_Text 1215
#define AVP_CODE_Total_Number_Of_Messages_Exploded 2113
#define AVP_CODE_Total_Number_Of_Messages_Sent 2114
#define AVP_CODE_Traffic_Data_Volumes 2046
#define AVP_CODE_Transcoder_Inserted_Indication 2605
#define AVP_CODE_Transit_IOI_List 2701
#define AVP_CODE_Trigger 1264
#define AVP_CODE_Trigger_Type 870
#define AVP_CODE_Trunk_Group_Id 851
#define AVP_CODE_Type_Number 1204
#define AVP_CODE_Unit_Cost 2061
#define AVP_CODE_Unit_Quota_Threshold 1226
#define AVP_CODE_User_CSG_Information 2319
#define AVP_CODE_User_Data 606
#define AVP_CODE_User_Participating_Type 1279
#define AVP_CODE_User_Session_Id 830
#define AVP_CODE_VAS_Id 1102
#define AVP_CODE_VASP_Id 1101
#define AVP_CODE_Volume_Quota_Threshold 869
#define AVP_CODE_WAG_Address 890
#define AVP_CODE_WAG_PLMN_Id 891
#define AVP_CODE_WLAN_Information 875
#define AVP_CODE_WLAN_Radio_Container 892
#define AVP_CODE_WLAN_Session_Id 1246
#define AVP_CODE_WLAN_Technology 893
#define AVP_CODE_WLAN_UE_Local_IPAddress 894

unsigned int getAVPDataLength(AVP_Header &header)
{
	unsigned int nCode = header.Get_aVP_Code().GetValue();
	int nV_flag = header.Get_aVP_flags().Get_v_bit().GetValue().at(0);
	unsigned int nDataLength = header.Get_aVP_len().GetValue();
	nDataLength -= 8;
	if(nV_flag)
		nDataLength -= 4;
	return nDataLength;
}
unsigned int getBytesRemaining_AVP(Buffer &buffer, AVP_Header &header, unsigned int nStartingPosition)
{
	unsigned int nTotalBytes = header.Get_aVP_len().GetValue();
	unsigned int nCurrent = buffer.GetPosition();
	return nTotalBytes - ((nCurrent - nStartingPosition)/8);
}

unsigned int getBytesRemaining_D(Buffer & buffer, DiameterHeader& header, unsigned int nStartingPosition)
{
	unsigned int nDataBytes = header.Get_msglen().GetValue();
	unsigned int nCurrent = buffer.GetPosition();
	return nDataBytes - ((nCurrent - nStartingPosition)/8);
}

unsigned int getAVPCode(Buffer & buffer) throw (DecodeError)
{
	int nStartingPos = buffer.GetPosition();
	Unsigned code(32);
	code.Decode(buffer);
	unsigned int nCode = code.GetValue();
	buffer.SetPosition(nStartingPos);
	return nCode;
}

bool isNextAVP(Buffer & buffer, unsigned int nCode) throw (DecodeError)
{
	return nCode == getAVPCode(buffer);
}


void debug_log_PreDecode(const char * type)
{
	#ifdef DEBUG_LOG
		std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
		logfile << type << "::PreDecode: " << std::endl;
		logfile.close();
	#endif
}

void debug_log_PreDecodeField(const char * type, int id)
{
	#ifdef DEBUG_LOG
		std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
		logfile << type << "::PreDecodeField: " << id << std::endl;
		logfile.close();
	#endif
}

void debug_log_PostDecodeField(const char * type, int id)
{
	#ifdef DEBUG_LOG
		std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
		logfile << type << "::PostDecodeField: " << id << std::endl;
		logfile.close();
	#endif
}

FLOAT32::FLOAT32 ()
	:PrimitiveType()
{
}
FLOAT32::~FLOAT32()
{
}

int FLOAT32::GetLength() const
{
	return 32;
}

::t3devlib::Variable::BaseType FLOAT32::GetBaseType() const
{
	return ::t3devlib::Variable::btFloat;
}

float FLOAT32::GetValue() const
{
	return mValue;
}

void FLOAT32::SetValue(float v)
{
	mValue = v;
}

void FLOAT32::SetValue(const FLOAT32& v)
{
	mValue = v.mValue;
}

const unsigned char* FLOAT32::GetValueBin() const
{
	int bytes = 4;
	msBinBuff.clear();
	msBinBuff.reserve (4);	      
	
	int offset = 24;
	for (int i=3 ; i ; i--) {
		msBinBuff += static_cast <unsigned char> (((unsigned int)mValue) >> offset);
		offset -= 8;
	}
	msBinBuff += static_cast <unsigned char> (((unsigned int)mValue) << -offset);
	return reinterpret_cast<const unsigned char*> (msBinBuff.data());
}

void FLOAT32::Decode (Buffer& buffer) throw (DecodeError)
{
	PrimitiveType::Decode (buffer);
}
void FLOAT32::Encode (Buffer& buffer) throw (EncodeError)
{
	PrimitiveType::Encode (buffer);
}

void FLOAT32::Dump (std::ostream& out, int indent) const
{
	for (int i=indent ; i ; i--) {
		out << ' ';
	}
	out << mValue << " - 0x" << std::hex << mValue << std::dec
	    << " (float) "
	    << std::endl;
}

void FLOAT32::DumpInline (std::ostream& out) const
{
	out << mValue;
}

void FLOAT32::SetValueBinNoOffset (const unsigned char* buff, int bit_length)
{
	assert (buff != NULL);
	assert (bit_length >= -1);
	assert (bit_length <= 32);
		
	if (bit_length == -1) {
		bit_length = 32;
	}

	mValue = 0.0f;
	const unsigned char* p = buff;
		
	// full bytes
	unsigned long nTmp;
	for (int my_offset = bit_length-8 ; my_offset >= 0 ; my_offset -= 8) {
		nTmp |= static_cast <unsigned long> (*p) << my_offset;
		p++;
	}
	mValue = (float)nTmp;
}

FLOAT64::FLOAT64 ()
	:PrimitiveType()
{
}
FLOAT64::~FLOAT64()
{
}

int FLOAT64::GetLength() const
{
	return 64;
}

::t3devlib::Variable::BaseType FLOAT64::GetBaseType() const
{
	return ::t3devlib::Variable::btFloat;
}

double FLOAT64::GetValue() const
{
	return mValue;
}

void FLOAT64::SetValue(double v)
{
	mValue = v;
}

void FLOAT64::SetValue(const FLOAT64& v)
{
	mValue = v.mValue;
}

const unsigned char* FLOAT64::GetValueBin() const
{
	int bytes = 8;
	msBinBuff.clear();
	msBinBuff.reserve (bytes);	      
	
	int offset = 56;
	for (int i=7 ; i ; i--) {
		msBinBuff += static_cast <unsigned char> (((unsigned int)mValue) >> offset);
		offset -= 8;
	}
	msBinBuff += static_cast <unsigned char> (((unsigned int)mValue) << -offset);
	return reinterpret_cast<const unsigned char*> (msBinBuff.data());
}

void FLOAT64::Decode (Buffer& buffer) throw (DecodeError)
{
	PrimitiveType::Decode (buffer);
}
void FLOAT64::Encode (Buffer& buffer) throw (EncodeError)
{
	PrimitiveType::Encode (buffer);
}

void FLOAT64::Dump (std::ostream& out, int indent) const
{
	for (int i=indent ; i ; i--) {
		out << ' ';
	}
	out << mValue << " - 0x" << std::hex << mValue << std::dec
	    << " (double) "
	    << std::endl;
}

void FLOAT64::DumpInline (std::ostream& out) const
{
	out << mValue;
}

void FLOAT64::SetValueBinNoOffset (const unsigned char* buff, int bit_length)
{
	assert (buff != NULL);
	assert (bit_length >= -1);
	assert (bit_length <= 64);
		
	if (bit_length == -1) {
		bit_length = 64;
	}

	mValue = 0.0;
	const unsigned char* p = buff;
		
	// full bytes
	unsigned long long nTmp;
	for (int my_offset = bit_length-8 ; my_offset >= 0 ; my_offset -= 8) {
		nTmp |= static_cast <unsigned long long> (*p) << my_offset;
		p++;
	}
	mValue = (double)nTmp;
}


/*
CER_E,  // Capabilities-Exchange-Request 	CER  (257)
CEA_E,  // Capabilities-Exchange-Answer 	CEA  (257)
RAR_E,   // Re-Auth-Request 				RAR  (258)
RAA_E,   // Re-Auth-Answer 					RAA  (258)

//
ACR_E,  // Accounting-Request				ACR(271)
ACA_E,  // Accounting-Answer				ACA (271)

//                  
ASR_E, // Abort-Session-Request			ASR (274)
ASA_E, // Abort-Sesion-Answer				ASA (274)
STR_E,  // Session-Termination-Request		STR (275)
STA_E,  // Session-Termination-Answer		STA (275)  		    

//
DWR_E,  // Device-Watchdog-Request			DWR (280)
DWA_E,  // Device-Watchdog-Answer			DWA (280) 
DPR_E,  // Disconnect-Peer-Requst			DPR (282)
DPA_E,  // Disconnect-Peer-Answer			DPA (282) 

// Codes on Cx
UAR_E,   	// User-Authorization-Request	UAR	300
UAA_E,   	// User-Authorization-Answer	UAA	300
SAR_E,   	// Server-Assignment-Request	SAR	301
SAA_E,   	// Server-Assignment-Answer		SAA	301
LIR_E,   	// Location-Info-Request		LIR	302
LIA_E,   	// Location-Info-Answer			LIA	302
MAR_E,   	// Multimedia-Auth-Request		MAR	303
MAA_E,   	// Multimedia-Auth-Answer		MAA	303
RTR_E,  	// Registration-Termination-Request	RTR	304
RTA_E,  	// Registration-Termination-Answer	RTA	304
PPR_E,  	// Push-Profile-Request			PPR	305
PPA_E,  	// Push-Profile-Answer			PPA	305	
        			
// Codes on Sh/Dh interface 
UDR_E,	//	UDR User-Data-Request AS->HSS 	306
UDA_E,	//	UDA User-Data-Answer HSS->AS	306		
PUR_E, 	//	PUR Profile-Update-Request AS->HSS	307
PUA_E,	//	PUA Profile-Update-Answer HSS->AS	307
SNR_E,	//	SNR Subscribe-Notifications-Request AS->HSS	308
SNA_E,	//	SNA Subscribe-Notifications-Answer HSS->AS	308
PNR_E,	//	PNR Profile-Notification-Request HSS->AS	309
PNA_E,		//	PNA Profile-Notification-Answer AS->HSS		309

// Codes on Rx interface
AAR_E,	//	AAR Auth-Accounting-Request  	265
AAA_E,	//	AAA Auth-Accounting-Answer	 	265

// Codes on Gx interface - RFC4006 and TS 129 212
CCR_E,	//	CCR Credit-Control-Request  	272
CCA_E	//	CCA Credit-Control-Answer 		272
*/

const char* Command_Code::msKeywordEnumsAll[] = { 
		"CER_E",  // Capabilities-Exchange-Request 	CER  (257)
		"CEA_E",  // Capabilities-Exchange-Answer 	CEA  (257)
		"RAR_E",   // Re-Auth-Request 				RAR  (258)
		"RAA_E",   // Re-Auth-Answer 					RAA  (258)

		//
		"ACR_E",  // Accounting-Request				ACR(271)
		"ACA_E",  // Accounting-Answer				ACA (271)

		//                  
		"ASR_E", // Abort-Session-Request			ASR (274)
		"ASA_E", // Abort-Sesion-Answer				ASA (274)
		"STR_E",  // Session-Termination-Request		STR (275)
		"STA_E",  // Session-Termination-Answer		STA (275)  		    

		//
		"DWR_E",  // Device-Watchdog-Request			DWR (280)
		"DWA_E",  // Device-Watchdog-Answer			DWA (280) 
		"DPR_E",  // Disconnect-Peer-Requst			DPR (282)
		"DPA_E",  // Disconnect-Peer-Answer			DPA (282) 

		// Codes on Cx
		"UAR_E",   	// User-Authorization-Request	UAR	300
		"UAA_E",   	// User-Authorization-Answer	UAA	300
		"SAR_E",   	// Server-Assignment-Request	SAR	301
		"SAA_E",   	// Server-Assignment-Answer		SAA	301
		"LIR_E",   	// Location-Info-Request		LIR	302
		"LIA_E",   	// Location-Info-Answer			LIA	302
		"MAR_E",   	// Multimedia-Auth-Request		MAR	303
		"MAA_E",   	// Multimedia-Auth-Answer		MAA	303
		"RTR_E",  	// Registration-Termination-Request	RTR	304
		"RTA_E",  	// Registration-Termination-Answer	RTA	304
		"PPR_E",  	// Push-Profile-Request			PPR	305
		"PPA_E",  	// Push-Profile-Answer			PPA	305	
							
		// Codes on Sh/Dh interface 
		"UDR_E",	//	UDR User-Data-Request AS->HSS 	306
		"UDA_E",	//	UDA User-Data-Answer HSS->AS	306		
		"PUR_E", 	//	PUR Profile-Update-Request AS->HSS	307
		"PUA_E",	//	PUA Profile-Update-Answer HSS->AS	307
		"SNR_E",	//	SNR Subscribe-Notifications-Request AS->HSS	308
		"SNA_E",	//	SNA Subscribe-Notifications-Answer HSS->AS	308
		"PNR_E",	//	PNR Profile-Notification-Request HSS->AS	309
		"PNA_E",		//	PNA Profile-Notification-Answer AS->HSS		309

		// Codes on Rx interface
		"AAR_E",	//	AAR Auth-Accounting-Request  	265
		"AAA_E",	//	AAA Auth-Accounting-Answer	 	265

		// Codes on Gx interface - RFC4006 and TS 129 212
		"CCR_E",	//	CCR Credit-Control-Request  	272
		"CCA_E"	//	CCA Credit-Control-Answer 		272
		"" };

const char* Command_Code::msKeywordEnumsRequest[] = { 
		"CER_E",  // Capabilities-Exchange-Request 	CER  (257)
		"RAR_E",   // Re-Auth-Request 				RAR  (258)

		//
		"ACR_E",  // Accounting-Request				ACR(271)

		//                  
		"ASR_E", // Abort-Session-Request			ASR (274)
		"STR_E",  // Session-Termination-Request		STR (275)

		//
		"DWR_E",  // Device-Watchdog-Request			DWR (280)
		"DPR_E",  // Disconnect-Peer-Requst			DPR (282)

		// Codes on Cx
		"UAR_E",   	// User-Authorization-Request	UAR	300
		"SAR_E",   	// Server-Assignment-Request	SAR	301
		"LIR_E",   	// Location-Info-Request		LIR	302
		"MAR_E",   	// Multimedia-Auth-Request		MAR	303
		"RTR_E",  	// Registration-Termination-Request	RTR	304
		"PPR_E",  	// Push-Profile-Request			PPR	305
        			
		// Codes on Sh/Dh interface 
		"UDR_E",	//	UDR User-Data-Request AS->HSS 	306
		"PUR_E", 	//	PUR Profile-Update-Request AS->HSS	307
		"SNR_E",	//	SNR Subscribe-Notifications-Request AS->HSS	308
		"PNR_E",	//	PNR Profile-Notification-Request HSS->AS	309

		// Codes on Rx interface
		"AAR_E",	//	AAR Auth-Accounting-Request  	265
		// Codes on Gx interface - RFC4006 and TS 129 212
		"CCR_E",	//	CCR Credit-Control-Request  	272
		"" };
		
const char* Command_Code::msKeywordEnumsAnswer[] = { 
		"CEA_E",  // Capabilities-Exchange-Answer 	CEA  (257)
		"RAA_E",   // Re-Auth-Answer 					RAA  (258)

		//
		"ACA_E",  // Accounting-Answer				ACA (271)

		//                  
		"ASA_E", // Abort-Sesion-Answer				ASA (274)
		"STA_E",  // Session-Termination-Answer		STA (275)  		    

		//
		"DWA_E",  // Device-Watchdog-Answer			DWA (280) 
		"DPA_E",  // Disconnect-Peer-Answer			DPA (282) 

		// Codes on Cx
		"UAA_E",   	// User-Authorization-Answer	UAA	300
		"SAA_E",   	// Server-Assignment-Answer		SAA	301
		"LIA_E",   	// Location-Info-Answer			LIA	302
		"MAA_E",   	// Multimedia-Auth-Answer		MAA	303
		"RTA_E",  	// Registration-Termination-Answer	RTA	304
		"PPA_E",  	// Push-Profile-Answer			PPA	305	
        			
		// Codes on Sh/Dh interface 
		"UDA_E",	//	UDA User-Data-Answer HSS->AS	306		
		"PUA_E",	//	PUA Profile-Update-Answer HSS->AS	307
		"SNA_E",	//	SNA Subscribe-Notifications-Answer HSS->AS	308
		"PNA_E",		//	PNA Profile-Notification-Answer AS->HSS		309

		// Codes on Rx interface
		"AAA_E",	//	AAA Auth-Accounting-Answer	 	265

		// Codes on Gx interface - RFC4006 and TS 129 212
		"CCA_E"	//	CCA Credit-Control-Answer 		272
		"" };

const int Command_Code::msCommandCodeValues[] = { 
		257,//CER_E, CEA_E
		258,//RAR_E, RAA_E

		//
		271,//ACR_E, ACA_E

		//                  
		274,//ASR_E, ASA_E
		275,//STR_E, STA_E

		//
		280,//DWR_E, DWA_E 
		282,//DPR_E, DPA_E

		// Codes on Cx
		300,//UAR_E, UAA_E
		301,//SAR_E, SAA_E
		302,//LIR_E, LIA_E 
		303,//MAR_E, MAA_E
		304,//RTR_E, RTA_E
		305,//PPR_E, PPA_E
							
		// Codes on Sh/Dh interface 
		306,//UDR_E, UDA_E
		307,//PUR_E, PUA_E
		308,//SNR_E, SNA_E
		309,//PNR_E, PNA_E

		// Codes on Rx interface
		265,//AAR_E, AAA_E

		// Codes on Gx interface - RFC4006 and TS 129 212
		272,//CCR_E, CCA_E
		0 };

void Command_Code::Encode (Buffer& buffer) throw (EncodeError)
{
	Unsigned code(24);

	const char * pStr = GetValueString();
	for(int i=0; strlen(msKeywordEnumsRequest[i]); i++)//TODO:incorrect length calculation
	{//there is equal count of Request and Answer codes
		if(!strcmp(msKeywordEnumsRequest[i], pStr))
		{
			code.SetValue (msCommandCodeValues[i]);
			code.Encode(buffer);
			break;
		}
		else if(!strcmp(msKeywordEnumsAnswer[i], pStr))
		{
			code.SetValue (msCommandCodeValues[i]);
			code.Encode(buffer);
			break;
		}
	}
}

void Command_Code::Decode (Buffer& buffer) throw (DecodeError)
{
	Unsigned code(24);
	code.Decode(buffer);
	int nCode = code.GetValue();
	//int nRequest = 0;//TODO: how to find this???

#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "Command_Code::Decode::code == \"" << nCode << '"';
	logfile.close();
#endif

	for(int i=0; msCommandCodeValues[i]; i++)
	{
		if(msCommandCodeValues[i] == nCode)
		{
			SetValueString (m_bIsRequest ? msKeywordEnumsRequest[i] : msKeywordEnumsAnswer[i]);
			break;
		}
	}
}
 
/*
type union DIAMETER_MSG {
    CER_MSG	cER_MSG,
    CEA_MSG	cEA_MSG,
    RAR_MSG	rAR_MSG,
    RAA_MSG rAA_MSG,
    ACR_MSG	aCR_MSG,
    ACA_MSG	aCA_MSG,
    ASR_MSG	aSR_MSG,
    ASA_MSG	aSA_MSG,
    STR_MSG sTR_MSG,
    STA_MSG	sTA_MSG,
    DWR_MSG	dWR_MSG,
    DWA_MSG	dWA_MSG,
    DPR_MSG	dPR_MSG,
    DPA_MSG	dPA_MSG,
    //RFC4740
    UAR_MSG	uAR_MSG,
    UAA_MSG	uAA_MSG,
    SAR_MSG	sAR_MSG,
    SAA_MSG	sAA_MSG,
    LIR_MSG	lIR_MSG,
    LIA_MSG	lIA_MSG,
    MAR_MSG	mAR_MSG,
    MAA_MSG	mAA_MSG,
    RTR_MSG	rTR_MSG,
    RTA_MSG	rTA_MSG,
    PPR_MSG	pPR_MSG,
    PPA_MSG	pPA_MSG,
    //Sh interface
    UDR_MSG	uDR_MSG,
    UDA_MSG	uDA_MSG,
    PUR_MSG	pUR_MSG,
    PUA_MSG	pUA_MSG,
    SNR_MSG	sNR_MSG,
    SNA_MSG	sNA_MSG,
    PNR_MSG	pNR_MSG,
    PNA_MSG	pNA_MSG,
    //RFC4006 and TS 129 212
    CCR_MSG	cCR_MSG,
    CCA_MSG	cCA_MSG,
    //Rx interface
    AAR_MSG	aAR_MSG,
    AAA_MSG	aAA_MSG,
    UNKNOWN_MSG	uNKNOWN_MSG  
}*/
void DIAMETER_MSG::PreDecode (Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "DIAMETER_MSG::PreDecode" << std::endl;
	logfile.close();
#endif

	Unsigned version(8);
	Unsigned length(24);
	Unsigned flags(8);
	Unsigned code(24);
	

	//store buffer position
	int nPos = buffer.GetPosition();

	//predecode header
	version.Decode(buffer);
	length.Decode(buffer);
	flags.Decode(buffer);
	code.Decode(buffer);
	
	//rewind buffer position
	buffer.SetPosition(nPos);

	//set the decoded union field
	int nSelectedFieldId = -1;
	int nCode = code.GetValue();
	int nRequest = flags.GetValue() & 0x80;

	if(nCode == 257)
		/*"CER_E",  // Capabilities-Exchange-Request 	CER  (257)
		"CEA_E",  // Capabilities-Exchange-Answer 	CEA  (257)
			CER_MSG	cER_MSG,
			CEA_MSG	cEA_MSG,*/
		nSelectedFieldId = nRequest ? id_cER_MSG : id_cEA_MSG;
	else if(nCode == 258)
		/*"RAR_E",   // Re-Auth-Request 				RAR  (258)
		"RAA_E",   // Re-Auth-Answer 					RAA  (258)
			RAR_MSG	rAR_MSG,
			RAA_MSG rAA_MSG*/
		nSelectedFieldId = nRequest ? id_rAR_MSG : id_rAA_MSG;
	else if(nCode == 271)
		/*"ACR_E",  // Accounting-Request				ACR(271)
		"ACA_E",  // Accounting-Answer				ACA (271)
			ACR_MSG	aCR_MSG,
			ACA_MSG	aCA_MSG*/
		nSelectedFieldId = nRequest ? id_aCR_MSG : id_aCA_MSG;
	else if(nCode == 274)
		/*"ASR_E", // Abort-Session-Request			ASR (274)
		"ASA_E", // Abort-Sesion-Answer				ASA (274)
			ASR_MSG	aSR_MSG,
			ASA_MSG	aSA_MSG*/
		nSelectedFieldId = nRequest ? id_aSR_MSG : id_aSA_MSG;
	else if(nCode == 275)
		/*"STR_E",  // Session-Termination-Request		STR (275)
		"STA_E",  // Session-Termination-Answer		STA (275)
			STR_MSG sTR_MSG,
			STA_MSG	sTA_MSG*/
		nSelectedFieldId = nRequest ? id_sTR_MSG : id_sTA_MSG;
	else if(nCode == 280)
		/*"DWR_E",  // Device-Watchdog-Request			DWR (280)
		"DWA_E",  // Device-Watchdog-Answer			DWA (280)
			DWR_MSG	dWR_MSG,
		    DWA_MSG	dWA_MSG,*/
		nSelectedFieldId = nRequest ? id_dWR_MSG : id_dWA_MSG;
	else if(nCode == 282)
		/*"DPR_E",  // Disconnect-Peer-Requst			DPR (282)
		"DPA_E",  // Disconnect-Peer-Answer			DPA (282) 
			DPR_MSG	dPR_MSG,
			DPA_MSG	dPA_MSG,*/
		nSelectedFieldId = nRequest ? id_dPR_MSG : id_dPA_MSG;
	else if(nCode == 300)
		/*"UAR_E",   	// User-Authorization-Request	UAR	300
		"UAA_E",   	// User-Authorization-Answer	UAA	300
			UAR_MSG	uAR_MSG,
			UAA_MSG	uAA_MSG,*/
		nSelectedFieldId = nRequest ? id_uAR_MSG : id_uAA_MSG;
	else if(nCode == 301)
		/*"SAR_E",   	// Server-Assignment-Request	SAR	301
		"SAA_E",   	// Server-Assignment-Answer		SAA	301
			SAR_MSG	sAR_MSG,
			SAA_MSG	sAA_MSG,*/
		nSelectedFieldId = nRequest ? id_sAR_MSG : id_sAA_MSG;
	else if(nCode == 302)
		/*"LIR_E",   	// Location-Info-Request		LIR	302
		"LIA_E",   	// Location-Info-Answer			LIA	302
			LIR_MSG	lIR_MSG,
			LIA_MSG	lIA_MSG,*/
		nSelectedFieldId = nRequest ? id_lIR_MSG : id_lIA_MSG;
	else if(nCode == 303)
		/*"MAR_E",   	// Multimedia-Auth-Request		MAR	303
		"MAA_E",   	// Multimedia-Auth-Answer		MAA	303
			MAR_MSG	mAR_MSG,
			MAA_MSG	mAA_MSG,*/
		nSelectedFieldId = nRequest ? id_mAR_MSG : id_mAA_MSG;
	else if(nCode == 304)
		/*"RTR_E",  	// Registration-Termination-Request	RTR	304
		"RTA_E",  	// Registration-Termination-Answer	RTA	304
			RTR_MSG	rTR_MSG,
			RTA_MSG	rTA_MSG,*/
		nSelectedFieldId = nRequest ? id_rTR_MSG : id_rTA_MSG;
	else if(nCode == 305)
		/*"PPR_E",  	// Push-Profile-Request			PPR	305
		"PPA_E",  	// Push-Profile-Answer			PPA	305	
			PPR_MSG	pPR_MSG,
			PPA_MSG	pPA_MSG,*/
		nSelectedFieldId = nRequest ? id_pPR_MSG : id_pPA_MSG;
	else if(nCode == 306)
		/*"UDR_E",	//	UDR User-Data-Request AS->HSS 	306
		"UDA_E",	//	UDA User-Data-Answer HSS->AS	306	
			UDR_MSG	uDR_MSG,
			UDA_MSG	uDA_MSG,*/
		nSelectedFieldId = nRequest ? id_uDR_MSG : id_uDA_MSG;
	else if(nCode == 307)
		/*"PUR_E", 	//	PUR Profile-Update-Request AS->HSS	307
		"PUA_E",	//	PUA Profile-Update-Answer HSS->AS	307
			PUR_MSG	pUR_MSG,
		    PUA_MSG	pUA_MSG,*/
		nSelectedFieldId = nRequest ? id_pUR_MSG : id_pUA_MSG;
	else if(nCode == 308)
		/*"SNR_E",	//	SNR Subscribe-Notifications-Request AS->HSS	308
		"SNA_E",	//	SNA Subscribe-Notifications-Answer HSS->AS	308
			SNR_MSG	sNR_MSG,
			SNA_MSG	sNA_MSG,*/
		nSelectedFieldId = nRequest ? id_sNR_MSG : id_sNA_MSG;
	else if(nCode == 309)
		/*"PNR_E",	//	PNR Profile-Notification-Request HSS->AS	309
		"PNA_E",		//	PNA Profile-Notification-Answer AS->HSS		309
			PNR_MSG	pNR_MSG,
			PNA_MSG	pNA_MSG,*/
		nSelectedFieldId = nRequest ? id_pNR_MSG : id_pNA_MSG;
	else if(nCode == 265)
		/*"AAR_E",	//	AAR Auth-Accounting-Request  	265
		"AAA_E",	//	AAA Auth-Accounting-Answer	 	265
			AAR_MSG	aAR_MSG,
			AAA_MSG	aAA_MSG,*/
		nSelectedFieldId = nRequest ? id_aAR_MSG : id_aAA_MSG;
	else if(nCode == 272)
		/*"CCR_E",	//	CCR Credit-Control-Request  	272
		"CCA_E"	//	CCA Credit-Control-Answer 		272
			CCR_MSG	cCR_MSG,
			CCA_MSG	cCA_MSG,*/
		nSelectedFieldId = nRequest ? id_cCR_MSG : id_cCA_MSG;

	if(nSelectedFieldId == -1)
		/*UNKNOWN_MSG	uNKNOWN_MSG*/
		nSelectedFieldId = id_uNKNOWN_MSG;

	SetHypChosenId(nSelectedFieldId);
}

//////////////////////////////////////////////////////////
///////////////  DIAMETER MESSAGES  //////////////////////
//////////////////////////////////////////////////////////

/*type record UNKNOWN_MSG {
    DiameterHeader 		header,
    AVP_Type			aVP_Type optional
}*/
void UNKNOWN_MSG::PreEncodeField(int field_id, Buffer& buffer) throw (EncodeError)
{
	/*if(field_id != id_pvalue)
		return;
	Charstring cs;
	cs.SetValue("=");
	cs.Encode(buffer);*/
}

void UNKNOWN_MSG::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "UNKNOWN_MSG::PreDecodeField: " << field_id << std::endl;
	logfile.close();
#endif
	if(field_id == id_aVP_Type)
	{
		unsigned int nLength = Get_header().Get_msglen().GetValue();
		SetHypFieldIsPresent(id_aVP_Type, nLength > 20);
	}
}

/*
type record  CER_MSG{
	//Ref: RFC3588 5.3.1.  Capabilities-Exchange-Request
	DiameterHeader 						header,//<CER> ::= < Diameter Header: 257, REQ >     		
	Origin_Host_AVP 					origin_Host,//required
	Origin_Realm_AVP 					origin_Realm,
	set_of_Host_IP_Address_AVP 			host_IP_Address,
	Vendor_Id_AVP 						vendor_Id,
	Product_Name_AVP 					product_Name,//required
	set_of_Origin_State_Id_AVP			origin_State_Id optional,
	set_of_Supported_Vendor_Id_AVP		supported_Vendor_Id optional,
	set_of_Auth_Application_Id_AVP		auth_Application_Id optional,
	set_of_Inband_Security_Id_AVP		inband_Security_Id optional,
	set_of_Acct_Application_Id_AVP		acct_Application_Id optional,
	set_of_Vendor_Specific_Appl_Id_AVP	vendor_Specific_Application_Id optional,
	Firmware_Revision_AVP				firmware_Revision optional,
	set_of_AVP_Type 					aVP_Type optional		
}*/
void CER_MSG::PreDecode(Buffer& buffer) throw (DecodeError)
{
	m_nStartingPosition = buffer.GetPosition();
}

void CER_MSG::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("CER_MSG", field_id);
	unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_origin_State_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Origin_State_Id) ? 1 : 0);
	else if(field_id == id_supported_Vendor_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Supported_Vendor_Id) ? 1 : 0);
	else if(field_id == id_auth_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Auth_Application_Id) ? 1 : 0);
	else if(field_id == id_inband_Security_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Inband_Security_Id) ? 1 : 0);
	else if(field_id == id_acct_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Acct_Application_Id) ? 1 : 0);
	else if(field_id == id_vendor_Specific_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Vendor_Specific_Application_Id) ? 1 : 0);
	else if(field_id == id_firmware_Revision)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Firmware_Revision) ? 1 : 0);
	else if(field_id == id_aVP_Type)
	{/*set_of_AVP_Type 					aVP_Type optional*/
		//decide if there is still bytes left undecoded
		unsigned int nDH_length = getBytesRemaining_D(buffer, Get_header(), m_nStartingPosition);
		SetHypFieldIsPresent(field_id, (nDH_length > 0 ) ? 1 : 0);
	}
}

/*type record  CEA_MSG{
	//Ref: RFC3588 5.3.2.  Capabilities-Exchange-Answer       			
	DiameterHeader 						header,//<CEA> ::= < Diameter Header: 257 >
	Result_Code_AVP						result_Code,//required
	Origin_Host_AVP 					origin_Host,
	Origin_Realm_AVP 					origin_Realm,
	set_of_Host_IP_Address_AVP 			host_IP_Address,
	Vendor_Id_AVP 						vendor_Id,
	Product_Name_AVP 					product_Name,//required

	Origin_State_Id_AVP					origin_State_Id optional,
	Error_Message_AVP					error_Message optional,
	set_of_Failed_AVP					failed optional,
	set_of_Supported_Vendor_Id_AVP		supported_Vendor_Id optional,
	set_of_Auth_Application_Id_AVP		auth_Application_Id optional,
	set_of_Inband_Security_Id_AVP		inband_Security_Id optional,
	set_of_Acct_Application_Id_AVP		acct_Application_Id optional,
	set_of_Vendor_Specific_Appl_Id_AVP 	vendor_Specific_Application_Id optional,
	Firmware_Revision_AVP				firmware_Revision optional,
	set_of_AVP_Type 					aVP_Type optional		
}*/
void CEA_MSG::PreDecode(Buffer& buffer) throw (DecodeError)
{
	m_nStartingPosition = buffer.GetPosition();
}

void CEA_MSG::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("CEA_MSG", field_id);
	unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_origin_State_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Origin_State_Id) ? 1 : 0);
	else if(field_id == id_error_Message)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Error_Message) ? 1 : 0);
	else if(field_id == id_failed)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Failed_AVP) ? 1 : 0);
	else if(field_id == id_supported_Vendor_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Supported_Vendor_Id) ? 1 : 0);
	else if(field_id == id_auth_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Auth_Application_Id) ? 1 : 0);
	else if(field_id == id_inband_Security_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Inband_Security_Id) ? 1 : 0);
	else if(field_id == id_acct_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Acct_Application_Id) ? 1 : 0);
	else if(field_id == id_vendor_Specific_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Vendor_Specific_Application_Id) ? 1 : 0);
	else if(field_id == id_firmware_Revision)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Firmware_Revision) ? 1 : 0);
	else if(field_id == id_aVP_Type)
	{/*set_of_AVP_Type 					aVP_Type optional*/
		//decide if there is still bytes left undecoded
		unsigned int nDH_length = getBytesRemaining_D(buffer, Get_header(), m_nStartingPosition);
		SetHypFieldIsPresent(field_id, (nDH_length > 0 ) ? 1 : 0);
	}
}


/*type record RAR_MSG{
	//Ref: RFC3588 8.3.1.  Re-Auth-Request
	DiameterHeader 						header,//<RAR>  ::= < Diameter Header: 258, REQ, PXY >
	Session_Id_AVP 						session_Id,//fixed pos.				//RFC3588 & TS 129 214 & TS 129 212
	Origin_Host_AVP 					origin_Host,//required				//RFC3588 & TS 129 214 & TS 129 212
	Origin_Realm_AVP 					origin_Realm,						//RFC3588 & TS 129 214 & TS 129 212
	Destination_Realm_AVP				destination_Realm,					//RFC3588 & TS 129 214 & TS 129 212
	Destination_Host_AVP				destination_Host,					//RFC3588 & TS 129 214 & TS 129 212
	Auth_Application_Id_AVP				auth_Application_Id,				//RFC3588 & TS 129 214 & TS 129 212
	Specific_Action_AVP					specific_action optional,			// TS 129 214 required
	Re_Auth_Request_Type_AVP 			re_Auth_Request_Type optional,		//RFC3588req & TS 129 214NOT present & TS 129 212req
	User_Name_AVP 						user_Name optional,					//RFC3588
	set_of_Access_Network_Charging_Identifier_AVP acc_nc_ident optional, 	// TS 129 214
	Access_Network_Charging_Address_AVP     acc_nc_addr optional, 			// TS 129 214
	set_of_Flows_AVP					flows optional,						// TS 129 214
	set_of_Subscription_Id_AVP			subscription_Id optional,			// TS 129 214
	Abort_Cause_AVP						abort_Cause optional,				// TS 129 214
	IP_CAN_Type_AVP						ip_Can optional,					// TS 129 214
	RAT_Type_AVP						rat_Type optional,					// TS 129 214
	Sponsored_Connectivity_Data_AVP		sponsored_Conectivity_Data optional,// TS 129 214
	Origin_State_Id_AVP					origin_State_Id optional,			//RFC3588 & TS 129 214 & TS 129 212
    set_of_Class_AVP 					class optional,						// TS 129 214
    Session_Release_Cause_AVP			session_Release_Cause optional,		// TS 129 212
    set_of_Event_Trigger_AVP			event_Trigger optional,				// TS 129 212
    Event_Report_Indication_AVP			event_Report_Indication optional,	// TS 129 212
    set_of_Charging_Rule_Remove_AVP		charging_Rule_Remove optional,		// TS 129 212
    set_of_Charging_Rule_Install_AVP	charging_Rule_Install optional,		// TS 129 212
    Default_EPS_Bearer_QoS_AVP			default_EPS_Bearer_QoS optional,	// TS 129 212
    set_of_QoS_Information_AVP			qoS_Information optional,			// TS 129 212
    Revalidation_Time_AVP				revalidation_Time optional,			// TS 129 212
    set_of_Usage_Monitoring_Information_AVP	usage_Monitoring_Information optional,	// TS 129 212
	set_of_Proxy_Info_AVP 				proxy_Info optional,				//RFC3588 & TS 129 214 & TS 129 212
	set_of_Route_Record_AVP 			route_Record optional,				//RFC3588 & TS 129 214 & TS 129 212
	set_of_AVP_Type						aVP_Type optional						//RFC3588 & TS 129 214 & TS 129 212	
}*/
void RAR_MSG::PreDecode(Buffer& buffer) throw (DecodeError)
{
	m_nStartingPosition = buffer.GetPosition();
}

void RAR_MSG::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("RAR_MSG", field_id);
	unsigned int nNextCode = getAVPCode(buffer);

	/*if(field_id == id_origin_State_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Origin_State_Id) ? 1 : 0);
	else if(field_id == id_error_Message)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Error_Message) ? 1 : 0);
	else if(field_id == id_failed)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Failed_AVP) ? 1 : 0);
	else if(field_id == id_supported_Vendor_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Supported_Vendor_Id) ? 1 : 0);
	else if(field_id == id_auth_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Auth_Application_Id) ? 1 : 0);
	else if(field_id == id_inband_Security_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Inband_Security_Id) ? 1 : 0);
	else if(field_id == id_acct_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Acct_Application_Id) ? 1 : 0);
	else if(field_id == id_vendor_Specific_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Vendor_Specific_Application_Id) ? 1 : 0);
	else if(field_id == id_firmware_Revision)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Firmware_Revision) ? 1 : 0);
	else if(field_id == id_aVP_Type)
	{//set_of_AVP_Type 					aVP_Type optional
		//decide if there is still bytes left undecoded
		unsigned int nDH_length = getBytesRemaining_D(buffer, Get_header(), m_nStartingPosition);
		SetHypFieldIsPresent(field_id, (nDH_length > 0 ) ? 1 : 0);
	}*/
}







/*
type record DiameterHeader {
	UInt8 			    version,
	UInt24              msglen,   //message length
	Command_Flags  		cmdflags, //command flags
	Command_Code 		cmdcode,  //command code
    UInt32  			applid,   //application id
    UInt32	        	hopid optional, //hop_by_hop_id
    UInt32   	        endid optional  //end_to_end_id
}*/
void DiameterHeader::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "DiameterHeader::PreDecodeField: " << field_id << std::endl;
	logfile.close();
#endif
	switch (field_id)
	{
		case id_cmdcode:
			Get_cmdcode().SetRequest();
			break;
		break;
		case id_hopid://mandatory in the standard
		case id_endid://mandatory in the standard
			SetHypFieldIsPresent(field_id, 1);
			break;
		default:
			break;
	}
}

/*
type record Command_Flags{
    Bit1 r_bit,   //Request
    Bit1 p_bit,   //Proxiable
    Bit1 e_bit,   //Error
    Bit1 t_bit,   //Potentialy re-transmited message
    Bit4 reserved_bits
};*/
void Command_Flags::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "Command_Flags::PreDecodeField: " << field_id << std::endl;
	logfile.close();
#endif
}

/*type record AVP_Type {
	AVP_Header         aVP_Header,
	AVP_Data           aVP_Data    optional            
};*/
void AVP_Type::PreEncodeField(int field_id, Buffer& buffer) throw (EncodeError)
{
}

void AVP_Type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "AVP_Type::PreDecodeField: " << field_id << std::endl;
	logfile.close();
#endif
	if(field_id == id_aVP_Data)
	{
		unsigned int nCode = Get_aVP_Header().Get_aVP_Code().GetValue();
		//TODO: what is the string value???
		int nV_flag = Get_aVP_Header().Get_aVP_flags().Get_v_bit().GetValue().at(0);
		unsigned int nDataLength = Get_aVP_Header().Get_aVP_len().GetValue();

		nDataLength -= 8;
		if(nV_flag)
			nDataLength -= 4;

		if(nDataLength == 0)
			SetHypFieldIsPresent(id_aVP_Data, 0);
		else
		{
			SetHypFieldIsPresent(id_aVP_Data, 1);
			Get_aVP_Data().m_nDataLength = nDataLength;
			Get_aVP_Data().m_nExpectedData = 0;//TODO:	for now all data is considered as octetstring....

			/*in case i might know the contents based on the code and V-ID
			int nSelectedFieldId = 0;//id_oCTETSTRING;
			if(nCode == ?)
				nSelectedFieldId = 1;//id_cHARSTRING;
			else if(nCode == ?)
				nSelectedFieldId = 2;//id_iNTEGER32;
			else if(nCode == ?)
				nSelectedFieldId = 3;//id_iNTEGER64;
			else if(nCode == ?)
				nSelectedFieldId = 4;//id_iNTEGER32;
			else if(nCode == ?)
				nSelectedFieldId = 5;//id_uNSIGNED32;
			else if(nCode == ?)
				nSelectedFieldId = 6;//id_uNSIGNED64;
			else if(nCode == ?)
				nSelectedFieldId = 7;//id_fLOAT32;
			else if(nCode == ?)
				nSelectedFieldId = 8;//id_fLOAT64;
			else if(nCode == ?)
				nSelectedFieldId = 9;//id_gROUPED;
			Get_aVP_Data().m_nExpectedData = nSelectedFieldId;
			*/
		}

	}
}
void AVP_Type::PostDecode(Buffer& buffer) throw (DecodeError)
{
	unsigned int nCode = Get_aVP_Header().Get_aVP_Code().GetValue();
	//TODO: what is the string value???
	int nV_flag = Get_aVP_Header().Get_aVP_flags().Get_v_bit().GetValue().at(0);
	unsigned int nDataLength = Get_aVP_Header().Get_aVP_len().GetValue();

	nDataLength -= 8;
	if(nV_flag)
		nDataLength -= 4;

	int nPadding = 0;
	while(nDataLength%4)
		nPadding++;
	
	//skip padding bytes
	buffer.SetPosition(buffer.GetPosition() + nPadding * 8);
}

/*type record AVP_Header{
	AVP_Code           aVP_Code,
	AVP_Flags          aVP_flags,
	AVP_Length         aVP_len,
	AVP_Vendor_ID      aVP_vid     optional
};*/
void AVP_Header::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "AVP_Header::PreDecodeField: " << field_id << std::endl;
	logfile.close();
#endif
	if(field_id == id_aVP_vid)
	{
		int nV_flag = Get_aVP_flags().Get_v_bit().GetValue().at(0);
		SetHypFieldIsPresent(id_aVP_vid, nV_flag);
	}
}

/*type record AVP_Flags{
    Bit1    v_bit,
    Bit1    m_bit,
    Bit1    p_bit,
    Bit5    reserved_bits
}*/
void AVP_Flags::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "AVP_Flags::PreDecodeField: " << field_id << std::endl;
	logfile.close();
#endif
}

/*type union AVP_Data {
	// Ref: FRC3588 p.4.1 Basic Avp Data Formats
	octetstring oCTETSTRING,
	charstring 	cHARSTRING, 
	Int32       iNTEGER32,
	Int64       iNTEGER64,
	UInt32      uNSIGNED32,
	UInt64      uNSIGNED64,
	FLOAT32     fLOAT32,
	FLOAT64     fLOAT64,
	GROUPED     gROUPED
};*/
//not actually required???
/*void AVP_Data::PreEncode (Buffer& buffer) throw (EncodeError)
{
	//if(GetChosenId() == id_intValue)
	//	Get_intValue().SetFormat(Integer::AsciiDecimal);
}*/

void AVP_Data::PreDecode (Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "AVP_Data::PreDecode" << std::endl;
	logfile.close();
#endif

	int nSelectedFieldId = id_oCTETSTRING;//unknown data

	
	if(m_nExpectedData == 1)//if, by any chance I might know what the data contains... then
	{
		nSelectedFieldId = id_cHARSTRING;
		SetHypFieldLength(nSelectedFieldId, m_nDataLength * 8);
	}
	else if(m_nExpectedData == 2)
		nSelectedFieldId = id_iNTEGER32;
	else if(m_nExpectedData == 3)
		nSelectedFieldId = id_iNTEGER64;
	else if(m_nExpectedData == 4)
		nSelectedFieldId = id_iNTEGER32;
	else if(m_nExpectedData == 5)
		nSelectedFieldId = id_uNSIGNED32;
	else if(m_nExpectedData == 6)
		nSelectedFieldId = id_uNSIGNED64;
	else if(m_nExpectedData == 7)
		nSelectedFieldId = id_fLOAT32;
	else if(m_nExpectedData == 8)
		nSelectedFieldId = id_fLOAT64;
	else if(m_nExpectedData == 9)
		nSelectedFieldId = id_gROUPED;
	else
		SetHypFieldLength(nSelectedFieldId, m_nDataLength * 8);

	SetHypChosenId(nSelectedFieldId);
}

/*type record GROUPED{
	AVP_Header  	aVP_Header,
	set_of_AVP_Type aVP_Type
};*/
void GROUPED::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "AVP_Header::PreDecodeField: " << field_id << std::endl;
	logfile.close();
#endif
	if(field_id == id_aVP_Type)
	{//TODO: optimize
		unsigned int nCode = Get_aVP_Header().Get_aVP_Code().GetValue();
		int nV_flag = Get_aVP_Header().Get_aVP_flags().Get_v_bit().GetValue().at(0);
		unsigned int nDataLength = Get_aVP_Header().Get_aVP_len().GetValue();

		nDataLength -= 8;
		if(nV_flag)
			nDataLength -= 4;
			
		Get_aVP_Type().m_nRemainingDataLength = nDataLength;
	}
}
//TODO: EVERYONE WHO IS USING THIS, HAS TO SPECIFY THE REMAINING LENGTH, OTHERWISE THIS WILL FAIL!!!!!

//type set of AVP_Type set_of_AVP_Type;
void set_of_AVP_Type::PreDecode(Buffer& buffer) throw (DecodeError)
{
#ifdef DEBUG_LOG
	std::ofstream logfile("C:\\Temp\\LibDiameter.log", ios::app);
	logfile << "set_of_AVP_Type::PreDecode: " << std::endl;
	logfile.close();
#endif
	m_nStartingPosition = buffer.GetPosition();
}

void set_of_AVP_Type::PostDecodeField(int id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PostDecodeField("set_of_AVP_Type", id);

	if((buffer.GetPosition() - m_nStartingPosition) < (m_nRemainingDataLength * 8))
		SetHypSize(GetSize() + 1);
	else
		SetHypSize(-2);
}



//http://www.iana.org/assignments/address-family-numbers
//0	Reserved	
//1	IP (IP version 4)	
//2	IP6 (IP version 6)
//...

/*type union Address{
	IPv4Addr ipv4,
	IPv6Addr ipv6
};*/
//NB! anyone using this has to skip padding bits themselves!!!
void Address::PreDecode (Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecode("Address");

	Unsigned family(16);
	family.Decode(buffer);
	unsigned int nFamily = family.GetValue();

	if(nFamily == 1)
		SetHypChosenId(id_ipv4);
	else if(nFamily == 2)
		SetHypChosenId(id_ipv6);
	else
	{
		DecodeError ex (this); 
		ex.Msg() << "Unknown address family for deciding Address variant: " 
			   << nFamily
			   << " (valid values are: 1 and 2)" << endl; 
		throw ex;
	}
}

//type record length (4) of UInt8  IPv4Addr;
void IPv4Addr::PreDecode(Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecode("IPv4Addr");
	SetHypSize(4);
}

//type record length (8) of UInt16 IPv6Addr;
void IPv6Addr::PreDecode(Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecode("IPv6Addr");
	SetHypSize(8);
}

//////////////////////////////////////////////////////////
//////////////////  Address AVPs  ////////////////////////
//////////////////////////////////////////////////////////
#define ADDRESS_AVP_COMMON_PreDecodeField(type) \
	void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)	\
	{	\
		debug_log_PreDecodeField(#type, field_id);	\
		if(field_id == id_aVP_Data)	\
		{	\
			unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \
			SetHypFieldLength(id_aVP_Data, nDataLength * 8);	\
		}	\
	}
#define ADDRESS_AVP_COMMON_PostDecode(type) \
	void type::PostDecode(Buffer& buffer) throw (DecodeError)	\
	{	\
			unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \
			int nPadding = 0; \
			while(nDataLength%4){	\
				nPadding++;	\
				nDataLength++;	\
			}	\
			buffer.SetPosition(buffer.GetPosition() + nPadding * 8);	\
	}

/*type record Host_IP_Address_AVP{
//Ref: RFC3588 5.3.5.  Host-IP-Address AVP
	AVP_Header			aVP_Header,//<AVP header: 257 ....>
	Address				aVP_Data
};*/
ADDRESS_AVP_COMMON_PreDecodeField(Host_IP_Address_AVP)
ADDRESS_AVP_COMMON_PostDecode(Host_IP_Address_AVP)

/*type record Access_Network_Charging_Address_AVP{
//Ref: ETSI TS 129 214 Access_Network_Charging_Address AVP
    AVP_Header			aVP_Header,//<AVP header: 501 ....>
    Address         	aVP_Data
};*/
ADDRESS_AVP_COMMON_PreDecodeField(Access_Network_Charging_Address_AVP)
ADDRESS_AVP_COMMON_PostDecode(Access_Network_Charging_Address_AVP)


//////////////////////////////////////////////////////////
///////////////  Octetstring AVPs  //////////////////
//////////////////////////////////////////////////////////

#define OCTETSTRING_AVP_COMMON_PreDecodeField(type) \
	void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)	\
	{	\
		debug_log_PreDecodeField(#type, field_id);	\
		if(field_id == id_aVP_Data)	\
		{	\
			unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \
			SetHypFieldLength(id_aVP_Data, nDataLength * 8);	\
		}	\
	}
#define OCTETSTRING_AVP_COMMON_PostDecode(type) \
	void type::PostDecode(Buffer& buffer) throw (DecodeError)	\
	{	\
			unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \
			int nPadding = 0; \
			while(nDataLength%4){	\
				nPadding++;	\
				nDataLength++;	\
			}	\
			buffer.SetPosition(buffer.GetPosition() + nPadding * 8);	\
	}

/*type record Access_Network_Charging_Identifier_Value_AVP{
//Ref: ETSI TS 129 214  Access_Network_Charging_Identifier_Value AVP
    AVP_Header			aVP_Header,//<AVP header: 503 ....>
    octetstring        	aVP_Data
};*/
OCTETSTRING_AVP_COMMON_PreDecodeField(Access_Network_Charging_Identifier_Value_AVP)
OCTETSTRING_AVP_COMMON_PostDecode(Access_Network_Charging_Identifier_Value_AVP)

/*type record Class_AVP{
//Ref: RFC3588 8.20.  Class AVP
	AVP_Header         	aVP_Header,//<AVP header: 25 ....>
	octetstring			aVP_Data
};*/
OCTETSTRING_AVP_COMMON_PreDecodeField(Class_AVP)
OCTETSTRING_AVP_COMMON_PostDecode(Class_AVP)

//////////////////////////////////////////////////////////
///////////////  UTF8String AVPs  ////////////////////////
//////////////////////////////////////////////////////////

//TODO: how is UTF8String handled?????
#define UTF8STRING_AVP_COMMON_PreDecodeField(type) \
	void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)	\
	{	\
		debug_log_PreDecodeField(#type, field_id);	\
		if(field_id == id_aVP_Data)	\
		{	\
			unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \
			SetHypFieldLength(id_aVP_Data, nDataLength * 8);	\
		}	\
	}
#define UTF8STRING_AVP_COMMON_PostDecode(type) \
	void type::PostDecode(Buffer& buffer) throw (DecodeError)	\
	{	\
			unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \
			int nPadding = 0; \
			while(nDataLength%4){	\
				nPadding++;	\
				nDataLength++;	\
			}	\
			buffer.SetPosition(buffer.GetPosition() + nPadding * 8);	\
	}

//RFC 3588

/*type record Acct_Multi_Session_Id_AVP{
//Ref: RFC3588 9.8.5.  Acct-Multi-Session-Id AVP
	AVP_Header         	aVP_Header,//<AVP header: 50 ....>
	UTF8String 			aVP_Data			
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(Acct_Multi_Session_Id_AVP)
UTF8STRING_AVP_COMMON_PostDecode(Acct_Multi_Session_Id_AVP)

/*type record Error_Message_AVP{
//Ref: RFC3588 7.3.  Error-Message AVP
	AVP_Header         	aVP_Header,//<AVP header: 281 ....>
	UTF8String			aVP_Data						
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(Error_Message_AVP)
UTF8STRING_AVP_COMMON_PostDecode(Error_Message_AVP)

/*type record Product_Name_AVP{
//Ref: RFC3588 5.3.7.  Product-Name AVP
	AVP_Header         	aVP_Header,//<AVP header: 269 ....>
	UTF8String			aVP_Data							
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(Product_Name_AVP)
UTF8STRING_AVP_COMMON_PostDecode(Product_Name_AVP)

/*type record Session_Id_AVP{
//Ref: RFC3588 8.8.  Session-Id AVP
	AVP_Header         	aVP_Header,//<AVP header: 263 ....>
	UTF8String 			aVP_Data						
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(Session_Id_AVP)
UTF8STRING_AVP_COMMON_PostDecode(Session_Id_AVP)

/*type record User_Name_AVP{
//Ref: RFC3588 8.14.  User-Name AVP						
	AVP_Header         	aVP_Header,//<AVP header: 1 ....>
	UTF8String 			aVP_Data
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(User_Name_AVP)
UTF8STRING_AVP_COMMON_PostDecode(User_Name_AVP)



//RFC 4740

/*type record SIP_Server_URI_AVP{
//	Ref: RFC4740 9.2 SIP-Server-URI AVP
	AVP_Header         	aVP_Header,//<AVP header: 371 ....>
	UTF8String			aVP_Data
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(SIP_Server_URI_AVP)
UTF8STRING_AVP_COMMON_PostDecode(SIP_Server_URI_AVP)

/*type record SIP_Reason_Info_AVP{ 
	//Ref: RFC4740 9.7.2.  SIP-Reason-Info AVP
	AVP_Header         			aVP_Header,//<AVP header: 385 ....>
	UTF8String					aVP_Data
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(SIP_Reason_Info_AVP)
UTF8STRING_AVP_COMMON_PostDecode(SIP_Reason_Info_AVP)

/*type record SIP_Visited_Network_Id_AVP{
//	Ref: RFC4740 9.9.  SIP-Visited-Network-Id AVP			
	AVP_Header         	aVP_Header,//<AVP header: 386 ....>
	UTF8String			aVP_Data
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(SIP_Visited_Network_Id_AVP)
UTF8STRING_AVP_COMMON_PostDecode(SIP_Visited_Network_Id_AVP)

/*type record SIP_Supported_User_Data_Type_AVP{
//Ref: RFC4740 9.12.1.  SIP-User-Data-Type AVP
	AVP_Header         	aVP_Header,//<AVP header: 388 ....>
	UTF8String			aVP_Data
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(SIP_Supported_User_Data_Type_AVP)
UTF8STRING_AVP_COMMON_PostDecode(SIP_Supported_User_Data_Type_AVP)

/*type record SIP_User_Data_Type_AVP{
// Ref: RFC4740 9.12.1.  SIP-User-Data-Type AVP
	AVP_Header         	aVP_Header,//<AVP header: 390 ....>
	UTF8String			aVP_Data
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(SIP_User_Data_Type_AVP)
UTF8STRING_AVP_COMMON_PostDecode(SIP_User_Data_Type_AVP)

/*type record SIP_Method_AVP{
//Ref: RFC4740 9.14.  SIP-Method AVP
	AVP_Header         	aVP_Header,//<AVP header: 393 ....>
	UTF8String			aVP_Data
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(SIP_Method_AVP)
UTF8STRING_AVP_COMMON_PostDecode(SIP_Method_AVP)

//From 129.214

/*type record Application_Service_Provider_Identity_AVP{
//Ref: ETSI TS 129 214 Application_Service_Provider_Identity AVP
    AVP_Header			aVP_Header,//<AVP header: 532 ....>
    UTF8String        	aVP_Data
}; */
UTF8STRING_AVP_COMMON_PreDecodeField(Application_Service_Provider_Identity_AVP)
UTF8STRING_AVP_COMMON_PostDecode(Application_Service_Provider_Identity_AVP)

/*type record Sponsor_Identity_AVP{
 //Ref: ETSI TS 129 214 Sponsor_Identity AVP
     AVP_Header			aVP_Header,//<AVP header: 531 ....>
     UTF8String     	aVP_Data
 };*/
UTF8STRING_AVP_COMMON_PreDecodeField(Sponsor_Identity_AVP)
UTF8STRING_AVP_COMMON_PostDecode(Sponsor_Identity_AVP)


//From RFC 4006
/*type record Subscription_Id_Data_AVP{
//	Ref: RFC4006 
	AVP_Header         			aVP_Header,//<AVP header: 444 ....>
	UTF8String                  aVP_Data							
};*/
UTF8STRING_AVP_COMMON_PreDecodeField(Subscription_Id_Data_AVP)
UTF8STRING_AVP_COMMON_PostDecode(Subscription_Id_Data_AVP)


//////////////////////////////////////////////////////////
///////////////  DiameterIdentity AVPs  //////////////////
//////////////////////////////////////////////////////////

//type charstring Diameter_Identity;
#define DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(type) \
	void type::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)	\
	{	\
		debug_log_PreDecodeField(#type, field_id);	\
		if(field_id == id_aVP_Data)	\
		{	\
			unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \
			SetHypFieldLength(id_aVP_Data, nDataLength * 8);	\
		}	\
	}
#define DIAMETER_IDENTITY_AVP_COMMON_PostDecode(type) \
	void type::PostDecode(Buffer& buffer) throw (DecodeError)	\
	{	\
			unsigned int nDataLength = getAVPDataLength(Get_aVP_Header()); \
			int nPadding = 0; \
			while(nDataLength%4){	\
				nPadding++;	\
				nDataLength++;	\
			}	\
			buffer.SetPosition(buffer.GetPosition() + nPadding * 8);	\
	}

/*type record Origin_Host_AVP{
//Ref: RFC3588 6.3.  Origin-Host AVP
	AVP_Header			aVP_Header,//<AVP header: 264 ....>
	Diameter_Identity  	aVP_Data			
};*/
DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(Origin_Host_AVP)
DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Origin_Host_AVP)

/*type record Origin_Realm_AVP{
//Ref: RFC3588 6.4.  Origin-Realm AVP
	AVP_Header			aVP_Header,//<AVP header: 296 ....>
	Diameter_Identity 	aVP_Data						
};*/
DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(Origin_Realm_AVP)
DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Origin_Realm_AVP)

/*type record Destination_Realm_AVP{
//Ref: RFC3588 6.6.  Destination-Realm AVP
	AVP_Header         	aVP_Header,//<AVP header: 328 ....>
	Diameter_Identity 	aVP_Data						
};*/
DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(Destination_Realm_AVP)
DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Destination_Realm_AVP)

/*type record Destination_Host_AVP{
//Ref: RFC3588 6.5.  Destination-Host AVP
	AVP_Header         	aVP_Header,//<AVP header: 293 ....>
	Diameter_Identity 	aVP_Data						
};*/
DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(Destination_Host_AVP)
DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Destination_Host_AVP)

/*type record Route_Record_AVP{
//Ref: RFC3588 6.7.1.  Route-Record AVP
	AVP_Header         	aVP_Header,//<AVP header: 282 ....>
	Diameter_Identity 	aVP_Data							
};		*/
DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(Route_Record_AVP)
DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Route_Record_AVP)

/*type record Error_Reporting_Host_AVP{
//Ref: RFC3588 7.4.  Error-Reporting-Host AVP
	AVP_Header         	aVP_Header,//<AVP header: 294 ....>
	Diameter_Identity 	aVP_Data						
};*/
DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(Error_Reporting_Host_AVP)
DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Error_Reporting_Host_AVP)

/*type record Proxy_Host_AVP{
//Ref: RFC3588 6.7.3.  Proxy-Host AVP
	AVP_Header         	aVP_Header,//<AVP header: 280 ....>
	Diameter_Identity 	aVP_Data						
};*/
DIAMETER_IDENTITY_AVP_COMMON_PreDecodeField(Proxy_Host_AVP)
DIAMETER_IDENTITY_AVP_COMMON_PostDecode(Proxy_Host_AVP)


///////////////////////////////////////////////////////
///////////////  Time AVPs  //////////////////
///////////////////////////////////////////////////////

//type UInt64 Time; //TODO: this is wrong?...
#define TIME_AVP_COMMON(type) \
	void type::PreDecode(Buffer& buffer) throw (DecodeError)\
	{\
		debug_log_PreDecode(#type);\
	}

/*type record  Tariff_Time_Change_AVP{
//	Ref: RFC4006 8.20.  Tariff-Time-Change AVP
	AVP_Header         			aVP_Header,//< AVP Header: 451 >
	Time 						aVP_Data			
};*/
TIME_AVP_COMMON(Tariff_Time_Change_AVP)


///////////////////////////////////////////////////////
///////////////  INT32, UINT32 AVPs  //////////////////
///////////////////////////////////////////////////////
#define INT32_AVP_COMMON(type) \
	void type::PreDecode(Buffer& buffer) throw (DecodeError)\
	{\
		debug_log_PreDecode(#type);\
	}

#define UINT32_AVP_COMMON(type) \
	void type::PreDecode(Buffer& buffer) throw (DecodeError)\
	{\
		debug_log_PreDecode(#type);\
	}

/*type record Supported_Vendor_Id_AVP{
//Ref; 5.3.6.  Supported-Vendor-Id AVP
	AVP_Header        	aVP_Header,//<AVP header: 265 ....>
	Int32				aVP_Data							
};*/
INT32_AVP_COMMON(Supported_Vendor_Id_AVP)

/*type record Origin_State_Id_AVP{
//Ref: RFC3588 8.16.  Origin-State-Id AVP
	AVP_Header         	aVP_Header,//<AVP header: 278 ....>
	UInt32 				aVP_Data
};*/
UINT32_AVP_COMMON(Origin_State_Id_AVP)


/*type record Vendor_Id_AVP{
//Ref: RFC3588 5.3.3.  Vendor-Id AVP
	AVP_Header         	aVP_Header,//<AVP header: 266 ....>
	UInt32				aVP_Data	
};*/
UINT32_AVP_COMMON(Vendor_Id_AVP)

/*type record Inband_Security_Id_AVP{
//Ref: RFC3588 6.10.  Inband-Security-Id AVP
	AVP_Header         	aVP_Header,//<AVP header: 299 ....>
	UInt32 				aVP_Data							
};*/
UINT32_AVP_COMMON(Inband_Security_Id_AVP)

/*type record Auth_Application_Id_AVP{
//Ref: RFC3588 6.8.  Auth-Application-Id AVP
	AVP_Header         	aVP_Header,//<AVP header: 258 ....>
	UInt32 				aVP_Data							
};*/
UINT32_AVP_COMMON(Auth_Application_Id_AVP)

/*type record Acct_Application_Id_AVP{
//Ref: RFC3588 6.9.  Acct-Application-Id AVP				
	AVP_Header         	aVP_Header,//<AVP header: 259 ....>
	UInt32 				aVP_Data							
};*/
UINT32_AVP_COMMON(Acct_Application_Id_AVP)

/*type record Firmware_Revision_AVP{
//Ref: RFC3588 5.3.4.  Firmware-Revision AVP
	AVP_Header        	aVP_Header,//<AVP header: 267 ....>
	UInt32 				aVP_Data							
};*/
UINT32_AVP_COMMON(Firmware_Revision_AVP)

/*type record Media_Component_Number_AVP{
 //Ref: ETSI TS 129 214 Media_Component_Number_AVP
     AVP_Header			aVP_Header,//<AVP header: 518 ....>
     UInt32             aVP_Data
 };*/
UINT32_AVP_COMMON(Media_Component_Number_AVP)

/*type record Flow_Number_AVP{
//Ref: ETSI TS 129 214 Flow_Number AVP
    AVP_Header			aVP_Header,//<AVP header: 509 ....>
    UInt32          	aVP_Data
};*/
UINT32_AVP_COMMON(Flow_Number_AVP)

/*type record CC_Time_AVP{
//	Ref: RFC4006 8.21.  CC-Time AVP
	AVP_Header         			aVP_Header,//< AVP Header: 420 >
	UInt32                  	aVP_Data											
};*/
UINT32_AVP_COMMON(CC_Time_AVP)

/*type record Exponent_AVP{
//	Ref: RFC4006 8.9.  Exponent AVP
	AVP_Header         			aVP_Header,//< AVP Header: 429 >
	Int32                   	aVP_Data							
};*/
INT32_AVP_COMMON(Exponent_AVP)

/*type record Currency_Code_AVP{
//	Ref: RFC4006 8.11.  Currency-Code AVP
	AVP_Header         			aVP_Header,//< AVP Header: 425 >				
	UInt32						aVP_Data
};*/
UINT32_AVP_COMMON(Currency_Code_AVP)

/*type record CSG_Id_AVP{
//Ref: ETSI TS 132 299 & TS129 272 CSG_Id_AVP
    AVP_Header			aVP_Header, //<AVP header: 1437 ....>
    UInt32        		aVP_Data
};*/
UINT32_AVP_COMMON(CSG_Id_AVP)

///////////////////////////////////////////////////////
////////  INT32 as ENUMERATED AVPs  //////////////////
///////////////////////////////////////////////////////

/*type record Subscription_Id_Type_AVP{
//	Ref: RFC4006 8.47.  Subscription-Id-Type AVP
	AVP_Header         			aVP_Header,//<AVP header: 450 ....>
	Subscription_Id_Ty_Type     aVP_Data			
};*/
INT32_AVP_COMMON(Subscription_Id_Type_AVP)

/*type record Abort_Cause_AVP{
//Ref: ETSI TS 129 214 Abort Cause AVP
    AVP_Header			aVP_Header,//<AVP header: 500 ....>
    Abort_Cause_Type	aVP_Data
};*/
INT32_AVP_COMMON(Abort_Cause_AVP)

/*type record IP_CAN_Type_AVP{
//Ref: ETSI TS 129 212 IP CAN Type AVP
    AVP_Header			aVP_Header,//<AVP header: 1027 ....>
    IP_CAN_Type			aVP_Data
};*/
INT32_AVP_COMMON(IP_CAN_Type_AVP)

/*type record RAT_Type_AVP{
//Ref: ETSI TS 129 212 RAT Type AVP
    AVP_Header			aVP_Header,//<AVP header: 1032 ....>
    RAT_Type			aVP_Data
};*/
INT32_AVP_COMMON(RAT_Type_AVP)

/*type record Tariff_Change_Usage_AVP{
//	Ref: RFC4006 8.27.  Tariff-Change-Usage AVP
	AVP_Header         			aVP_Header,//< AVP Header: 452 >
	Tariff_Change_Usage_Type    aVP_Data			
};*/
INT32_AVP_COMMON(Tariff_Change_Usage_AVP)

/*type record Session_Release_Cause_AVP{
//Ref: ETSI TS 129 212 Session_Release_Cause_AVP
    AVP_Header				aVP_Header,//<AVP header: 1045 ....>
    Session_Release_Cause	aVP_Data
};*/
INT32_AVP_COMMON(Session_Release_Cause_AVP)

/*type record Event_Trigger_AVP{
//Ref: ETSI TS 129 212 Event_Trigger_AVP
    AVP_Header			aVP_Header,//<AVP header: 1006 ....>
    Event_Trigger		aVP_Data
};*/
INT32_AVP_COMMON(Event_Trigger_AVP)

/*type record CSG_Access_Mode_AVP{
//Ref: ETSI TS 132 299 CSG_Access_Mode_AVP
    AVP_Header		aVP_Header, //<AVP header: 2317 ....>
    CSG_Access_Mode	aVP_Data
};*/
INT32_AVP_COMMON(CSG_Access_Mode_AVP)

/*type record CSG_Membership_Indication_AVP{
//Ref: ETSI TS 132 299 CSG_Membership_Indication_AVP
    AVP_Header					aVP_Header, //<AVP header: 2318 ....>
    CSG_Membership_Indication	aVP_Data
};*/
INT32_AVP_COMMON(CSG_Membership_Indication_AVP)

///////////////////////////////////////////////////////
////////  UINT32 as ENUMERATED AVPs  //////////////////
///////////////////////////////////////////////////////

/*type record Result_Code_AVP{
//Ref: RFC3588 7.1.  Result-Code AVP
	AVP_Header         	aVP_Header,//<AVP header: 268 ....>
	//UInt32
	Result_Code_Type 				aVP_Data		
};*/
UINT32_AVP_COMMON(Result_Code_AVP)

/*type record Specific_Action_AVP{
 //Ref: ETSI TS 129 214 Specific_Action AVP
     AVP_Header			aVP_Header,//<AVP header: 513 ....>
     Specific_Action_Type	aVP_Data
 }; */
UINT32_AVP_COMMON(Specific_Action_AVP)

/*type record Re_Auth_Request_Type_AVP{
//Ref: RFC3588 8.12.  Re-Auth-Request-Type AVP
	AVP_Header         	aVP_Header,//<AVP header: 285 ....>
	Re_Auth_Req_Type 	aVP_Data						
};*/
UINT32_AVP_COMMON(Re_Auth_Request_Type_AVP)

/*type record Final_Unit_Action_AVP{
//	Ref: RFC4006 8.35.  Final-Unit-Action AVP
	AVP_Header         			aVP_Header,//< AVP Header: 449 >
	Final_Unit_Action_Type		aVP_Data							
};*/
UINT32_AVP_COMMON(Final_Unit_Action_AVP)

/*type record Flow_Status_AVP{
//Ref: ETSI TS 129 214 Flow_Status AVP
    AVP_Header			aVP_Header,//<AVP header: 511 ...>
    Flow_Status_Type	aVP_Data
};*/
UINT32_AVP_COMMON(Flow_Status_AVP)



///////////////////////////////////////////////////////
///////////////  INT64, UINT64 AVPs  //////////////////
///////////////////////////////////////////////////////

#define INT64_AVP_COMMON(type) \
	void type::PreDecode(Buffer& buffer) throw (DecodeError)\
	{\
		debug_log_PreDecode(#type);\
	}

#define UINT64_AVP_COMMON(type) \
	void type::PreDecode(Buffer& buffer) throw (DecodeError)\
	{\
		debug_log_PreDecode(#type);\
	}

/*type record Value_Digits_AVP{
//	Ref: RFC4006 8.10.  Value-Digits AVP
	AVP_Header         			aVP_Header,//< AVP Header: 447 >
	Int64                  		aVP_Data				
};*/
INT64_AVP_COMMON(Value_Digits_AVP)

/*type record CC_Total_Octets_AVP{
//	Ref: RFC4006 8.23.  CC-Total-Octets AVP
	AVP_Header         			aVP_Header,//< AVP Header: 421 >
	UInt64                  	aVP_Data							
};*/
UINT64_AVP_COMMON(CC_Total_Octets_AVP)

/*type record CC_Input_Octets_AVP{
//	Ref: RFC4006 8.24.  CC-Input-Octets AVP
	AVP_Header         			aVP_Header,//< AVP Header: 412 >
	UInt64                  	aVP_Data											
};*/
UINT64_AVP_COMMON(CC_Input_Octets_AVP)

/*type record CC_Output_Octets_AVP{
//	Ref: RFC4006 8.25.  CC-Output-Octets AVP
	AVP_Header         			aVP_Header,//< AVP Header: 414 >
	UInt64                  	aVP_Data											
};*/
UINT64_AVP_COMMON(CC_Output_Octets_AVP)

/*type record CC_Service_Specific_Units_AVP{
//	Ref: RFC4006 8.26.  CC-Service-Specific-Units AVP
	AVP_Header         			aVP_Header,//< AVP Header: 417 >
	UInt64                  	aVP_Data								
};*/
UINT64_AVP_COMMON(CC_Service_Specific_Units_AVP)

///////////////////////////////////////////////////////
////////////////  SET OF AVPs  ////////////////////////
///////////////////////////////////////////////////////
//common code for all set_of_*AVP types
#define SET_OF_AVP_COMMON_PreDecode(type, avp_id) \
	void type::PreDecode(Buffer& buffer) throw (DecodeError)\
	{\
		debug_log_PreDecode(#type);\
		int nStartingPos = buffer.GetPosition();\
		Unsigned code(32);\
		code.Decode(buffer);\
		unsigned int nCode = code.GetValue();\
		if(nCode == avp_id)\
			SetHypSize(1);\
		else\
			SetHypSize(0);\
		buffer.SetPosition(nStartingPos);\
	}

#define SET_OF_AVP_COMMON_PostDecodeField(type, avp_id) \
	void type::PostDecodeField(int id, Buffer& buffer) throw (DecodeError)\
	{\
		debug_log_PostDecodeField(#type, id);\
		int nStartingPos = buffer.GetPosition();\
		Unsigned code(32);\
		code.Decode(buffer);\
		unsigned int nCode = code.GetValue();\
		if(nCode == avp_id)\
			SetHypSize(GetSize() + 1);\
		buffer.SetPosition(nStartingPos);\
	}

//type set of Auth_Application_Id_AVP set_of_Auth_Application_Id_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Auth_Application_Id_AVP, AVP_CODE_Auth_Application_Id)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Auth_Application_Id_AVP, AVP_CODE_Auth_Application_Id)

//type set of Supported_Vendor_Id_AVP set_of_Supported_Vendor_Id_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Supported_Vendor_Id_AVP, AVP_CODE_Supported_Vendor_Id)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Supported_Vendor_Id_AVP, AVP_CODE_Supported_Vendor_Id)

//type set of Origin_State_Id_AVP set_of_Origin_State_Id_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Origin_State_Id_AVP, AVP_CODE_Origin_State_Id)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Origin_State_Id_AVP, AVP_CODE_Origin_State_Id)

//type set of Host_IP_Address_AVP set_of_Host_IP_Address_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Host_IP_Address_AVP, AVP_CODE_Host_IP_Address)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Host_IP_Address_AVP, AVP_CODE_Host_IP_Address)

//type set of Inband_Security_Id_AVP set_of_Inband_Security_Id_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Inband_Security_Id_AVP, AVP_CODE_Inband_Security_Id)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Inband_Security_Id_AVP, AVP_CODE_Inband_Security_Id)

//type set of Acct_Application_Id_AVP set_of_Acct_Application_Id_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Acct_Application_Id_AVP, AVP_CODE_Acct_Application_Id)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Acct_Application_Id_AVP, AVP_CODE_Acct_Application_Id)

//type set of Vendor_Specific_Appl_Id_AVP set_of_Vendor_Specific_Appl_Id_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Vendor_Specific_Appl_Id_AVP, AVP_CODE_Vendor_Specific_Application_Id)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Vendor_Specific_Appl_Id_AVP, AVP_CODE_Vendor_Specific_Application_Id)

//type set of Vendor_Id_AVP set_of_Vendor_Id_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Vendor_Id_AVP, AVP_CODE_Vendor_Id)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Vendor_Id_AVP, AVP_CODE_Vendor_Id)

//type set of Failed_AVP set_of_Failed_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Failed_AVP, AVP_CODE_Failed_AVP)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Failed_AVP, AVP_CODE_Failed_AVP)

//type set of Flow_Number_AVP set_of_Flow_Number_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Flow_Number_AVP, AVP_CODE_Flow_Number)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Flow_Number_AVP, AVP_CODE_Flow_Number)

//type set of Flows_AVP set_of_Flows_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Flows_AVP, AVP_CODE_Flows)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Flows_AVP, AVP_CODE_Flows)

//type set of Access_Network_Charging_Identifier_AVP set_of_Access_Network_Charging_Identifier_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Access_Network_Charging_Identifier_AVP, AVP_CODE_Access_Network_Charging_Identifier)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Access_Network_Charging_Identifier_AVP, AVP_CODE_Access_Network_Charging_Identifier)

//type set of Subscription_Id_AVP set_of_Subscription_Id_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Subscription_Id_AVP, AVP_CODE_Subscription_Id)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Subscription_Id_AVP, AVP_CODE_Subscription_Id)

//type set of Class_AVP set_of_Class_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Class_AVP, AVP_CODE_Class)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Class_AVP, AVP_CODE_Class)

//type set of Event_Trigger_AVP set_of_Event_Trigger_AVP;
SET_OF_AVP_COMMON_PreDecode(set_of_Event_Trigger_AVP, AVP_CODE_Event_Trigger)
SET_OF_AVP_COMMON_PostDecodeField(set_of_Event_Trigger_AVP, AVP_CODE_Event_Trigger)

///////////////////////////////////////////////////////
////////////////  GROUPED AVPs  ////////////////////////
///////////////////////////////////////////////////////

/*type record Vendor_Specific_Appl_Id_AVP{
//Ref: RFC3588 6.11.  Vendor-Specific-Application-Id AVP
	AVP_Header         	aVP_Header,//<Vendor-Specific-Application-Id> ::= < AVP Header: 260 >
	set_of_Vendor_Id_AVP vendor_Id optional,
	set_of_Auth_Application_Id_AVP 	auth_Application_Id optional,
	set_of_Acct_Application_Id_AVP	acct_Application_Id optional
};*/
void Vendor_Specific_Appl_Id_AVP::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Vendor_Specific_Appl_Id_AVP", field_id);

	unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_vendor_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Vendor_Id) ? 1 : 0);
	else if(field_id == id_auth_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Auth_Application_Id) ? 1 : 0);
	else if(field_id == id_acct_Application_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Acct_Application_Id) ? 1 : 0);
}

/*type record Failed_AVP{
//Ref: RFC3588 7.5.  Failed-AVP AVP
	AVP_Header         	aVP_Header,//<AVP header: 279 ....>			
	set_of_AVP_Type 			aVP
};*/
void Failed_AVP::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Vendor_Specific_Appl_Id_AVP", field_id);
}

/*type record Flows_AVP{
 //Ref: ETSI TS 129 214 Flows_AVP
     AVP_Header			aVP_Header,//<AVP header: 510 ....>
     Media_Component_Number_AVP	media_component_number,
     set_of_Flow_Number_AVP	flow_Number optional,
     Final_Unit_Action_AVP	final_unit_action optional
 };*/
void Flows_AVP::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Flows_AVP", field_id);

	unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_flow_Number)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Flow_Number) ? 1 : 0);
	else if(field_id == id_final_unit_action)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Final_Unit_Action) ? 1 : 0);
}

/*type record Access_Network_Charging_Identifier_AVP{
//Ref: ETSI TS 129 214 Access_Network_Charging_Identifier AVP
    AVP_Header										aVP_Header, //<AVP header: 502 ....>
    Access_Network_Charging_Identifier_Value_AVP 	acc_Net_Charging_Id_Val,
    set_of_Flows_AVP								flows
};*/
void Access_Network_Charging_Identifier_AVP::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Access_Network_Charging_Identifier_AVP", field_id);
}

/*type record Subscription_Id_AVP{
//	Ref: RFC4006 8.46.  Subscription-Id AVP
	AVP_Header         			aVP_Header,//< AVP Header: 443 >
	Subscription_Id_Type_AVP 	subscription_Id_Type,
	Subscription_Id_Data_AVP 	subscription_Id_Data
};*/
void Subscription_Id_AVP::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Subscription_Id_AVP", field_id);
}

/*type record Unit_Value_AVP{
//	Ref: RFC4006 8.8.  Unit-Value AVP
	AVP_Header         			aVP_Header,//< AVP Header: 445 >
	Value_Digits_AVP 			value_Digits,
	Exponent_AVP 				exponent optional				
};*/
void Unit_Value_AVP::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Unit_Value_AVP", field_id);

	unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_exponent)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Exponent) ? 1 : 0);
}

/*type set CC_Money_AVP{
//	Ref: RFC4006 8.22.  CC-Money AVP
	AVP_Header         			aVP_Header,//< AVP Header: 413 >
	Unit_Value_AVP 				unit_Value, 
	Currency_Code_AVP 			currency_Code optional								
};*/
void CC_Money_AVP::PreDecode(Buffer& buffer) throw (DecodeError)
{
	m_nFieldIndex = id_aVP_Header;
}
void CC_Money_AVP::PreDecodeField(Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("CC_Money_AVP", m_nFieldIndex);
	/*
	SetHypNextField(m_nFieldIndex);
	if(m_nFieldIndex == id_aVP_Header)
		m_nFieldIndex = id_unit_Value;
	else if(m_nFieldIndex == id_unit_Value)
		m_nFieldIndex = id_currency_Code;
	else if(field_id == id_currency_Code)
	{
		unsigned int nNextCode = getAVPCode(buffer);
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Currency_Code) ? 1 : 0);
	}*/
}

/*type set Requested_Service_Unit_AVP{
//	Ref: RFC4006 8.18.  Requested-Service-Unit AVP
	AVP_Header         				aVP_Header,//< AVP Header: 437 >
	CC_Time_AVP 					cC_Time optional,
	CC_Money_AVP 					cC_Money optional,
	CC_Total_Octets_AVP 			cC_Total_Octets optional,
	CC_Input_Octets_AVP 			cC_Input_Octets optional,
	CC_Output_Octets_AVP 			cC_Output_Octets optional,
	CC_Service_Specific_Units_AVP 	cC_Service_Specific_Units optional,
	set_of_AVP_Type  				aVP_Type optional
};*/
void Requested_Service_Unit_AVP::PreDecode(Buffer& buffer) throw (DecodeError)
{
	m_nFieldIndex = id_aVP_Header;
}
void Requested_Service_Unit_AVP::PreDecodeField(Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Requested_Service_Unit_AVP", m_nFieldIndex);
	/*unsigned int nNextCode = getAVPCode(buffer);

	if(nNextCode == AVP_CODE_CC_Time)
	{
		SetHypFieldIsPresent(id_cC_Time, 1);
		SetHypNextField(id_cC_Time);
	}
	else if(nNextCode == AVP_CODE_CC_Money)
	{
		SetHypFieldIsPresent(id_cC_Money, 1);
		SetHypNextField(id_cC_Money);
	}
	else if(nNextCode == AVP_CODE_CC_Total_Octets)
	{
		SetHypFieldIsPresent(id_cC_Total_Octets, 1);
		SetHypNextField(id_cC_Total_Octets);
	}
	else if(nNextCode == AVP_CODE_CC_Input_Octets)
	{
		SetHypFieldIsPresent(id_cC_Input_Octets, 1);
		SetHypNextField(id_cC_Input_Octets);
	}
	else if(nNextCode == AVP_CODE_CC_Output_Octets)
	{
		SetHypFieldIsPresent(id_cC_Output_Octets, 1);
		SetHypNextField(id_cC_Output_Octets);
	}
	else if(nNextCode == AVP_CODE_CC_Service_Specific_Units)
	{
		SetHypFieldIsPresent(id_cC_Service_Specific_Units, 1);
		SetHypNextField(id_cC_Service_Specific_Units);
	}
	else if(field_id == id_aVP_Type)
	{
		//custom handling
		unsigned int nAVP_length = getBytesRemaining_AVP(buffer, Get_aVP_Header(), m_nStartingPosition);
		SetHypFieldIsPresent(field_id, (nAVP_length > 0 ) ? 1 : 0);
	}*/
}

/*type set Granted_Service_Unit_AVP{
//	Ref: RFC4006 8.17.  Granted-Service-Unit AVP
	AVP_Header         			aVP_Header,//< AVP Header: 431 >
	Tariff_Time_Change_AVP 		tariff_Time_Change optional,
	CC_Time_AVP 				cC_Time optional,
	CC_Money_AVP 				cC_Money optional,
	CC_Total_Octets_AVP 		cC_Total_Octets optional,
	CC_Input_Octets_AVP 		cC_Input_Octets optional,
	CC_Output_Octets_AVP 		cC_Output_Octets optional,
	CC_Service_Specific_Units_AVP 	cC_Service_Specific_Units optional,
	set_of_AVP_Type 				aVP_Type optional				
};*/
void Granted_Service_Unit_AVP::PreDecode(Buffer& buffer) throw (DecodeError)
{
	m_nFieldIndex = id_aVP_Header;
}
void Granted_Service_Unit_AVP::PreDecodeField(Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Granted_Service_Unit_AVP", m_nFieldIndex);

	/*unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_tariff_Time_Change)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Tariff_Time_Change) ? 1 : 0);
	else if(field_id == id_cC_Time)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Time) ? 1 : 0);
	else if(field_id == id_cC_Money)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Money) ? 1 : 0);
	else if(field_id == id_cC_Total_Octets)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Total_Octets) ? 1 : 0);
	else if(field_id == id_cC_Input_Octets)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Input_Octets) ? 1 : 0);
	else if(field_id == id_cC_Output_Octets)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Output_Octets) ? 1 : 0);
	else if(field_id == id_cC_Service_Specific_Units)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Service_Specific_Units) ? 1 : 0);
	else if(field_id == id_aVP_Type)
	{
		//custom handling
		unsigned int nAVP_length = getBytesRemaining_AVP(buffer, Get_aVP_Header(), m_nStartingPosition);
		SetHypFieldIsPresent(field_id, (nAVP_length > 0 ) ? 1 : 0);
	}*/
}

/*type set Used_Service_Unit_AVP{
//	Ref: RFC4006 8.19.  Used-Service-Unit AVP
	AVP_Header         			aVP_Header,//< AVP Header: 446 >
	Tariff_Change_Usage_AVP 	tariff_Change_Usage optional,
	CC_Time_AVP 				cC_Time optional,
	CC_Money_AVP 				cC_Money optional,
	CC_Total_Octets_AVP 		cC_Total_Octets optional,
	CC_Input_Octets_AVP 		cC_Input_Octets optional,
	CC_Output_Octets_AVP 		cC_Output_Octets optional,
	CC_Service_Specific_Units_AVP 	cC_Service_Specific_Units optional,
	set_of_AVP_Type 				aVP_Type optional
};*/
void Used_Service_Unit_AVP::PreDecode(Buffer& buffer) throw (DecodeError)
{
	m_nFieldIndex = id_aVP_Header;
}
void Used_Service_Unit_AVP::PreDecodeField(Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Used_Service_Unit_AVP", m_nFieldIndex);

	/*unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_tariff_Change_Usage)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Tariff_Change_Usage) ? 1 : 0);
	else if(field_id == id_cC_Time)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Time) ? 1 : 0);
	else if(field_id == id_cC_Money)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Money) ? 1 : 0);
	else if(field_id == id_cC_Total_Octets)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Total_Octets) ? 1 : 0);
	else if(field_id == id_cC_Input_Octets)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Input_Octets) ? 1 : 0);
	else if(field_id == id_cC_Output_Octets)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Output_Octets) ? 1 : 0);
	else if(field_id == id_cC_Service_Specific_Units)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CC_Service_Specific_Units) ? 1 : 0);
	else if(field_id == id_aVP_Type)
	{
		//custom handling
		unsigned int nAVP_length = getBytesRemaining_AVP(buffer, Get_aVP_Header(), m_nStartingPosition);
		SetHypFieldIsPresent(field_id, (nAVP_length > 0 ) ? 1 : 0);
	}*/
}

/*type record Sponsored_Connectivity_Data_AVP{
 //Ref: ETSI TS 129 214 Sponsored_Conectivity_Data AVP
     AVP_Header									aVP_Header, //<AVP header: 530 ....>
     Sponsor_Identity_AVP						sponsor_Identity optional,
     Application_Service_Provider_Identity_AVP 	application_service_provider_Id optional,
     Granted_Service_Unit_AVP					granted_Service_Unit optional,
     Used_Service_Unit_AVP						used_service_unit optional,
     set_of_AVP_Type   							aVP_Type optional
 };*/
void Sponsored_Connectivity_Data_AVP::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("Sponsored_Connectivity_Data_AVP", field_id);

	unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_sponsor_Identity)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Sponsor_Identity) ? 1 : 0);
	else if(field_id == id_application_service_provider_Id)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Application_Service_Provider_Identity) ? 1 : 0);
	else if(field_id == id_granted_Service_Unit)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Granted_Service_Unit) ? 1 : 0);
	else if(field_id == id_used_service_unit)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_Used_Service_Unit) ? 1 : 0);
	else if(field_id == id_aVP_Type)
	{
		//custom handling
		unsigned int nAVP_length = getBytesRemaining_AVP(buffer, Get_aVP_Header(), m_nStartingPosition);
		SetHypFieldIsPresent(field_id, (nAVP_length > 0 ) ? 1 : 0);
	}
}

/*type record User_CSG_Information_AVP{
//Ref: ETSI TS 132 299 User_CSG_Information_AVP
    AVP_Header						aVP_Header, //<AVP header: 2319 ....>
    CSG_Id_AVP						cSG_Id,
    CSG_Access_Mode_AVP				cSG_Access_Mode,
    CSG_Membership_Indication_AVP	CSG_Membership_Indication_AVP optional
};*/
void User_CSG_Information_AVP::PreDecodeField(int field_id, Buffer& buffer) throw (DecodeError)
{
	debug_log_PreDecodeField("User_CSG_Information_AVP", field_id);

	unsigned int nNextCode = getAVPCode(buffer);

	if(field_id == id_CSG_Membership_Indication_AVP)
		SetHypFieldIsPresent(field_id, (nNextCode == AVP_CODE_CSG_Membership_Indication) ? 1 : 0);
}

///////////////////////////////////////////////////////
////////////////  ENUMERATIONS ////////////////////////
///////////////////////////////////////////////////////

/*type enumerated Result_Code_Type{
    DIAMETER_DUMMY_E (0),
    
    DIAMETER_MULTI_ROUND_AUTH_E (1001),
    
    DIAMETER_SUCCESS_E (2001),
    DIAMETER_LIMITED_SUCCESS_E (2002),
    
    DIAMETER_COMMAND_UNSUPPORTED_E (3001),
    DIAMETER_UNABLE_TO_DELIVER_E (3002),			
    DIAMETER_REALM_NOT_SERVED_E (3003),
    DIAMETER_TOO_BUSY_E (3004),
    DIAMETER_LOOP_DETECTED_E (3005),
    DIAMETER_REDIRECT_INDICATION_E (3006),
    DIAMETER_APPLICATION_UNSUPPORTED_E (3007),
    DIAMETER_INVALID_HDR_BITS_E (3008),
    DIAMETER_INVALID_AVP_BITS_E (3009),
    DIAMETER_UNKNOWN_PEER_E (3010),
    
    DIAMETER_AUTHENTICATION_REJECTED_E (4001),
    DIAMETER_OUT_OF_SPACE_E (4002),			
    DIAMETER_ELECTION_LOST_E (4003),
    
    DIAMETER_AVP_UNSUPPORTED_E (5001),
    DIAMETER_UNKNOWN_SESSION_ID_E (5002),
    DIAMETER_AUTHORIZATION_REJECTED_E (5003),
    DIAMETER_INVALID_AVP_VALUE_E (5004),
    DIAMETER_MISSING_AVP_E (5005),
    DIAMETER_RESOURCES_EXCEEDED_E (5006),
    DIAMETER_CONTRADICTING_AVPS_E (5007),
    DIAMETER_AVP_NOT_ALLOWED_E (5008),
    DIAMETER_AVP_OCCURS_TOO_MANY_TIMES_E (5009),
    DIAMETER_NO_COMMON_APPLICATION_E (5010),
    DIAMETER_UNSUPPORTED_VERSION_E (5011),
    DIAMETER_UNABLE_TO_COMPLY_E (5012),
    DIAMETER_INVALID_BIT_IN_HEADER_E (5013),
    DIAMETER_INVALID_AVP_LENGTH_E (5014),
    DIAMETER_INVALID_MESSAGE_LENGTH_E (5015),
    DIAMETER_INVALID_AVP_BIT_COMBO_E (5016),
    DIAMETER_NO_COMMON_SECURITY_E (5017)	
};*/

const char* Result_Code_Type::msKeywordEnums[] = { 
		"DIAMETER_DUMMY_E",// (0),
    
		"DIAMETER_MULTI_ROUND_AUTH_E",// (1001),
	    
		"DIAMETER_SUCCESS_E",// (2001),
		"DIAMETER_LIMITED_SUCCESS_E",// (2002),
	    
		"DIAMETER_COMMAND_UNSUPPORTED_E",// (3001),
		"DIAMETER_UNABLE_TO_DELIVER_E",// (3002),			
		"DIAMETER_REALM_NOT_SERVED_E",// (3003),
		"DIAMETER_TOO_BUSY_E",// (3004),
		"DIAMETER_LOOP_DETECTED_E",// (3005),
		"DIAMETER_REDIRECT_INDICATION_E",// (3006),
		"DIAMETER_APPLICATION_UNSUPPORTED_E",// (3007),
		"DIAMETER_INVALID_HDR_BITS_E",// (3008),
		"DIAMETER_INVALID_AVP_BITS_E",// (3009),
		"DIAMETER_UNKNOWN_PEER_E",// (3010),
	    
		"DIAMETER_AUTHENTICATION_REJECTED_E",// (4001),
		"DIAMETER_OUT_OF_SPACE_E",// (4002),			
		"DIAMETER_ELECTION_LOST_E",// (4003),
	    
		"DIAMETER_AVP_UNSUPPORTED_E",// (5001),
		"DIAMETER_UNKNOWN_SESSION_ID_E",// (5002),
		"DIAMETER_AUTHORIZATION_REJECTED_E",// (5003),
		"DIAMETER_INVALID_AVP_VALUE_E",// (5004),
		"DIAMETER_MISSING_AVP_E",// (5005),
		"DIAMETER_RESOURCES_EXCEEDED_E",// (5006),
		"DIAMETER_CONTRADICTING_AVPS_E",// (5007),
		"DIAMETER_AVP_NOT_ALLOWED_E",// (5008),
		"DIAMETER_AVP_OCCURS_TOO_MANY_TIMES_E",// (5009),
		"DIAMETER_NO_COMMON_APPLICATION_E",// (5010),
		"DIAMETER_UNSUPPORTED_VERSION_E",// (5011),
		"DIAMETER_UNABLE_TO_COMPLY_E",// (5012),
		"DIAMETER_INVALID_BIT_IN_HEADER_E",// (5013),
		"DIAMETER_INVALID_AVP_LENGTH_E",// (5014),
		"DIAMETER_INVALID_MESSAGE_LENGTH_E",// (5015),
		"DIAMETER_INVALID_AVP_BIT_COMBO_E",// (5016),
		"DIAMETER_NO_COMMON_SECURITY_E",// (5017)	
		"" };

const unsigned int Result_Code_Type::msKeywordIds[] = { 
		0, //DIAMETER_DUMMY_E (),
    
		1001, //DIAMETER_MULTI_ROUND_AUTH_E (),
	    
		2001, //DIAMETER_SUCCESS_E (),
		2002, //DIAMETER_LIMITED_SUCCESS_E (),
	    
		3001, //DIAMETER_COMMAND_UNSUPPORTED_E (),
		3002, //DIAMETER_UNABLE_TO_DELIVER_E (),			
		3003, //DIAMETER_REALM_NOT_SERVED_E (),
		3004, //DIAMETER_TOO_BUSY_E (),
		3005, //DIAMETER_LOOP_DETECTED_E (),
		3006, //DIAMETER_REDIRECT_INDICATION_E (),
		3007, //DIAMETER_APPLICATION_UNSUPPORTED_E (),
		3008, //DIAMETER_INVALID_HDR_BITS_E (),
		3009, //DIAMETER_INVALID_AVP_BITS_E (),
		3010, //DIAMETER_UNKNOWN_PEER_E (),
	    
		4001, //DIAMETER_AUTHENTICATION_REJECTED_E (),
		4002, //DIAMETER_OUT_OF_SPACE_E (),			
		4003, //DIAMETER_ELECTION_LOST_E (),
	    
		5001, //DIAMETER_AVP_UNSUPPORTED_E (),
		5002, //DIAMETER_UNKNOWN_SESSION_ID_E (),
		5003, //DIAMETER_AUTHORIZATION_REJECTED_E (),
		5004, //DIAMETER_INVALID_AVP_VALUE_E (),
		5005, //DIAMETER_MISSING_AVP_E (),
		5006, //DIAMETER_RESOURCES_EXCEEDED_E (),
		5007, //DIAMETER_CONTRADICTING_AVPS_E (),
		5008, //DIAMETER_AVP_NOT_ALLOWED_E (),
		5009, //DIAMETER_AVP_OCCURS_TOO_MANY_TIMES_E (),
		5010, //DIAMETER_NO_COMMON_APPLICATION_E (),
		5011, //DIAMETER_UNSUPPORTED_VERSION_E (),
		5012, //DIAMETER_UNABLE_TO_COMPLY_E (),
		5013, //DIAMETER_INVALID_BIT_IN_HEADER_E (),
		5014, //DIAMETER_INVALID_AVP_LENGTH_E (),
		5015, //DIAMETER_INVALID_MESSAGE_LENGTH_E (),
		5016, //DIAMETER_INVALID_AVP_BIT_COMBO_E (),
		5017//DIAMETER_NO_COMMON_SECURITY_E	
		};

/*type enumerated Re_Auth_Req_Type{
	//Ref: RFC3588 8.12.  Re-Auth-Request-Type AVP
	AUTHORIZE_ONLY_E (0),
	AUTHORIZE_AUTHENTICATE_E (1)                 
};*/
const char* Re_Auth_Req_Type::msKeywordEnums[] = { 
		"AUTHORIZE_ONLY_E",// (0),
    	"AUTHORIZE_AUTHENTICATE_E",// (1)    
		"" };
const int Re_Auth_Req_Type::msKeywordIds[] = { 
		0,//AUTHORIZE_ONLY_E (),
    	1//AUTHORIZE_AUTHENTICATE_E ()    
		};

/*type enumerated Redirect_Host_Usage_Type{
	DONT_CACHE_E (0),
	ALL_SESSION_E (1),
	ALL_REALM_E (2),
	REALM_AND_APPLICATION_E (3),
	ALL_APPLICATION_E (4),
	ALL_HOST_E (5),
	ALL_USER_E  (6)
};*/
const char* Redirect_Host_Usage_Type::msKeywordEnums[] = { 
		"DONT_CACHE_E",// (0),
		"ALL_SESSION_E",// (1),
		"ALL_REALM_E",// (2),
		"REALM_AND_APPLICATION_E",// (3),
		"ALL_APPLICATION_E",// (4),
		"ALL_HOST_E",// (5),
		"ALL_USER_E",//  (6)
		"" };
const int Redirect_Host_Usage_Type::msKeywordIds[] = { 
		0,//DONT_CACHE_E (),
		1,//ALL_SESSION_E (),
		2,//ALL_REALM_E (),
		3,//REALM_AND_APPLICATION_E (),
		4,//ALL_APPLICATION_E (),
		5,//ALL_HOST_E (),
		6//ALL_USER_E  ()
		};

/*type enumerated Acc_Record_Type{
	EVENT_RECORD_E (1),                   
	START_RECORD_E  (2),                  
	INTERIM_RECORD_E (3),               
	STOP_RECORD_E    (4)                 
};*/
const char* Acc_Record_Type::msKeywordEnums[] = { 
		"EVENT_RECORD_E",// (1),                   
		"START_RECORD_E",//  (2),                  
		"INTERIM_RECORD_E",// (3),               
		"STOP_RECORD_E",//    (4) 
		"" };
const int Acc_Record_Type::msKeywordIds[] = { 
		1,//EVENT_RECORD_E (),                   
		2,//START_RECORD_E  (),                  
		3,//INTERIM_RECORD_E (),               
		4//STOP_RECORD_E    () 
		};

/*type enumerated Acc_Realtime_Req_Type{
	DELIVER_AND_GRANT_E (1),
	GRANT_AND_STORE_E (2),
	GRANT_AND_LOSE_E (3)
};*/
const char* Acc_Realtime_Req_Type::msKeywordEnums[] = { 
		"DELIVER_AND_GRANT_E",// (1),
		"GRANT_AND_STORE_E",// (2),
		"GRANT_AND_LOSE_E",// (3)
		"" };
const int Acc_Realtime_Req_Type::msKeywordIds[] = { 
		1,//DELIVER_AND_GRANT_E (),
		2,//GRANT_AND_STORE_E (),
		3//GRANT_AND_LOSE_E ()
		};

/*type enumerated Termination_Cause_Type{
	DIAMETER_LOGOUT_E (1),
	DIAMETER_SERVICE_NOT_PROVIDED_E (2),
	DIAMETER_BAD_ANSWER_E (3),
	DIAMETER_ADMINISTRATIVE_E (4),
	DIAMETER_LINK_BROKEN_E (5),
	DIAMETER_AUTH_EXPIRED_E (6),
	DIAMETER_USER_MOVED_E (7),
	DIAMETER_SESSION_TIMEOUT_E (8)
};*/
const char* Termination_Cause_Type::msKeywordEnums[] = { 
		"DIAMETER_LOGOUT_E",// (1),
		"DIAMETER_SERVICE_NOT_PROVIDED_E",// (2),
		"DIAMETER_BAD_ANSWER_E",// (3),
		"DIAMETER_ADMINISTRATIVE_E",// (4),
		"DIAMETER_LINK_BROKEN_E",// (5),
		"DIAMETER_AUTH_EXPIRED_E",// (6),
		"DIAMETER_USER_MOVED_E",// (7),
		"DIAMETER_SESSION_TIMEOUT_E",// (8)
		"" };
const int Termination_Cause_Type::msKeywordIds[] = { 
		1,//DIAMETER_LOGOUT_E (),
		2,//DIAMETER_SERVICE_NOT_PROVIDED_E (),
		3,//DIAMETER_BAD_ANSWER_E (),
		4,//DIAMETER_ADMINISTRATIVE_E (),
		5,//DIAMETER_LINK_BROKEN_E (),
		6,//DIAMETER_AUTH_EXPIRED_E (),
		7,//DIAMETER_USER_MOVED_E (),
		8//DIAMETER_SESSION_TIMEOUT_E ()
		};

/*type enumerated Disconnect_Cause_Type{
	REBOOTING_E (0),
	BUSY_E (1),
	DO_NOT_WANT_TO_TALK_TO_YOU_E (2)
};*/
const char* Disconnect_Cause_Type::msKeywordEnums[] = { 
		"REBOOTING_E",// (0),
    	"BUSY_E",// (1),
    	"DO_NOT_WANT_TO_TALK_TO_YOU_E",// (2)
		"" };
const int Disconnect_Cause_Type::msKeywordIds[] = { 
		0,//REBOOTING_E (),
		1,//BUSY_E (),
		2//DO_NOT_WANT_TO_TALK_TO_YOU_E ()
		};


/*type enumerated Auth_Session_State_Type{
	STATE_MAINTAINED_E (0),
	NO_STATE_MAINTAINED_E (1)
};*/
const char* Auth_Session_State_Type::msKeywordEnums[] = { 
		"STATE_MAINTAINED_E",// (0),
    	"NO_STATE_MAINTAINED_E",// (1)
		"" };
const int Auth_Session_State_Type::msKeywordIds[] = { 
		0,//STATE_MAINTAINED_E (),
    	1//NO_STATE_MAINTAINED_E ()
		};

/*type enumerated SIP_User_Auth_Ty_Type{
	//Ref: RFC4740, section 9.10
	REGISTRATION_E (0),
	DEREGISTRATION_E (1),
	REGISTRATION_AND_CAPABILITIES_E (2)
};*/

const char* SIP_User_Auth_Ty_Type::msKeywordEnums[] = { 
		"REGISTRATION_E",// (0),
		"DEREGISTRATION_E",// (1),
		"REGISTRATION_AND_CAPABILITIES_E",// (2)
		"" };
const int SIP_User_Auth_Ty_Type::msKeywordIds[] = { 
		0,//REGISTRATION_E (),
		1,//DEREGISTRATION_E (),
		2//REGISTRATION_AND_CAPABILITIES_E ()
		};

///////////////////////
/*type enumerated SIP_Srv_Assgmt_Type{
	NO_ASSIGNMENT_E (0),
	REGISTRATION_E (1),  
	RE_REGISTRATION_E (2), 
	UNREGISTERED_USER_E (3),
	TIMEOUT_DEREGISTRATION_E (4),
	USER_DEREGISTRATION_E (5),
	TIMEOUT_DEREGISTRATION_STORE_SERVER_NAME_E (6),
	USER_DEREGISTRATION_STORE_SERVER_NAME_E (7),
	ADMINISTRATIVE_DEREGISTRATION_E (8),
	AUTHENTICATION_FAILURE_E (9),
	AUTHENTICATION_TIMEOUT_E (10),
	DEREGISTRATION_TOO_MUCH_DATA_E (11)	
};*/
const char* SIP_Srv_Assgmt_Type::msKeywordEnums[] = { 
	"NO_ASSIGNMENT_E",// (0),
	"REGISTRATION_E",// (1),  
	"RE_REGISTRATION_E",// (2), 
	"UNREGISTERED_USER_E",// (3),
	"TIMEOUT_DEREGISTRATION_E",// (4),
	"USER_DEREGISTRATION_E",// (5),
	"TIMEOUT_DEREGISTRATION_STORE_SERVER_NAME_E",// (6),
	"USER_DEREGISTRATION_STORE_SERVER_NAME_E",// (7),
	"ADMINISTRATIVE_DEREGISTRATION_E",// (8),
	"AUTHENTICATION_FAILURE_E",// (9),
	"AUTHENTICATION_TIMEOUT_E",// (10),
	"DEREGISTRATION_TOO_MUCH_DATA_E",// (11)	
		"" };
const int SIP_Srv_Assgmt_Type::msKeywordIds[] = { 
		0,//NO_ASSIGNMENT_E (),
		1,//REGISTRATION_E (),  
		2,//RE_REGISTRATION_E (), 
		3,//UNREGISTERED_USER_E (),
		4,//TIMEOUT_DEREGISTRATION_E (),
		5,//USER_DEREGISTRATION_E (),
		6,//TIMEOUT_DEREGISTRATION_STORE_SERVER_NAME_E (),
		7,//USER_DEREGISTRATION_STORE_SERVER_NAME_E (),
		8,//ADMINISTRATIVE_DEREGISTRATION_E (),
		9,//AUTHENTICATION_FAILURE_E (),
		10,//AUTHENTICATION_TIMEOUT_E (),
		11//DEREGISTRATION_TOO_MUCH_DATA_E ()	
		};


/*type enumerated SIP_Usr_Dat_Al_Av_Type{
	USER_DATA_NOT_AVAILABLE_E (0),
	USER_DATA_ALREADY_AVAILABLE_E (1)
};*/
const char* SIP_Usr_Dat_Al_Av_Type::msKeywordEnums[] = { 
		"USER_DATA_NOT_AVAILABLE_E",// (0),
		"USER_DATA_ALREADY_AVAILABLE_E",// (1)
		"" };
const int SIP_Usr_Dat_Al_Av_Type::msKeywordIds[] = { 
		0,//USER_DATA_NOT_AVAILABLE_E (),
		1//USER_DATA_ALREADY_AVAILABLE_E ()
		};

/*type enumerated SIP_Auth_Schm_Type{
	DIGEST_E (0)
};*/
const char* SIP_Auth_Schm_Type::msKeywordEnums[] = { 
		"DIGEST_E",// (0)
		"" };
const int SIP_Auth_Schm_Type::msKeywordIds[] = { 
		0//DIGEST_E ()
		};

/*type enumerated SIP_Reason_Code_Type{			
  	PERMANENT_TERMINATION_E (0),
	NEW_SIP_SERVER_ASSIGNED_E (1),
	SIP_SERVER_CHANGE_E (2),
	REMOVE_SIP_SERVER_E (3)
};*/
const char* SIP_Reason_Code_Type::msKeywordEnums[] = { 
		"PERMANENT_TERMINATION_E",// (0),
		"NEW_SIP_SERVER_ASSIGNED_E",// (1),
		"SIP_SERVER_CHANGE_E",// (2),
		"REMOVE_SIP_SERVER_E",// (3)
		"" };
const int SIP_Reason_Code_Type::msKeywordIds[] = { 
		0,//PERMANENT_TERMINATION_E (),
		1,//NEW_SIP_SERVER_ASSIGNED_E (),
		2,//SIP_SERVER_CHANGE_E (),
		3//REMOVE_SIP_SERVER_E ()
		};




/*type enumerated Data_Reference_Type{
	REPOSITORY_DATA_E (0),
	IMS_PUBLIC_IDENTITY_E (10),
	IMS_USER_STATE_E (11),
	S_CSCF_NAME_E (12),
	INITIAL_FILTER_CRITERIA_E (13),
	LOCATION_INFORMATION_E (14),
	USER_STATE_E (15),
	CHARGING_INFORMATION_E (16),
	MSISDN_E (17),
	PSI_ACTIVATION_E (18),
	DSAI_E (19),
	SERVICE_TRACE_LEVEL_INFO_E (21)						
};*/
const char* Data_Reference_Type::msKeywordEnums[] = { 
		"REPOSITORY_DATA_E",// (0),
		"IMS_PUBLIC_IDENTITY_E",// (10),
		"IMS_USER_STATE_E",// (11),
		"S_CSCF_NAME_E",// (12),
		"INITIAL_FILTER_CRITERIA_E",// (13),
		"LOCATION_INFORMATION_E",// (14),
		"USER_STATE_E",// (15),
		"CHARGING_INFORMATION_E",// (16),
		"MSISDN_E",// (17),
		"PSI_ACTIVATION_E",// (18),
		"DSAI_E",// (19),
		"SERVICE_TRACE_LEVEL_INFO_E",// (21)	
		"" };
const int Data_Reference_Type::msKeywordIds[] = { 
		0,//REPOSITORY_DATA_E (),
		10,//IMS_PUBLIC_IDENTITY_E (),
		11,//IMS_USER_STATE_E (),
		12,//S_CSCF_NAME_E (),
		13,//INITIAL_FILTER_CRITERIA_E (),
		14,//LOCATION_INFORMATION_E (),
		15,//USER_STATE_E (),
		16,//CHARGING_INFORMATION_E (),
		17,//MSISDN_E (),
		18,//PSI_ACTIVATION_E (),
		19,//DSAI_E (),
		21//SERVICE_TRACE_LEVEL_INFO_E ()	
		};


/*type enumerated Subs_Req_Ty_Type{
	SUBSCRIBE_E (0),
	UNSUBSCRIBE_E (1)
};*/
const char* Subs_Req_Ty_Type::msKeywordEnums[] = { 
		"SUBSCRIBE_E",// (0),
		"UNSUBSCRIBE_E",// (1)
		"" };
const int Subs_Req_Ty_Type::msKeywordIds[] = { 
		0,//SUBSCRIBE_E (),
		1//UNSUBSCRIBE_E ()
		};



/*type enumerated Request_Domain_Type{
	CS_DOMAIN_E (0),
	PS_DOMAIN_E (1)			
};*/
const char* Request_Domain_Type::msKeywordEnums[] = { 
		"CS_DOMAIN_E",// (0),
		"PS_DOMAIN_E",// (1)			
		"" };
const int Request_Domain_Type::msKeywordIds[] = { 
		0,//CS_DOMAIN_E (),
		1//PS_DOMAIN_E ()			
		};


/*type enumerated Current_Location_Type{
	DO_NOT_NEED_INITIATE_ACTIVATE_LOCATION_RETRIEVAL_E (0),
    INITIATE_ACTIVATE_LOCATION_RETRIEVAL_E (1)			
};*/
const char* Current_Location_Type::msKeywordEnums[] = { 
		"DO_NOT_NEED_INITIATE_ACTIVATE_LOCATION_RETRIEVAL_E",// (0),
		"INITIATE_ACTIVATE_LOCATION_RETRIEVAL_E",// (1)			
		"" };
const int Current_Location_Type::msKeywordIds[] = { 
		0,//DO_NOT_NEED_INITIATE_ACTIVATE_LOCATION_RETRIEVAL_E (),
		1//INITIATE_ACTIVATE_LOCATION_RETRIEVAL_E ()			
		};


/*type enumerated Identity_Set_Type{
	ALL_IDENTITIES_E (0),
	REGISTERED_IDENTITIES_E (1),
	IMPLICIT_IDENTITIES_E (2),
	ALIAS_IDENTITIES_E (3)			
};	*/
const char* Identity_Set_Type::msKeywordEnums[] = { 
		"ALL_IDENTITIES_E",// (0),
		"REGISTERED_IDENTITIES_E",// (1),
		"IMPLICIT_IDENTITIES_E",// (2),
		"ALIAS_IDENTITIES_E",// (3)			
		"" };
const int Identity_Set_Type::msKeywordIds[] = { 
		0,//ALL_IDENTITIES_E (),
		1,//REGISTERED_IDENTITIES_E (),
		2,//IMPLICIT_IDENTITIES_E (),
		3//ALIAS_IDENTITIES_E ()			
		};



/*type enumerated Send_Data_Indication_Type{
	USER_DATA_NOT_REQUESTED_E (0),
	USER_DATA_REQUESTED_E (1)
};*/
const char* Send_Data_Indication_Type::msKeywordEnums[] = { 
	"USER_DATA_NOT_REQUESTED_E",// (0),
	"USER_DATA_REQUESTED_E",// (1)
		"" };
const int Send_Data_Indication_Type::msKeywordIds[] = { 
		0,//USER_DATA_NOT_REQUESTED_E (),
		1//USER_DATA_REQUESTED_E ()
		};


/*type enumerated Experimental_Result_Type{
	DIAMETER_FIRST_REGISTRATION_E (2001),
	DIAMETER_SUBSEQUENT_REGISTRATION_E (2002),
	DIAMETER_UNREGISTERED_SERVICE_E (2003),
	DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED_E (2004),			
	DIAMETER_ERROR_USER_UNKNOWN_E (5001),
	DIAMETER_ERROR_IDENTITIES_DONT_MATCH_E (5002),
	DIAMETER_ERROR_IDENTITY_NOT_REGISTERED_E (5003),
	DIAMETER_ERROR_ROAMING_NOT_ALLOWED_E (5004),
	DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED_E (5005),
	DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED_E (5006),
	DIAMETER_ERROR_IN_ASSIGNMENT_TYPE_E (5007),
	DIAMETER_ERROR_TOO_MUCH_DATA_E (5008),
	DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA_E (5009),
    // Ref: ETSI TS 129 214 5.5
    INVALID_SERVICE_INFORMATION_E (5061),
    FILTER_RESTRICTIONS_E (5062),
    REQUESTED_SERVICE_NOT_AUTHORIZED_E (5063),
    DUPLICATED_AF_SESSION_E (5064),
    IP_CAN_SESSION_NOT_AVAILABLE_E (5065),
    UNAUTHORIZED_NON_EMERGENCY_SESSION_E (5066),
    UNAUTHORIZED_SPONSORED_DATA_CONNECTIVITY_E (5067),
    DIAMETER_ERROR_INITIAL_PARAMETERS_E (5140),
    DIAMETER_ERROR_TRIGGER_EVENT_E (5141),
    DIAMETER_PCC_RULE_EVENT_E (5142),
    DIAMETER_ERROR_BEARER_NOT_AUTHORIZED_E (5143),
    DIAMETER_ERROR_TRAFFIC_MAPPING_INFO_REJECTED_E (5144),
    DIAMETER_ERROR_CONFLICTING_REQUEST_E (5147)			
}; */
const char* Experimental_Result_Type::msKeywordEnums[] = {
		"DIAMETER_FIRST_REGISTRATION_E",// (2001),
		"DIAMETER_SUBSEQUENT_REGISTRATION_E",// (2002),
		"DIAMETER_UNREGISTERED_SERVICE_E",// (2003),
		"DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED_E",// (2004),			
		"DIAMETER_ERROR_USER_UNKNOWN_E",// (5001),
		"DIAMETER_ERROR_IDENTITIES_DONT_MATCH_E",// (5002),
		"DIAMETER_ERROR_IDENTITY_NOT_REGISTERED_E",// (5003),
		"DIAMETER_ERROR_ROAMING_NOT_ALLOWED_E",// (5004),
		"DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED_E",// (5005),
		"DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED_E",// (5006),
		"DIAMETER_ERROR_IN_ASSIGNMENT_TYPE_E",// (5007),
		"DIAMETER_ERROR_TOO_MUCH_DATA_E",// (5008),
		"DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA_E",// (5009),
		// Ref: ETSI TS 129 214 5.5
		"INVALID_SERVICE_INFORMATION_E",// (5061),
		"FILTER_RESTRICTIONS_E",// (5062),
		"REQUESTED_SERVICE_NOT_AUTHORIZED_E",// (5063),
		"DUPLICATED_AF_SESSION_E",// (5064),
		"IP_CAN_SESSION_NOT_AVAILABLE_E",// (5065),
		"UNAUTHORIZED_NON_EMERGENCY_SESSION_E",// (5066),
		"UNAUTHORIZED_SPONSORED_DATA_CONNECTIVITY_E",// (5067),
		"DIAMETER_ERROR_INITIAL_PARAMETERS_E",// (5140),
		"DIAMETER_ERROR_TRIGGER_EVENT_E",// (5141),
		"DIAMETER_PCC_RULE_EVENT_E",// (5142),
		"DIAMETER_ERROR_BEARER_NOT_AUTHORIZED_E",// (5143),
		"DIAMETER_ERROR_TRAFFIC_MAPPING_INFO_REJECTED_E",// (5144),
		"DIAMETER_ERROR_CONFLICTING_REQUEST_E",// (5147)		
		"" };
const unsigned int Experimental_Result_Type::msKeywordIds[] = { 
		2001,//DIAMETER_FIRST_REGISTRATION_E (),
		2002,//DIAMETER_SUBSEQUENT_REGISTRATION_E (),
		2003,//DIAMETER_UNREGISTERED_SERVICE_E (),
		2004,//DIAMETER_SUCCESS_SERVER_NAME_NOT_STORED_E (),			
		5001,//DIAMETER_ERROR_USER_UNKNOWN_E (),
		5002,//DIAMETER_ERROR_IDENTITIES_DONT_MATCH_E (),
		5003,//DIAMETER_ERROR_IDENTITY_NOT_REGISTERED_E (),
		5004,//DIAMETER_ERROR_ROAMING_NOT_ALLOWED_E (),
		5005,//DIAMETER_ERROR_IDENTITY_ALREADY_REGISTERED_E (),
		5006,//DIAMETER_ERROR_AUTH_SCHEME_NOT_SUPPORTED_E (),
		5007,//DIAMETER_ERROR_IN_ASSIGNMENT_TYPE_E (),
		5008,//DIAMETER_ERROR_TOO_MUCH_DATA_E (),
		5009,//DIAMETER_ERROR_NOT_SUPPORTED_USER_DATA_E (),
		// Ref: ETSI TS 129 214 5.5
		5061,//INVALID_SERVICE_INFORMATION_E (),
		5062,//FILTER_RESTRICTIONS_E (),
		5063,//REQUESTED_SERVICE_NOT_AUTHORIZED_E (),
		5064,//DUPLICATED_AF_SESSION_E (),
		5065,//IP_CAN_SESSION_NOT_AVAILABLE_E (),
		5066,//UNAUTHORIZED_NON_EMERGENCY_SESSION_E (),
		5067,//UNAUTHORIZED_SPONSORED_DATA_CONNECTIVITY_E (),
		5140,//DIAMETER_ERROR_INITIAL_PARAMETERS_E (),
		5141,//DIAMETER_ERROR_TRIGGER_EVENT_E (),
		5142,//DIAMETER_PCC_RULE_EVENT_E (),
		5143,//DIAMETER_ERROR_BEARER_NOT_AUTHORIZED_E (),
		5144,//DIAMETER_ERROR_TRAFFIC_MAPPING_INFO_REJECTED_E (),
		5147//DIAMETER_ERROR_CONFLICTING_REQUEST_E ()		
		 };



/*type enumerated CC_Request_Ty_Type{
// Ref: RFC4006 8.3.  CC-Request-Type AVP
	INITIAL_REQUEST_E (1),
	UPDATE_REQUEST_E (2),
	TERMINATION_REQUEST_E (3),
	EVENT_REQUEST_E  (4)
};*/
const char* CC_Request_Ty_Type::msKeywordEnums[] = { 
		"INITIAL_REQUEST_E",// (1),
    	"UPDATE_REQUEST_E",// (2),
     	"TERMINATION_REQUEST_E",// (3),
    	"EVENT_REQUEST_E",//  (4)
		"" };
const int CC_Request_Ty_Type::msKeywordIds[] = { 
		1,//INITIAL_REQUEST_E (),
    	2,//UPDATE_REQUEST_E (),
     	3,//TERMINATION_REQUEST_E (),
    	4,//EVENT_REQUEST_E  ()
		};


/*type enumerated Subscription_Id_Ty_Type{
	// Ref: RFC4006 8.47.  Subscription-Id-Type AVP
	END_USER_E164_E (0),
	END_USER_IMSI_E (1),
	END_USER_SIP_URI_E (2),
	END_USER_NAI_E  (3),
	END_USER_PRIVATE_E (4)
};*/
const char* Subscription_Id_Ty_Type::msKeywordEnums[] = { 
		"END_USER_E164_E",// (0),
		"END_USER_IMSI_E",// (1),
		"END_USER_SIP_URI_E",// (2),
		"END_USER_NAI_E",//  (3),
		"END_USER_PRIVATE_E",// (4)
		"" };
const int Subscription_Id_Ty_Type::msKeywordIds[] = { 
		0,//END_USER_E164_E (),
    	1,//END_USER_IMSI_E (),
    	2,//END_USER_SIP_URI_E (),
    	3,//END_USER_NAI_E  (),
    	4,//END_USER_PRIVATE_E ()
		};


/*type enumerated Requested_Action_Type{
	// Ref: RFC4006 8.41.  Requested-Action AVP
	DIRECT_DEBITING_E (0),
	REFUND_ACCOUNT_E (1),
	CHECK_BALANCE_E (2),
	PRICE_ENQUIRY_E (3)
};*/
const char* Requested_Action_Type::msKeywordEnums[] = { 
		"DIRECT_DEBITING_E",// (0),
		"REFUND_ACCOUNT_E",// (1),
		"CHECK_BALANCE_E",// (2),
		"PRICE_ENQUIRY_E",// (3)
		"" };
const int Requested_Action_Type::msKeywordIds[] = { 
		0,//DIRECT_DEBITING_E (),
    	1,//REFUND_ACCOUNT_E (),
    	2,//CHECK_BALANCE_E (),
    	3,//PRICE_ENQUIRY_E ()
		};


/*type enumerated Tariff_Change_Usage_Type{
	// Ref: RFC4006 8.27.  Tariff-Change-Usage AVP
	UNIT_BEFORE_TARIFF_CHANGE_E (0),
	UNIT_AFTER_TARIFF_CHANGE_E (1),
  	UNIT_INDETERMINATE_E (2)
};*/
const char* Tariff_Change_Usage_Type::msKeywordEnums[] = { 
		"UNIT_BEFORE_TARIFF_CHANGE_E",// (0),
		"UNIT_AFTER_TARIFF_CHANGE_E",// (1),
 	  	"UNIT_INDETERMINATE_E",// (2)
		"" };
const int Tariff_Change_Usage_Type::msKeywordIds[] = { 
		0,//UNIT_BEFORE_TARIFF_CHANGE_E (),
    	1,//UNIT_AFTER_TARIFF_CHANGE_E (),
    	2,//UNIT_INDETERMINATE_E ()
		};


/*type enumerated Multiple_Serv_Indi_Type{
	// Ref: RFC4006 8.40.  Multiple-Services-Indicator AVP
	MULTIPLE_SERVICES_NOT_SUPPORTED_E (0),
	MULTIPLE_SERVICES_SUPPORTED_E     (1)		
};*/
const char* Multiple_Serv_Indi_Type::msKeywordEnums[] = { 
		"MULTIPLE_SERVICES_NOT_SUPPORTED_E",// (0),
      	"MULTIPLE_SERVICES_SUPPORTED_E",//     (1)	
		"" };
const int Multiple_Serv_Indi_Type::msKeywordIds[] = { 
		0,//MULTIPLE_SERVICES_NOT_SUPPORTED_E (),
      	1,//MULTIPLE_SERVICES_SUPPORTED_E     ()	
		};


/*type enumerated CC_Unit_Ty_Type {
	// Ref: RFC4006 8.31.  G-S-U-Pool-Identifier AVP
	TIME_E (0),
	MONEY_E (1),
	TOTAL_OCTETS_E (2),
	INPUT_OCTETS_E (3),
	OUTPUT_OCTETS_E (4),
	SERVICE_SPECIFIC_UNITS_E (5)		
};*/
const char* CC_Unit_Ty_Type::msKeywordEnums[] = { 
		"TIME_E",// (0),
		"MONEY_E",// (1),
		"TOTAL_OCTETS_E",// (2),
		"INPUT_OCTETS_E",// (3),
		"OUTPUT_OCTETS_E",// (4),
		"SERVICE_SPECIFIC_UNITS_E",// (5)
		"" };
const int CC_Unit_Ty_Type::msKeywordIds[] = { 
		0,//TIME_E (),
        1,//MONEY_E (),
        2,//TOTAL_OCTETS_E (),
        3,//INPUT_OCTETS_E (),
        4,//OUTPUT_OCTETS_E (),
        5,//SERVICE_SPECIFIC_UNITS_E ()
		};


/*type enumerated Final_Unit_Action_Type{
	// Ref: RFC4006 8.35.  Final-Unit-Action AVP
	TERMINATE_E (0),
	REDIRECT_E (1),
	RESTRICT_ACCESS_E (2)				
};*/
const char* Final_Unit_Action_Type::msKeywordEnums[] = { 
		"TERMINATE_E",// (0),
		"REDIRECT_E",// (1),
		"RESTRICT_ACCESS_E",// (2)	
		"" };
const int Final_Unit_Action_Type::msKeywordIds[] = { 
		0,//TERMINATE_E (),
    	1,//REDIRECT_E (),
    	2,//RESTRICT_ACCESS_E ()	
		};


/*type enumerated Redirect_Address_Ty_Type{
	// Ref: RFC4006 8.38.  Redirect-Address-Type AVP
	IPV4_ADDRESS_E (0),
	IPV6_ADDRESS_E (1),
	URL_E (2),
	SIP_URI_E (3)
};*/
const char* Redirect_Address_Ty_Type::msKeywordEnums[] = { 
		"IPV4_ADDRESS_E",// (0),
		"IPV6_ADDRESS_E",// (1),
		"URL_E",// (2),
		"SIP_URI_E",// (3)
		"" };
const int Redirect_Address_Ty_Type::msKeywordIds[] = { 
		0,//IPV4_ADDRESS_E (),
    	1,//IPV6_ADDRESS_E (),
     	2,//URL_E (),
    	3,//SIP_URI_E ()
		};


/*type enumerated User_Equipment_Info_Ty_Type	{
	// Ref: RFC4006 8.50.  User-Equipment-Info-Type AVP
	IMEISV_E (0),
	MAC_E (1),
	EUI64_E (2),
	MODIFIED_EUI64_E (3)
};*/
const char* User_Equipment_Info_Ty_Type::msKeywordEnums[] = {
		"IMEISV_E",// (0),
    	"MAC_E",// (1),
    	"EUI64_E",// (2),
    	"MODIFIED_EUI64_E",// (3)
		"" };
const int User_Equipment_Info_Ty_Type::msKeywordIds[] = { 
		0,//IMEISV_E (),
		1,//MAC_E (),
		2,//EUI64_E (),
		3,//MODIFIED_EUI64_E ()
		};


/*type enumerated CC_Session_Failover_Type{
	// Ref: RFC4006 8.4.  CC-Session-Failover AVP
	FAILOVER_NOT_SUPPORTED_E (0),
	FAILOVER_SUPPORTED_E  (1)
};*/
const char* CC_Session_Failover_Type::msKeywordEnums[] = { 
		"FAILOVER_NOT_SUPPORTED_E",// (0),
		"FAILOVER_SUPPORTED_E",//  (1)
		"" };
const int CC_Session_Failover_Type::msKeywordIds[] = { 
		0,//FAILOVER_NOT_SUPPORTED_E (),
    	1,//FAILOVER_SUPPORTED_E  ()
		};


/*type enumerated Check_Balance_Result_Type{
	// Ref: RFC4006	8.6.  Check-Balance-Result AVP
	ENOUGH_CREDIT_E (0),
	NO_CREDIT_E (1)
};	*/
const char* Check_Balance_Result_Type::msKeywordEnums[] = { 
		"ENOUGH_CREDIT_E",// (0),
    	"NO_CREDIT_E",// (1)
		"" };
const int Check_Balance_Result_Type::msKeywordIds[] = { 
		0,//ENOUGH_CREDIT_E (),
    	1,//NO_CREDIT_E ()
		};


/*type enumerated Credit_Cont_Fail_Hand_Type{
	// Ref: RFC4006 8.14.  Credit-Control-Failure-Handling AVP
	TERMINATE_E (0),
	CONTINUE_E  (1),
	RETRY_AND_TERMINATE_E (2)				
};*/
const char* Credit_Cont_Fail_Hand_Type::msKeywordEnums[] = { 
		"TERMINATE_E",// (0),
    	"CONTINUE_E",//  (1),
    	"RETRY_AND_TERMINATE_E",// (2)		
		"" };
const int Credit_Cont_Fail_Hand_Type::msKeywordIds[] = { 
		0,//TERMINATE_E (),
		1,//CONTINUE_E  (),
		2,//RETRY_AND_TERMINATE_E ()		
		};


/*type enumerated Direct_Debi_Fail_Hand_Type{
	// Ref: RFC4006 8.15.  Direct-Debiting-Failure-Handling AVP
	TERMINATE_OR_BUFFER_E (0),
	CONTINUE_E (1)
};*/
const char* Direct_Debi_Fail_Hand_Type::msKeywordEnums[] = { 
		"TERMINATE_OR_BUFFER_E",// (0),
    	"CONTINUE_E",// (1)
		"" };
const int Direct_Debi_Fail_Hand_Type::msKeywordIds[] = { 
		0,//TERMINATE_OR_BUFFER_E (),
    	1,//CONTINUE_E ()
		};




/*type enumerated Abort_Cause_Type{
    // Ref: ETSI TS 129 214 5.3.1
    BEARER_RELEASED_E (0),
    INSUFFICIENT_SERVER_RESOURCES_E (1),
    INSUFFICIENT_BEARER_RESOURCES_E (2),
    PS_TO_CS_HANDOVER_E (3),
    SPONSORED_DATA_CONNECTIVITY_DISALLOWED_E (4)
};*/
const char* Abort_Cause_Type::msKeywordEnums[] = { 
		"BEARER_RELEASED_E",// (0),
        "INSUFFICIENT_SERVER_RESOURCES_E",// (1),
        "INSUFFICIENT_BEARER_RESOURCES_E",// (2),
        "PS_TO_CS_HANDOVER_E",// (3),
        "SPONSORED_DATA_CONNECTIVITY_DISALLOWED_E",// (4)
		"" };
const int Abort_Cause_Type::msKeywordIds[] = { 
		0,//BEARER_RELEASED_E (),
        1,//INSUFFICIENT_SERVER_RESOURCES_E (),
        2,//INSUFFICIENT_BEARER_RESOURCES_E (),
        3,//PS_TO_CS_HANDOVER_E (),
        4,//SPONSORED_DATA_CONNECTIVITY_DISALLOWED_E ()
		};


/*type enumerated Flow_Status_Type{
    // Ref: ETSI TS 129 214 5.3.11
    ENABLED_UPLINK_E (0),
    ENABLED_DOWNLINK_E (1),
    ENABLED_E (2),
    DISABLED_E (3),
    REMOVED_E (4)
};*/
const char* Flow_Status_Type::msKeywordEnums[] = { 
		"ENABLED_UPLINK_E",// (0),
        "ENABLED_DOWNLINK_E",// (1),
        "ENABLED_E",// (2),
        "DISABLED_E",// (3),
        "REMOVED_E",// (4)
		"" };
const int Flow_Status_Type::msKeywordIds[] = { 
		0,//ENABLED_UPLINK_E (),
        1,//ENABLED_DOWNLINK_E (),
        2,//ENABLED_E (),
        3,//DISABLED_E (),
        4,//REMOVED_E ()
		};


/*type enumerated Flow_Usage_Type{
    // Ref: ETSI TS 129 214 5.3.12
    NO_INFORMATION_E (0),
    RTCP_E (1),
    AF_SIGNALLING_E (2)
};*/
const char* Flow_Usage_Type::msKeywordEnums[] = { 
		"NO_INFORMATION_E",// (0),
        "RTCP_E",// (1),
        "AF_SIGNALLING_E",// (2)
		"" };
const int Flow_Usage_Type::msKeywordIds[] = { 
		0,//NO_INFORMATION_E (),
        1,//RTCP_E (),
        2,//AF_SIGNALLING_E ()
		};

/*type enumerated Specific_Action_Type{
    // Ref: ETSI TS 129 214 5.3.13
    VOID_0_E (0),
    CHARGING_CORRELATION_EXCHANGE_E (1),
    INDICATION_OF_LOSS_OF_BEARER_E (2),
    INDICATION_OF_RECOVERY_OF_BEARER_E (3),
    INDICATION_OF_RELEASE_OF_BEARER_E (4),
    VOID_5_E (5),
    IP_CAN_CHANGE_E (6),
    INDICATION_OF_OUT_OF_CREDIT_E (7),
    INDICATION_OF_SUCCESSFUL_RESOURCES_ALLOCATION_E (8),
    INDICATION_OF_FAILED_RESOURCES_ALLOCATION_E (9),
    INDICATION_OF_LIMITED_PCC_DEPLOYMENT_E (10),
    USAGE_REPORT_E (11)
}; */
const char* Specific_Action_Type::msKeywordEnums[] = { 
		"VOID_0_E",// (0),
        "CHARGING_CORRELATION_EXCHANGE_E",// (1),
        "INDICATION_OF_LOSS_OF_BEARER_E",// (2),
        "INDICATION_OF_RECOVERY_OF_BEARER_E",// (3),
        "INDICATION_OF_RELEASE_OF_BEARER_E",// (4),
        "VOID_5_E",// (5),
        "IP_CAN_CHANGE_E",// (6),
        "INDICATION_OF_OUT_OF_CREDIT_E",// (7),
        "INDICATION_OF_SUCCESSFUL_RESOURCES_ALLOCATION_E",// (8),
        "INDICATION_OF_FAILED_RESOURCES_ALLOCATION_E",// (9),
        "INDICATION_OF_LIMITED_PCC_DEPLOYMENT_E",// (10),
        "USAGE_REPORT_E",// (11)
		"" };
const int Specific_Action_Type::msKeywordIds[] = { 
		0,//VOID_0_E (),
        1,//CHARGING_CORRELATION_EXCHANGE_E (),
        2,//INDICATION_OF_LOSS_OF_BEARER_E (),
        3,//INDICATION_OF_RECOVERY_OF_BEARER_E (),
        4,//INDICATION_OF_RELEASE_OF_BEARER_E (),
        5,//VOID_5_E (),
        6,//IP_CAN_CHANGE_E (),
        7,//INDICATION_OF_OUT_OF_CREDIT_E (),
        8,//INDICATION_OF_SUCCESSFUL_RESOURCES_ALLOCATION_E (),
        9,//INDICATION_OF_FAILED_RESOURCES_ALLOCATION_E (),
        10,//INDICATION_OF_LIMITED_PCC_DEPLOYMENT_E (),
        11,//USAGE_REPORT_E ()
		};


/*type enumerated Media_Type_Type{
    // Ref: ETSI TS 129 214 5.3.19
    AUDIO_E (0),
    VIDEO_E (1),
    DATA_E (2),
    APPLICATION_E (3),
    CONTROL_E (4),
    TEXT_E (5),
    MESSAGE_E (6),
    OTHER_E (7) // OTHER is defined as c_uInt32Max = 0xFFFFFFFF
};*/
const char* Media_Type_Type::msKeywordEnums[] = { 
		"AUDIO_E",// (0),
        "VIDEO_E",// (1),
        "DATA_E",// (2),
        "APPLICATION_E",// (3),
        "CONTROL_E",// (4),
        "TEXT_E",// (5),
        "MESSAGE_E",// (6),
        "OTHER_E",// (7) // OTHER is defined as c_uInt32Max = 0xFFFFFFFF
		"" };
const int Media_Type_Type::msKeywordIds[] = { 
		0,//AUDIO_E (),
        1,//VIDEO_E (),
        2,//DATA_E (),
        3,//APPLICATION_E (),
        4,//CONTROL_E (),
        5,//TEXT_E (),
        6,//MESSAGE_E (),
        7,//OTHER_E () // OTHER is defined as c_uInt32Max = 0xFFFFFFFF
		};


/*type enumerated Service_Info_Type{
    // Ref: ETSI TS 129 214 5.3.25
    FINAL_SERVICE_INFORMATION_E (0),
    PRELIMINARY_SERVICE_INFORMATION_E (1)
};*/
const char* Service_Info_Type::msKeywordEnums[] = { 
		"FINAL_SERVICE_INFORMATION_E",// (0),
        "PRELIMINARY_SERVICE_INFORMATION_E",// (1)
		"" };
const int Service_Info_Type::msKeywordIds[] = { 
		0,//FINAL_SERVICE_INFORMATION_E (),
        1,//PRELIMINARY_SERVICE_INFORMATION_E ()
		};


/*type enumerated SIP_Forking_Indication_Type{
    // Ref: ETSI TS 129 214 5.3.22
    SINGLE_DIALOGUE_E (0),
    SEVERAL_DIALOGUES_E (1)
};*/
const char* SIP_Forking_Indication_Type::msKeywordEnums[] = { 
		"SINGLE_DIALOGUE_E",// (0),
        "SEVERAL_DIALOGUES_E",// (1)
		"" };
const int SIP_Forking_Indication_Type::msKeywordIds[] = { 
		0,//SINGLE_DIALOGUE_E (),
        1,//SEVERAL_DIALOGUES_E ()
		-1 };


/*type enumerated AF_Signalling_Protocol_Type{
                    // Ref: ETSI TS 129 214 5.3.26
                    NO_INFORMATION_E (0),
                    SIP_E (1)
                };*/
const char* AF_Signalling_Protocol_Type::msKeywordEnums[] = { 
		"NO_INFORMATION_E",// (0),
        "SIP_E",// (1)
		"" };
const int AF_Signalling_Protocol_Type::msKeywordIds[] = { 
		0,//NO_INFORMATION_E (),
        1,//SIP_E ()
		};




/*type enumerated Reservation_Priority_Type{
    // Ref: ETSI TS 183 017 7.3.9
    PRIORITY_ONE_E (1),
    PRIORITY_TWO_E (2),
    PRIORITY_THREE_E (3),
    PRIORITY_FOUR_E (4),
    PRIORITY_FIVE_E (5),
    PRIORITY_SIX_E (6),
    PRIORITY_SEVEN_E (7),
    PRIORITY_EIGHT_E (8),
    PRIORITY_NINE_E (9),
    PRIORITY_TEN_E(10),
    PRIORITY_ELEVEN_E (11),
    PRIORITY_TWELVE_E (12),
    PRIORITY_THIRTEEN_E (13),
    PRIORITY_FOURTEEN_E (14),
    PRIORITY_FIFTEEN_E (15)
};*/
const char* Reservation_Priority_Type::msKeywordEnums[] = { 
		"PRIORITY_ONE_E",// (1),
        "PRIORITY_TWO_E",// (2),
        "PRIORITY_THREE_E",// (3),
        "PRIORITY_FOUR_E",// (4),
        "PRIORITY_FIVE_E",// (5),
        "PRIORITY_SIX_E",// (6),
        "PRIORITY_SEVEN_E",// (7),
        "PRIORITY_EIGHT_E",// (8),
        "PRIORITY_NINE_E",// (9),
        "PRIORITY_TEN_E",//(10),
        "PRIORITY_ELEVEN_E",// (11),
        "PRIORITY_TWELVE_E",// (12),
        "PRIORITY_THIRTEEN_E",// (13),
        "PRIORITY_FOURTEEN_E",// (14),
        "PRIORITY_FIFTEEN_E",// (15)
		"" };
const int Reservation_Priority_Type::msKeywordIds[] = { 
		1,//PRIORITY_ONE_E (),
        2,//PRIORITY_TWO_E (),
        3,//PRIORITY_THREE_E (),
        4,//PRIORITY_FOUR_E (),
        5,//PRIORITY_FIVE_E (),
        6,//PRIORITY_SIX_E (),
        7,//PRIORITY_SEVEN_E (),
        8,//PRIORITY_EIGHT_E (),
        9,//PRIORITY_NINE_E (),
        10,//PRIORITY_TEN_E(),
        11,//PRIORITY_ELEVEN_E (),
        12,//PRIORITY_TWELVE_E (),
        13,//PRIORITY_THIRTEEN_E (),
        14,//PRIORITY_FOURTEEN_E (),
        15,//PRIORITY_FIFTEEN_E ()
		};


/*type enumerated IP_CAN_Type{
    // Ref: ETSI TS 129 212 5.3.27
    ThreeGPP_GPRS_E (0),
    DOCSIS_E (1),
    XDSL_E (2),
    WIMAX_E (3),
    ThreeGPP2_E (4),
    ThreeGPP_EPS_E (5),
    NON_3GPP_EPS_E (6)
};*/
const char* IP_CAN_Type::msKeywordEnums[] = { 
		"ThreeGPP_GPRS_E",// (0),
        "DOCSIS_E",// (1),
        "XDSL_E",// (2),
        "WIMAX_E",// (3),
        "ThreeGPP2_E",// (4),
        "ThreeGPP_EPS_E",// (5),
        "NON_3GPP_EPS_E",// (6)
		"" };
const int IP_CAN_Type::msKeywordIds[] = { 
		0,//ThreeGPP_GPRS_E (),
        1,//DOCSIS_E (),
        2,//XDSL_E (),
        3,//WIMAX_E (),
        4,//ThreeGPP2_E (),
        5,//ThreeGPP_EPS_E (),
        6,//NON_3GPP_EPS_E ()
		};


/*type enumerated RAT_Type{
    // Ref: ETSI TS 129 212 5.3.31
    WLAN_E (0),
    VIRTUAL_E (1),
    UTRAN_E (1000),
    GERAN_E (1001),
    GAN_E (1002),
    HSPA_EVOLUTION_E (1003),
    EUTRAN_E (1004),
    CDMA2000_IX_E (2000),
    HRPD_E(2001),
    UMB_E(2002),
    EHRPD_E(2003)
};*/
const char* RAT_Type::msKeywordEnums[] = { 
		"WLAN_E",// (0),
        "VIRTUAL_E",// (1),
        "UTRAN_E",// (1000),
        "GERAN_E",// (1001),
        "GAN_E",// (1002),
        "HSPA_EVOLUTION_E",// (1003),
        "EUTRAN_E",// (1004),
        "CDMA2000_IX_E",// (2000),
        "HRPD_E",//(2001),
        "UMB_E",//(2002),
        "EHRPD_E",//(2003)
		"" };
const int RAT_Type::msKeywordIds[] = { 
		0,//WLAN_E (),
        1,//VIRTUAL_E (),
        1000,//UTRAN_E (),
        1001,//GERAN_E (),
        1002,//GAN_E (),
        1003,//HSPA_EVOLUTION_E (),
        1004,//EUTRAN_E (),
        2000,//CDMA2000_IX_E (),
        2001,//HRPD_E(),
        2002,//UMB_E(),
        2003,//EHRPD_E()
		};


/*type enumerated Bearer_Control_Mode{
    // Ref: ETSI TS 129 212 5.3.23
    UE_ONLY_E (0),
    RESERVED_E (1),
    UE_NW_E (2)
};*/
const char* Bearer_Control_Mode::msKeywordEnums[] = { 
		"UE_ONLY_E",// (0),
        "RESERVED_E",// (1),
        "UE_NW_E",// (2)
		"" };
const int Bearer_Control_Mode::msKeywordIds[] = { 
		0,//UE_ONLY_E (),
        1,//RESERVED_E (),
        2,//UE_NW_E ()
		};


/*type enumerated Bearer_Operation{
    // Ref: ETSI TS 129 212 5.3.21
    TERMINATION_E (0),
    ESTABLISHMENT_E (1),
    MODIFICATION_E (2)
};*/
const char* Bearer_Operation::msKeywordEnums[] = { 
		"TERMINATION_E",// (0),
        "ESTABLISHMENT_E",// (1),
        "MODIFICATION_E",// (2)
		"" };
const int Bearer_Operation::msKeywordIds[] = { 
		0,//TERMINATION_E (),
        1,//ESTABLISHMENT_E (),
        2,//MODIFICATION_E ()
		};


/*type enumerated Bearer_Usage{
    // Ref: ETSI TS 129 212 5.3.1
    GENERAL_E (0),
    IMS_SIGNALLING_E (1)
};*/
const char* Bearer_Usage::msKeywordEnums[] = { 
		"GENERAL_E",// (0),
        "IMS_SIGNALLING_E",// (1)
		"" };
const int Bearer_Usage::msKeywordIds[] = { 
		0,//GENERAL_E (),
        1,//IMS_SIGNALLING_E ()
		};


/*type enumerated Charging_Correlation_Indicator{
    // Ref: ETSI TS 129 212 5.3.67
	CHARGING_IDENTIFIER_REQUIRED_E (0)   
};*/
const char* Charging_Correlation_Indicator::msKeywordEnums[] = { 
		"CHARGING_IDENTIFIER_REQUIRED_E",// (0)   
		"" };
const int Charging_Correlation_Indicator::msKeywordIds[] = { 
		0,//CHARGING_IDENTIFIER_REQUIRED_E ()   
		};


/*type enumerated CSG_Information_Reporting{
    // Ref: ETSI TS 129 212 5.3.64
	CHANGE_CSG_CELL_E (0),
	CHANGE_CSG_SUBSCRIBED_HYBRID_CELL_E (1),
	CHANGE_CSG_UNSUBSCRIBED_HYBRID_CELL_E (2)   
};*/
const char* CSG_Information_Reporting::msKeywordEnums[] = { 
		"CHANGE_CSG_CELL_E",// (0),
		"CHANGE_CSG_SUBSCRIBED_HYBRID_CELL_E",// (1),
		"CHANGE_CSG_UNSUBSCRIBED_HYBRID_CELL_E",// (2)   
		"" };
const int CSG_Information_Reporting::msKeywordIds[] = { 
		0,//CHANGE_CSG_CELL_E (),
		1,//CHANGE_CSG_SUBSCRIBED_HYBRID_CELL_E (),
		2,//CHANGE_CSG_UNSUBSCRIBED_HYBRID_CELL_E ()   
		};


/*type enumerated Event_Trigger{
    // Ref: ETSI TS 129 212 5.3.7
	SGSN_CHANGE_E (0),
    QOS_CHANGE_E (1),
    RAT_CHANGE_E (2),
    TFT_CHANGE_E (3),
    PLMN_CHANGE_E (4),
    LOSS_OF_BEARER_E (5),
    RECOVERY_OF_BEARER_E (6),
    IP_CAN_CHANGE_E (7),
    QOS_CHANGE_EXCEEDING_AUTHORIZATION_E (11),
    RAI_CHANGE_E (12),
    USER_LOCATION_CHANGE_E (13),
    NO_EVENT_TRIGGERS_E (14),
    OUT_OF_CREDIT_E (15),
    REALLOCATION_OF_CREDIT_E (16),
    REVALIDATION_TIMEOUT_E (17),
    UE_IP_ADDRESS_ALLOCATE_E (18),
    UE_IP_ADDRESS_RELEASE_E (19),
    DEFAULT_EPS_BEARER_QOS_CHANGE_E (20),
    AN_GW_CHANGE_E (21),
    SUCCESSFUL_RESOURCE_ALLOCATION_E (22),
    RESOURCE_MODIFICATION_REQUEST_E (23),
    PGW_TRACE_CONTROL_E (24),
    UE_TIME_ZONE_CHANGE_E (25),
    TAI_CHANGE_E (26),
    ECGI_CHANGE_E (27),
    CHARGING_CORRELATION_EXCHANGE_E (28),
    APN_AMBR_MODIFICATION_FAILURE_E (29),
    USER_CSG_INFORMATION_CHANGE_E (30),
    USAGE_REPORT_E (33),
    DEFAULT_EPS_BEARER_QOS_MODIFICATION_FAILURE_E (34),
    USER_CSG_HYBRID_SUBSCRIBED_INFORMATION_CHANGE_E (35),
    USER_CSG_HYBRID_UNSUBSCRIBED_INFORMATION_CHANGE_E (36),
    ROUTING_RULE_CHANGE_E (37),
    MAX_MBR_APN_AMBR_CHANGE_E (38)  
};*/
const char* Event_Trigger::msKeywordEnums[] = { 
		"SGSN_CHANGE_E",// (0),
        "QOS_CHANGE_E",// (1),
        "RAT_CHANGE_E",// (2),
        "TFT_CHANGE_E",// (3),
        "PLMN_CHANGE_E",// (4),
        "LOSS_OF_BEARER_E",// (5),
        "RECOVERY_OF_BEARER_E",// (6),
        "IP_CAN_CHANGE_E",// (7),
        "QOS_CHANGE_EXCEEDING_AUTHORIZATION_E",// (11),
        "RAI_CHANGE_E",// (12),
        "USER_LOCATION_CHANGE_E",// (13),
        "NO_EVENT_TRIGGERS_E",// (14),
        "OUT_OF_CREDIT_E",// (15),
        "REALLOCATION_OF_CREDIT_E",// (16),
        "REVALIDATION_TIMEOUT_E",// (17),
        "UE_IP_ADDRESS_ALLOCATE_E",// (18),
        "UE_IP_ADDRESS_RELEASE_E",// (19),
        "DEFAULT_EPS_BEARER_QOS_CHANGE_E",// (20),
        "AN_GW_CHANGE_E",// (21),
        "SUCCESSFUL_RESOURCE_ALLOCATION_E",// (22),
        "RESOURCE_MODIFICATION_REQUEST_E",// (23),
        "PGW_TRACE_CONTROL_E",// (24),
        "UE_TIME_ZONE_CHANGE_E",// (25),
        "TAI_CHANGE_E",// (26),
        "ECGI_CHANGE_E",// (27),
        "CHARGING_CORRELATION_EXCHANGE_E",// (28),
        "APN_AMBR_MODIFICATION_FAILURE_E",// (29),
        "USER_CSG_INFORMATION_CHANGE_E",// (30),
        "USAGE_REPORT_E",// (33),
        "DEFAULT_EPS_BEARER_QOS_MODIFICATION_FAILURE_E",// (34),
        "USER_CSG_HYBRID_SUBSCRIBED_INFORMATION_CHANGE_E",// (35),
        "USER_CSG_HYBRID_UNSUBSCRIBED_INFORMATION_CHANGE_E",// (36),
        "ROUTING_RULE_CHANGE_E",// (37),
        "MAX_MBR_APN_AMBR_CHANGE_E",// (38)  
		"" };
const int Event_Trigger::msKeywordIds[] = { 
		0,//SGSN_CHANGE_E (),
        1,//QOS_CHANGE_E (),
        2,//RAT_CHANGE_E (),
        3,//TFT_CHANGE_E (),
        4,//PLMN_CHANGE_E (),
        5,//LOSS_OF_BEARER_E (),
        6,//RECOVERY_OF_BEARER_E (),
        7,//IP_CAN_CHANGE_E (),
        11,//QOS_CHANGE_EXCEEDING_AUTHORIZATION_E (),
        12,//RAI_CHANGE_E (),
        13,//USER_LOCATION_CHANGE_E (),
        14,//NO_EVENT_TRIGGERS_E (),
        15,//OUT_OF_CREDIT_E (),
        16,//REALLOCATION_OF_CREDIT_E (),
        17,//REVALIDATION_TIMEOUT_E (),
        18,//UE_IP_ADDRESS_ALLOCATE_E (),
        19,//UE_IP_ADDRESS_RELEASE_E (),
        20,//DEFAULT_EPS_BEARER_QOS_CHANGE_E (),
        21,//AN_GW_CHANGE_E (),
        22,//SUCCESSFUL_RESOURCE_ALLOCATION_E (),
        23,//RESOURCE_MODIFICATION_REQUEST_E (),
        24,//PGW_TRACE_CONTROL_E (),
        25,//UE_TIME_ZONE_CHANGE_E (),
        26,//TAI_CHANGE_E (),
        27,//ECGI_CHANGE_E (),
        28,//CHARGING_CORRELATION_EXCHANGE_E (),
        29,//APN_AMBR_MODIFICATION_FAILURE_E (),
        30,//USER_CSG_INFORMATION_CHANGE_E (),
        33,//USAGE_REPORT_E (),
        34,//DEFAULT_EPS_BEARER_QOS_MODIFICATION_FAILURE_E (),
        35,//USER_CSG_HYBRID_SUBSCRIBED_INFORMATION_CHANGE_E (),
        36,//USER_CSG_HYBRID_UNSUBSCRIBED_INFORMATION_CHANGE_E (),
        37,//ROUTING_RULE_CHANGE_E (),
        38,//MAX_MBR_APN_AMBR_CHANGE_E ()  
		};


/*type enumerated Flow_Direction{
    // Ref: ETSI TS 129 212 5.3.65
    UNSPECIFIED_E (0),
    DOWNLINK_E (1),
    UPLINK_E (2),
    BIDIRECTIONAL_E (3)
};*/
const char* Flow_Direction::msKeywordEnums[] = { 
		"UNSPECIFIED_E",// (0),
        "DOWNLINK_E",// (1),
        "UPLINK_E",// (2),
        "BIDIRECTIONAL_E",// (3)
		"" };
const int Flow_Direction::msKeywordIds[] = { 
		0,//UNSPECIFIED_E (),
        1,//DOWNLINK_E (),
        2,//UPLINK_E (),
        3,//BIDIRECTIONAL_E ()
		};


/*type enumerated Metering_Method{
    // Ref: ETSI TS 129 212 5.3.8
    DURATION_E (0),
    VOLUME_E (1),
	DURATION_VOLUME_E (2)
};*/
const char* Metering_Method::msKeywordEnums[] = { 
		"DURATION_E",// (0),
        "VOLUME_E",// (1),
		"DURATION_VOLUME_E",// (2)
		"" };
const int Metering_Method::msKeywordIds[] = { 
		0,//DURATION_E (),
        1,//VOLUME_E (),
		2,//DURATION_VOLUME_E ()
		};


/*type enumerated Network_Request_Support{
    // Ref: ETSI TS 129 212 5.3.24
    NETWORK_REQUEST_NOT_SUPPORTED_E (0),
	NETWORK_REQUEST_SUPPORTED_E (1)
};*/
const char* Network_Request_Support::msKeywordEnums[] = { 
		"NETWORK_REQUEST_NOT_SUPPORTED_E",// (0),
		"NETWORK_REQUEST_SUPPORTED_E",// (1)
		"" };
const int Network_Request_Support::msKeywordIds[] = { 
		0,//NETWORK_REQUEST_NOT_SUPPORTED_E (),
		1,//NETWORK_REQUEST_SUPPORTED_E ()
		};


/*type enumerated Offline{
    // Ref: ETSI TS 129 212 5.3.9
    DISABLE_OFFLINE_E (0),
	ENABLE_OFFLINE_E (1)
};*/
const char* Offline::msKeywordEnums[] = { 
		"DISABLE_OFFLINE_E",// (0),
		"ENABLE_OFFLINE_E",// (1)
		"" };
const int Offline::msKeywordIds[] = { 
		0,//DISABLE_OFFLINE_E (),
		1,//ENABLE_OFFLINE_E ()
		};


/*type enumerated Online{
    // Ref: ETSI TS 129 212 5.3.10
    DISABLE_ONLINE_E (0),
	ENABLE_ONLINE_E (1)
};*/
const char* Online::msKeywordEnums[] = { 
		"DISABLE_ONLINE_E",// (0),
		"ENABLE_ONLINE_E",// (1)
		"" };
const int Online::msKeywordIds[] = { 
		0,//DISABLE_ONLINE_E (),
		1,//ENABLE_ONLINE_E ()
		};


/*type enumerated Packet_Filter_Operation{
    // Ref: ETSI TS 129 212 5.3.57
    DELETION_E (0),
    ADDITION_E (1),
    MODIFICATION_E (2)
};*/
const char* Packet_Filter_Operation::msKeywordEnums[] = { 
		"DELETION_E",// (0),
        "ADDITION_E",// (1),
        "MODIFICATION_E",// (2)
		"" };
const int Packet_Filter_Operation::msKeywordIds[] = { 
		0,//DELETION_E (),
        1,//ADDITION_E (),
        2,//MODIFICATION_E ()
		};


/*type enumerated Packet_Filter_Usage{
    // Ref: ETSI TS 129 212 5.3.66
    SEND_TO_UE_E (1)
};*/
const char* Packet_Filter_Usage::msKeywordEnums[] = { 
		"SEND_TO_UE_E",// (1)
		"" };
const int Packet_Filter_Usage::msKeywordIds[] = { 
		1,//SEND_TO_UE_E ()
		};


/*type enumerated Pre_emption_Capability{
    // Ref: ETSI TS 129 212 5.3.46
    PRE_EMPTION_CAPABILITY_ENABLED_E (0),
    PRE_EMPTION_CAPABILITY_DISABLED_E (1)
};*/
const char* Pre_emption_Capability::msKeywordEnums[] = { 
		"PRE_EMPTION_CAPABILITY_ENABLED_E",// (0),
        "PRE_EMPTION_CAPABILITY_DISABLED_E",// (1)
		"" };
const int Pre_emption_Capability::msKeywordIds[] = { 
		0,//PRE_EMPTION_CAPABILITY_ENABLED_E (),
        1,//PRE_EMPTION_CAPABILITY_DISABLED_E ()
		};


/*type enumerated Pre_emption_Vulnerability{
    // Ref: ETSI TS 129 212 5.3.47
    PRE_EMPTION_VULNERABILITY_ENABLED_E (0),
    PRE_EMPTION_VULNERABILITY_DISABLED_E (1)
};*/
const char* Pre_emption_Vulnerability::msKeywordEnums[] = { 
		"PRE_EMPTION_VULNERABILITY_ENABLED_E",// (0),
        "PRE_EMPTION_VULNERABILITY_DISABLED_E",// (1)
		"" };
const int Pre_emption_Vulnerability::msKeywordIds[] = { 
		0,//PRE_EMPTION_VULNERABILITY_ENABLED_E (),
        1,//PRE_EMPTION_VULNERABILITY_DISABLED_E ()
		};


/*type enumerated Reporting_Level{
    // Ref: ETSI TS 129 212 5.3.12
    SERVICE_IDENTIFIER_LEVEL_E (0),
    RATING_GROUP_LEVEL_E (1),
    SPONSORED_CONNECTIVITY_LEVEL_E (2)
};*/
const char* Reporting_Level::msKeywordEnums[] = { 
		"SERVICE_IDENTIFIER_LEVEL_E",// (0),
        "RATING_GROUP_LEVEL_E",// (1),
        "SPONSORED_CONNECTIVITY_LEVEL_E",// (2)
		"" };
const int Reporting_Level::msKeywordIds[] = { 
		0,//SERVICE_IDENTIFIER_LEVEL_E (),
        1,//RATING_GROUP_LEVEL_E (),
        2,//SPONSORED_CONNECTIVITY_LEVEL_E ()
		};


/*type enumerated PCC_Rule_Status{
    // Ref: ETSI TS 129 212 5.3.19
    ACTIVE_E (0),
    INACTIVE_E (1),
    TEMPORARILY_INACTIVE_E (2)
};*/
const char* PCC_Rule_Status::msKeywordEnums[] = { 
		"ACTIVE_E",// (0),
        "INACTIVE_E",// (1),
        "TEMPORARILY_INACTIVE_E",// (2)
		"" };
const int PCC_Rule_Status::msKeywordIds[] = { 
		0,//ACTIVE_E (),
        1,//INACTIVE_E (),
        2,//TEMPORARILY_INACTIVE_E ()
		};


/*type enumerated Session_Release_Cause{
    // Ref: ETSI TS 129 212 5.3.44
    UNSPECIFIED_REASON_E (0),
    UE_SUBSCRIPTION_REASON_E (1),
    INSUFFICIENT_SERVER_RESOURCES_E (2)
};*/
const char* Session_Release_Cause::msKeywordEnums[] = { 
		"UNSPECIFIED_REASON_E",// (0),
        "UE_SUBSCRIPTION_REASON_E",// (1),
        "INSUFFICIENT_SERVER_RESOURCES_E",// (2)
		"" };
const int Session_Release_Cause::msKeywordIds[] = { 
		0,//UNSPECIFIED_REASON_E (),
        1,//UE_SUBSCRIPTION_REASON_E (),
        2,//INSUFFICIENT_SERVER_RESOURCES_E ()
		};


/*type enumerated QoS_Class_Identifier{
    // Ref: ETSI TS 129 212 5.3.17
    QCI_1_E (1),//examle service=conversational voice
    QCI_2_E (2),//examle service=conversational video
    QCI_3_E (3),//examle service=real time gaming
    QCI_4_E (4),//examle service=non-conversational video
    QCI_5_E (5),//examle service=IMS signalling
    QCI_6_E (6),//examle service=video(TCP based)
    QCI_7_E (7),//examle service=voice,video(life streaming)
    QCI_8_E (8),//examle service=video(buffered streaming)
    QCI_9_E (9)//examle service=video(buffered streaming)
};*/
const char* QoS_Class_Identifier::msKeywordEnums[] = { 
		"QCI_1_E",// (1),//examle service=conversational voice
        "QCI_2_E",// (2),//examle service=conversational video
        "QCI_3_E",// (3),//examle service=real time gaming
        "QCI_4_E",// (4),//examle service=non-conversational video
        "QCI_5_E",// (5),//examle service=IMS signalling
        "QCI_6_E",// (6),//examle service=video(TCP based)
        "QCI_7_E",// (7),//examle service=voice,video(life streaming)
        "QCI_8_E",// (8),//examle service=video(buffered streaming)
        "QCI_9_E",// (9)//examle service=video(buffered streaming)
		"" };
const int QoS_Class_Identifier::msKeywordIds[] = { 
		1,//QCI_1_E (),//examle service=conversational voice
        2,//QCI_2_E (),//examle service=conversational video
        3,//QCI_3_E (),//examle service=real time gaming
        4,//QCI_4_E (),//examle service=non-conversational video
        5,//QCI_5_E (),//examle service=IMS signalling
        6,//QCI_6_E (),//examle service=video(TCP based)
        7,//QCI_7_E (),//examle service=voice,video(life streaming)
        8,//QCI_8_E (),//examle service=video(buffered streaming)
        9,//QCI_9_E ()//examle service=video(buffered streaming)
		};


/*type enumerated QoS_Negotiation{
    // Ref: ETSI TS 129 212 5.3.28
    NO_QoS_NEGOTIATION_E (0),
	QoS_NEGOTIATION_SUPPORTED_E (1)
};*/
const char* QoS_Negotiation::msKeywordEnums[] = { 
		"NO_QoS_NEGOTIATION_E",// (0),
		"QoS_NEGOTIATION_SUPPORTED_E",// (1)
		"" };
const int QoS_Negotiation::msKeywordIds[] = { 
		0,//NO_QoS_NEGOTIATION_E (),
		1,//QoS_NEGOTIATION_SUPPORTED_E ()
		};


/*type enumerated QoS_Upgrade{
    // Ref: ETSI TS 129 212 5.3.29
    QoS_UPGRADE_NOT_SUPPORTED_E (0),
	QoS_UPGRADE_SUPPORTED_E (1)
};*/
const char* QoS_Upgrade::msKeywordEnums[] = { 
		"QoS_UPGRADE_NOT_SUPPORTED_E",// (0),
		"QoS_UPGRADE_SUPPORTED_E",// (1)
		"" };
const int QoS_Upgrade::msKeywordIds[] = { 
		0,//QoS_UPGRADE_NOT_SUPPORTED_E (),
		1,//QoS_UPGRADE_SUPPORTED_E ()
		};


/*type enumerated Resource_Allocation_Notification{
    // Ref: ETSI TS 129 212 5.3.50
    ENABLE_NOTIFICATION_E (0)
};*/
const char* Resource_Allocation_Notification::msKeywordEnums[] = { 
		"ENABLE_NOTIFICATION_E",// (0)
		"" };
const int Resource_Allocation_Notification::msKeywordIds[] = { 
		0,//ENABLE_NOTIFICATION_E ()
		};


/*type enumerated Rule_Failure_Code{
    // Ref: ETSI TS 129 212 5.3.38
    UNKNOWN_RULE_NAME_E (1),
    RATING_GROUP_ERROR_E (2),
    SERVICE_IDENTIFIER_ERROR_E (3),
    GW_PCEF_MALFUNCTION_E (4),
    RESOURCES_LIMITATION_E (5),
    MAX_NR_BEARERS_REACHED_E (6),
    UNKNOWN_BEARER_ID_E (7),
    MISSING_BEARER_ID_E (8),
    MISSING_FLOW_INFORMATION_E (9),
    RESOURCE_ALLOCATION_FAILURE_E (10),
    UNSUCCESSFUL_QOS_VALIDATION_E (11),
    INCORRECT_FLOW_INFORMATION_E (12),
    PS_TO_CS_HANDOVER_E (13),
    NO_BEARER_BOUND_E (15)
};*/
const char* Rule_Failure_Code::msKeywordEnums[] = { 
		"UNKNOWN_RULE_NAME_E",// (1),
        "RATING_GROUP_ERROR_E",// (2),
        "SERVICE_IDENTIFIER_ERROR_E",// (3),
        "GW_PCEF_MALFUNCTION_E",// (4),
        "RESOURCES_LIMITATION_E",// (5),
        "MAX_NR_BEARERS_REACHED_E",// (6),
        "UNKNOWN_BEARER_ID_E",// (7),
        "MISSING_BEARER_ID_E",// (8),
        "MISSING_FLOW_INFORMATION_E",// (9),
        "RESOURCE_ALLOCATION_FAILURE_E",// (10),
        "UNSUCCESSFUL_QOS_VALIDATION_E",// (11),
        "INCORRECT_FLOW_INFORMATION_E",// (12),
        "PS_TO_CS_HANDOVER_E",// (13),
        "NO_BEARER_BOUND_E",// (15)
		"" };
const int Rule_Failure_Code::msKeywordIds[] = { 
		1,//UNKNOWN_RULE_NAME_E (),
        2,//RATING_GROUP_ERROR_E (),
        3,//SERVICE_IDENTIFIER_ERROR_E (),
        4,//GW_PCEF_MALFUNCTION_E (),
        5,//RESOURCES_LIMITATION_E (),
        6,//MAX_NR_BEARERS_REACHED_E (),
        7,//UNKNOWN_BEARER_ID_E (),
        8,//MISSING_BEARER_ID_E (),
        9,//MISSING_FLOW_INFORMATION_E (),
        10,//RESOURCE_ALLOCATION_FAILURE_E (),
        11,//UNSUCCESSFUL_QOS_VALIDATION_E (),
        12,//INCORRECT_FLOW_INFORMATION_E (),
        13,//PS_TO_CS_HANDOVER_E (),
        15,//NO_BEARER_BOUND_E ()
		};


/*type enumerated Usage_Monitoring_Level{
    // Ref: ETSI TS 129 212 5.3.61
    SESSION_LEVEL_E (0),
	PCC_RULE_LEVEL_E (1)
};*/
const char* Usage_Monitoring_Level::msKeywordEnums[] = { 
		"SESSION_LEVEL_E",// (0),
		"PCC_RULE_LEVEL_E",// (1)
		"" };
const int Usage_Monitoring_Level::msKeywordIds[] = { 
		0,//SESSION_LEVEL_E (),
		1,//PCC_RULE_LEVEL_E ()
		};


/*type enumerated Usage_Monitoring_Report{
    // Ref: ETSI TS 129 212 5.3.62
    USAGE_MONITORING_REPORT_REQUIRED_E (0)
};*/
const char* Usage_Monitoring_Report::msKeywordEnums[] = { 
		"USAGE_MONITORING_REPORT_REQUIRED_E",// (0)
		"" };
const int Usage_Monitoring_Report::msKeywordIds[] = { 
		0,//USAGE_MONITORING_REPORT_REQUIRED_E ()
		};


/*type enumerated Usage_Monitoring_Support{
    // Ref: ETSI TS 129 212 5.3.63
    USAGE_MONITORING_DISABLED_E (0)
};*/
const char* Usage_Monitoring_Support::msKeywordEnums[] = { 
		"USAGE_MONITORING_DISABLED_E",// (0)
		"" };
const int Usage_Monitoring_Support::msKeywordIds[] = { 
		0,//USAGE_MONITORING_DISABLED_E ()
		};


/*type enumerated CSG_Access_Mode{
    // Ref: ETSI TS 132 299 7.2.46A
    CLOSED_MODE_E (0),
    HYBRID_MODE_E (1)
};*/
const char* CSG_Access_Mode::msKeywordEnums[] = { 
		"CLOSED_MODE_E",// (0),
		"HYBRID_MODE_E",// (1)
		"" };
const int CSG_Access_Mode::msKeywordIds[] = { 
		0,//CLOSED_MODE_E (),
		1,//HYBRID_MODE_E ()
		};


/*type enumerated CSG_Membership_Indication{
    // Ref: ETSI TS 132 299 7.2.46B
    NOT_CSG_MEMBER_E (0),
    CSG_MEMBER_E (1)
};*/
const char* CSG_Membership_Indication::msKeywordEnums[] = { 
		"NOT_CSG_MEMBER_E",// (0),
		"CSG_MEMBER_E",// (1)
		"" };
const int CSG_Membership_Indication::msKeywordIds[] = { 
		0,//NOT_CSG_MEMBER_E (),
		1,//CSG_MEMBER_E ()
		};




/*type enumerated Trace_Depth{
    // Ref: ETSI TS 132 422 5.3
    MINIMUM_E (0),
    MEDIUM_E (1),
    MAXIMUM_E (2),
    MINIMUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E (3),
    MEDIUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E (4),
    MAXIMUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E (5)
};*/
const char* Trace_Depth::msKeywordEnums[] = { 
		"MINIMUM_E",// (0),
        "MEDIUM_E",// (1),
        "MAXIMUM_E",// (2),
        "MINIMUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E",// (3),
        "MEDIUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E",// (4),
        "MAXIMUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E",// (5)
		"" };
const int Trace_Depth::msKeywordIds[] = { 
		0,//MINIMUM_E (),
		1,//MEDIUM_E (),
		2,//MAXIMUM_E (),
		3,//MINIMUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E (),
		4,//MEDIUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E (),
		5,//MAXIMUM_WITHOUT_VENDOR_SPECIFIC_EXTENSION_E ()
		};


/*type enumerated Job_Type{
    // Ref: ETSI TS 132 422 5.10.1
    IMMEDIATE_MDT_ONLY_E (0),
    LOGGED_MDT_ONLY_E (1),
    TRACE_ONLY_E (2),
    IMMEDIATE_MDT_AND_TRACE_E (3)
};*/
const char* Job_Type::msKeywordEnums[] = { 
		"IMMEDIATE_MDT_ONLY_E",// (0),
        "LOGGED_MDT_ONLY_E",// (1),
        "TRACE_ONLY_E",// (2),
        "IMMEDIATE_MDT_AND_TRACE_E",// (3)
		"" };
const int Job_Type::msKeywordIds[] = { 
		0,//IMMEDIATE_MDT_ONLY_E (),
        1,//LOGGED_MDT_ONLY_E (),
        2,//TRACE_ONLY_E (),
        3,//IMMEDIATE_MDT_AND_TRACE_E ()
		};


/*type enumerated Report_Interval{
    // Ref: ETSI TS 132 422 5.10.5
    REPORT_INTERVAL_250MS_E (0),
    REPORT_INTERVAL_500MS_E (1),
    REPORT_INTERVAL_1000MS_E (2),
    REPORT_INTERVAL_2000MS_E (3),
    REPORT_INTERVAL_3000MS_E (4),
    REPORT_INTERVAL_4000MS_E (5),
    REPORT_INTERVAL_6000MS_E (6),
    REPORT_INTERVAL_8000MS_E (7),
    REPORT_INTERVAL_12000MS_E (8),
    REPORT_INTERVAL_16000MS_E (9),
    REPORT_INTERVAL_20000MS_E (10),
    REPORT_INTERVAL_24000MS_E (11),
    REPORT_INTERVAL_28000MS_E (12),
    REPORT_INTERVAL_32000MS_E (13),
    REPORT_INTERVAL_64000MS_E (14),
    REPORT_INTERVAL_120MS_E (15),
    REPORT_INTERVAL_240MS_E (16),
    REPORT_INTERVAL_480MS_E (17),
    REPORT_INTERVAL_640MS_E (18),
    REPORT_INTERVAL_1024MS_E (19),
    REPORT_INTERVAL_2048MS_E (20),
    REPORT_INTERVAL_5120MS_E (21),
    REPORT_INTERVAL_10240MS_E (22),
    REPORT_INTERVAL_60000MS_E (23),
    REPORT_INTERVAL_360000MS_E (24),
    REPORT_INTERVAL_720000MS_E (25),
    REPORT_INTERVAL_1800000MS_E (26),
    REPORT_INTERVAL_3600000MS_E (27)
};*/
const char* Report_Interval::msKeywordEnums[] = { 
		"REPORT_INTERVAL_250MS_E",// (0),
        "REPORT_INTERVAL_500MS_E",// (1),
        "REPORT_INTERVAL_1000MS_E",// (2),
        "REPORT_INTERVAL_2000MS_E",// (3),
        "REPORT_INTERVAL_3000MS_E",// (4),
        "REPORT_INTERVAL_4000MS_E",// (5),
        "REPORT_INTERVAL_6000MS_E",// (6),
        "REPORT_INTERVAL_8000MS_E",// (7),
        "REPORT_INTERVAL_12000MS_E",// (8),
        "REPORT_INTERVAL_16000MS_E",// (9),
        "REPORT_INTERVAL_20000MS_E",// (10),
        "REPORT_INTERVAL_24000MS_E",// (11),
        "REPORT_INTERVAL_28000MS_E",// (12),
        "REPORT_INTERVAL_32000MS_E",// (13),
        "REPORT_INTERVAL_64000MS_E",// (14),
        "REPORT_INTERVAL_120MS_E",// (15),
        "REPORT_INTERVAL_240MS_E",// (16),
        "REPORT_INTERVAL_480MS_E",// (17),
        "REPORT_INTERVAL_640MS_E",// (18),
        "REPORT_INTERVAL_1024MS_E",// (19),
        "REPORT_INTERVAL_2048MS_E",// (20),
        "REPORT_INTERVAL_5120MS_E",// (21),
        "REPORT_INTERVAL_10240MS_E",// (22),
        "REPORT_INTERVAL_60000MS_E",// (23),
        "REPORT_INTERVAL_360000MS_E",// (24),
        "REPORT_INTERVAL_720000MS_E",// (25),
        "REPORT_INTERVAL_1800000MS_E",// (26),
        "REPORT_INTERVAL_3600000MS_E",// (27)
		"" };
const int Report_Interval::msKeywordIds[] = { 
		0,//REPORT_INTERVAL_250MS_E (),
        1,//REPORT_INTERVAL_500MS_E (),
        2,//REPORT_INTERVAL_1000MS_E (),
        3,//REPORT_INTERVAL_2000MS_E (),
        4,//REPORT_INTERVAL_3000MS_E (),
        5,//REPORT_INTERVAL_4000MS_E (),
        6,//REPORT_INTERVAL_6000MS_E (),
        7,//REPORT_INTERVAL_8000MS_E (),
        8,//REPORT_INTERVAL_12000MS_E (),
        9,//REPORT_INTERVAL_16000MS_E (),
        10,//REPORT_INTERVAL_20000MS_E (),
        11,//REPORT_INTERVAL_24000MS_E (),
        12,//REPORT_INTERVAL_28000MS_E (),
        13,//REPORT_INTERVAL_32000MS_E (),
        14,//REPORT_INTERVAL_64000MS_E (),
        15,//REPORT_INTERVAL_120MS_E (),
        16,//REPORT_INTERVAL_240MS_E (),
        17,//REPORT_INTERVAL_480MS_E (),
        18,//REPORT_INTERVAL_640MS_E (),
        19,//REPORT_INTERVAL_1024MS_E (),
        20,//REPORT_INTERVAL_2048MS_E (),
        21,//REPORT_INTERVAL_5120MS_E (),
        22,//REPORT_INTERVAL_10240MS_E (),
        23,//REPORT_INTERVAL_60000MS_E (),
        24,//REPORT_INTERVAL_360000MS_E (),
        25,//REPORT_INTERVAL_720000MS_E (),
        26,//REPORT_INTERVAL_1800000MS_E (),
        27,//REPORT_INTERVAL_3600000MS_E ()
		};


/*type enumerated Report_Amount{
    // Ref: ETSI TS 132 422 5.10.6
    AMOUNT_1_E (0),
    AMOUNT_2_E (1),
    AMOUNT_4_E (2),
    AMOUNT_8_E (3),
    AMOUNT_16_E (4),
    AMOUNT_32_E (5),
    AMOUNT_64_E (6),
    AMOUNT_INFINITY_E (7)
};*/
const char* Report_Amount::msKeywordEnums[] = { 
		"AMOUNT_1_E",// (0),
        "AMOUNT_2_E",// (1),
        "AMOUNT_4_E",// (2),
        "AMOUNT_8_E",// (3),
        "AMOUNT_16_E",// (4),
        "AMOUNT_32_E",// (5),
        "AMOUNT_64_E",// (6),
        "AMOUNT_INFINITY_E",// (7)
		"" };
const int Report_Amount::msKeywordIds[] = { 
		0,//AMOUNT_1_E (),
        1,//AMOUNT_2_E (),
        2,//AMOUNT_4_E (),
        3,//AMOUNT_8_E (),
        4,//AMOUNT_16_E (),
        5,//AMOUNT_32_E (),
        6,//AMOUNT_64_E (),
        7,//AMOUNT_INFINITY_E ()
		};


/*type enumerated Logging_Interval{
    // Ref: ETSI TS 132 422 5.10.8
    LOGGING_INTERVAL_1_28_E (0),
    LOGGING_INTERVAL_2_56_E (1),
    LOGGING_INTERVAL_3_12_E (2),
    LOGGING_INTERVAL_10_24_E (3),
    LOGGING_INTERVAL_20_49_E (4),
    LOGGING_INTERVAL_30_72_E (5),
    LOGGING_INTERVAL_40_96_E (6),
    LOGGING_INTERVAL_61_44_E (7)
};*/
const char* Logging_Interval::msKeywordEnums[] = { 
		"LOGGING_INTERVAL_1_28_E",// (0),
        "LOGGING_INTERVAL_2_56_E",// (1),
        "LOGGING_INTERVAL_3_12_E",// (2),
        "LOGGING_INTERVAL_10_24_E",// (3),
        "LOGGING_INTERVAL_20_49_E",// (4),
        "LOGGING_INTERVAL_30_72_E",// (5),
        "LOGGING_INTERVAL_40_96_E",// (6),
        "LOGGING_INTERVAL_61_44_E",// (7)
		"" };
const int Logging_Interval::msKeywordIds[] = { 
		0,//LOGGING_INTERVAL_1_28_E (),
        1,//LOGGING_INTERVAL_2_56_E (),
        2,//LOGGING_INTERVAL_3_12_E (),
        3,//LOGGING_INTERVAL_10_24_E (),
        4,//LOGGING_INTERVAL_20_49_E (),
        5,//LOGGING_INTERVAL_30_72_E (),
        6,//LOGGING_INTERVAL_40_96_E (),
        7,//LOGGING_INTERVAL_61_44_E ()
		};


/*type enumerated Logging_Duration{
    // Ref: ETSI TS 132 422 5.10.9
    LOGGING_DURATION_600SEC_E (0),
    LOGGING_DURATION_1200SEC_E (1),
    LOGGING_DURATION_2400SEC_E (2),
    LOGGING_DURATION_3600SEC_E (3),
    LOGGING_DURATION_5400SEC_E (4),
    LOGGING_DURATION_7200SEC_E (5)
};*/
const char* Logging_Duration::msKeywordEnums[] = { 
		"LOGGING_DURATION_600SEC_E",// (0),
        "LOGGING_DURATION_1200SEC_E",// (1),
        "LOGGING_DURATION_2400SEC_E",// (2),
        "LOGGING_DURATION_3600SEC_E",// (3),
        "LOGGING_DURATION_5400SEC_E",// (4),
        "LOGGING_DURATION_7200SEC_E",// (5)
		"" };
const int Logging_Duration::msKeywordIds[] = { 
		0,//LOGGING_DURATION_600SEC_E (),
        1,//LOGGING_DURATION_1200SEC_E (),
        2,//LOGGING_DURATION_2400SEC_E (),
        3,//LOGGING_DURATION_3600SEC_E (),
        4,//LOGGING_DURATION_5400SEC_E (),
        5,//LOGGING_DURATION_7200SEC_E ()
		};


//TODO: not sure where this one is defined????
/*type enumerated ASP_type {
                CONNECT_REQUEST_E(1),
                CONNECT_INDICATION_E(2),
                CONNECT_CONFIRM_E(3),
                DISCONNECT_REQUEST_E(4),
                DISCONNECT_INDICATION_E(5),
                DATA_REQUEST_E(6),
                DATA_INDICATION_E(7),
                LISTEN_REQUEST_E(8)
            }*/
const char* ASP_type::msKeywordEnums[] = { 
		"CONNECT_REQUEST_E",//(1),
        "CONNECT_INDICATION_E",//(2),
        "CONNECT_CONFIRM_E",//(3),
        "DISCONNECT_REQUEST_E",//(4),
        "DISCONNECT_INDICATION_E",//(5),
        "DATA_REQUEST_E",//(6),
        "DATA_INDICATION_E",//(7),
        "LISTEN_REQUEST_E",//(8)
		"" };
const unsigned int ASP_type::msKeywordIds[] = { 
		1,//CONNECT_REQUEST_E(),
        2,//CONNECT_INDICATION_E(),
        3,//CONNECT_CONFIRM_E(),
        4,//DISCONNECT_REQUEST_E(),
        5,//DISCONNECT_INDICATION_E(),
        6,//DATA_REQUEST_E(),
        7,//DATA_INDICATION_E(),
        8,//LISTEN_REQUEST_E()
		};

}} // namespaces
