"""
A bunch of constants from RFC3588, RFC4005, RFC4006 and RFC4072.
"""

#Applications (section 2.4)
DIAMETER_APPLICATION_COMMON = 0
DIAMETER_APPLICATION_NASREQ = 1
DIAMETER_APPLICATION_MOBILEIP = 2
DIAMETER_APPLICATION_ACCOUNTING = 3
DIAMETER_APPLICATION_RELAY = 0xffffffff

#message codes (section 3.1)
DIAMETER_COMMAND_CAPABILITIES_EXCHANGE = 257
DIAMETER_COMMAND_REAUTH                = 258
DIAMETER_COMMAND_ACCOUNTING            = 271
DIAMETER_COMMAND_ABORT_SESSION         = 274
DIAMETER_COMMAND_SESSION_TERMINATION   = 275
DIAMETER_COMMAND_DEVICE_WATCHDOG       = 280
DIAMETER_COMMAND_DISCONNECT_PEER       = 282

#AVP codes
DI_USER_NAME                          = 1
DI_CLASS                              = 25
DI_SESSION_TIMEOUT                    = 27
DI_PROXY_STATE                        = 33
DI_ACCOUNTING_SESSION_ID              = 44
DI_ACCT_MULTI_SESSION_ID              = 50
DI_EVENT_TIMESTAMP                    = 55
DI_ACCT_INTERIM_INTERVAL              = 85
DI_HOST_IP_ADDRESS                    = 257
DI_AUTH_APPLICATION_ID                = 258
DI_ACCT_APPLICATION_ID                = 259
DI_VENDOR_SPECIFIC_APPLICATION_ID     = 260
DI_REDIRECT_HOST_USAGE                = 261
DI_REDIRECT_MAX_CACHE_TIME            = 262
DI_SESSION_ID                         = 263
DI_ORIGIN_HOST                        = 264
DI_SUPPORTED_VENDOR_ID                = 265
DI_VENDOR_ID                          = 266
DI_FIRMWARE_REVISION                  = 267
DI_RESULT_CODE                        = 268
DI_PRODUCT_NAME                       = 269
DI_SESSION_BINDING                    = 270
DI_SESSION_SERVER_FAILOVER            = 271
DI_MULTI_ROUND_TIME_OUT               = 272
DI_DISCONNECT_CAUSE                   = 273
DI_AUTH_REQUEST_TYPE                  = 274
DI_AUTH_GRACE_PERIOD                  = 276
DI_AUTH_SESSION_STATE                 = 277
DI_ORIGIN_STATE_ID                    = 278
DI_FAILED_AVP                         = 279
DI_PROXY_HOST                         = 280
DI_ERROR_MESSAGE                      = 281
DI_ROUTE_RECORD                       = 282
DI_DESTINATION_REALM                  = 283
DI_PROXY_INFO                         = 284
DI_RE_AUTH_REQUEST_TYPE               = 285
DI_ACCOUNTING_SUB_SESSION_ID          = 287
DI_AUTHORIZATION_LIFETIME             = 291
DI_REDIRECT_HOST                      = 292
DI_DESTINATION_HOST                   = 293
DI_ERROR_REPORTING_HOST               = 294
DI_TERMINATION_CAUSE                  = 295
DI_ORIGIN_REALM                       = 296
DI_EXPERIMENTAL_RESULT                = 297
DI_EXPERIMENTAL_RESULT_CODE           = 298
DI_INBAND_SECURITY_ID                 = 299
DI_E2E_SEQUENCE_AVP                   = 300
DI_ACCOUNTING_RECORD_TYPE             = 480
DI_ACCOUNTING_REALTIME_REQUIRED       = 483
DI_ACCOUNTING_RECORD_NUMBER           = 485

#enum for DI_DISCONNECT_CAUSE (section 5.4.3)
DI_DISCONNECT_CAUSE_REBOOTING = 0
DI_DISCONNECT_CAUSE_BUSY = 1
DI_DISCONNECT_CAUSE_DO_NOT_WANT_TO_TALK_TO_YOU = 2

#enum for DI_REDIRECT_HOST_USAGE
DI_REDIRECT_HOST_USAGE_DONT_CACHE = 0
DI_REDIRECT_HOST_USAGE_ALL_SESSION = 1
DI_REDIRECT_HOST_USAGE_ALL_REALM = 2
DI_REDIRECT_HOST_USAGE_REALM_AND_APPLICATION = 3
DI_REDIRECT_HOST_USAGE_ALL_APPLICATION = 4
DI_REDIRECT_HOST_USAGE_ALL_HOST = 5
DI_REDIRECT_HOST_USAGE_ALL_USER = 6

#enum for DI_INBAND_SECURITY_ID (section 6.10)
DI_INBAND_SECURITY_ID_NO_INBAND_SECURITY = 0
DI_INBAND_SECURITY_ID_TLS = 1

#enum for DI_AUTH_REQUEST_TYPE (section 8.7)
DI_AUTH_REQUEST_TYPE_AUTHENTICATE_ONLY = 1
DI_AUTH_REQUEST_TYPE_AUTHORIZE_ONLY = 2
DI_AUTH_REQUEST_TYPE_AUTHENTICATE = 3

#enum for DI_AUTH_SESSION_STATE
DI_AUTH_SESSION_STATE_STALE_MAINTAINED = 0
DI_AUTH_SESSION_STATE_NO_STALE_MAINTAINED = 1

#enum for DI_RE_AUTH_REQUEST_TYPE
DI_RE_AUTH_REQUEST_TYPE_AUTHORIZE_ONLY = 0
DI_RE_AUTH_REQUEST_TYPE_AUTHORIZE_AUTHENTICATE = 1

#enum for DI_TERMINATION_CAUSE (section 8.15)
DI_TERMINATION_CAUSE_DIAMETER_LOGOUT                 = 1
DI_TERMINATION_CAUSE_DIAMETER_SERVICE_NOT_PROVIDED   = 2
DI_TERMINATION_CAUSE_DIAMETER_BAD_ANSWER             = 3
DI_TERMINATION_CAUSE_DIAMETER_ADMINISTRATIVE         = 4
DI_TERMINATION_CAUSE_DIAMETER_LINK_BROKEN            = 5
DI_TERMINATION_CAUSE_DIAMETER_AUTH_EXPIRED           = 6
DI_TERMINATION_CAUSE_DIAMETER_USER_MOVED             = 7
DI_TERMINATION_CAUSE_DIAMETER_SESSION_TIMEOUT        = 8

#bit flags for DI_SESSION_BINDING (section 8.17)
DI_SESSION_BINDING_RE_AUTH    = 0x0001
DI_SESSION_BINDING_STR        = 0x0002
DI_SESSION_BINDING_ACCOUNTING = 0x0004

#enum for DI_SESSION_SERVER_FAILOVER (section 8.18)
DI_SESSION_SERVER_FAILOVER_REFUSE_SERVICE = 0
DI_SESSION_SERVER_FAILOVER_TRY_AGAIN = 1
DI_SESSION_SERVER_FAILOVER_ALLOW_SERVICE = 2
DI_SESSION_SERVER_FAILOVER_TRY_AGAIN_ALLOW_SERVICE = 3

#enum for DI_ACCOUNTING_RECORD_TYPE (section 9.8.1)
DI_ACCOUNTING_RECORD_TYPE_EVENT_RECORD = 1
DI_ACCOUNTING_RECORD_TYPE_START_RECORD = 2
DI_ACCOUNTING_RECORD_TYPE_INTERIM_RECORD = 3
DI_ACCOUNTING_RECORD_TYPE_STOP_RECORD = 4

#enum for DI_ACCOUNTING_REALTIME_REQUIRED (section 9.8.7)
DI_ACCOUNTING_REALTIME_REQUIRED_DELIVER_AND_GRANT = 1
DI_ACCOUNTING_REALTIME_REQUIRED_GRANT_AND_STORE = 2
DI_ACCOUNTING_REALTIME_REQUIRED_GRANT_AND_LOSE = 3

#result codes (enum for result-code AVP)
DIAMETER_RESULT_MULTI_ROUND_AUTH         = 1001
DIAMETER_RESULT_SUCCESS                  = 2001
DIAMETER_RESULT_LIMITED_SUCCESS          = 2002
DIAMETER_RESULT_COMMAND_UNSUPPORTED      = 3001
DIAMETER_RESULT_UNABLE_TO_DELIVER        = 3002
DIAMETER_RESULT_REALM_NOT_SERVED         = 3003
DIAMETER_RESULT_TOO_BUSY                 = 3004
DIAMETER_RESULT_LOOP_DETECTED            = 3005
DIAMETER_RESULT_REDIRECT_INDICATION      = 3006
DIAMETER_RESULT_APPLICATION_UNSUPPORTED  = 3007
DIAMETER_RESULT_INVALID_HDR_BITS         = 3008
DIAMETER_RESULT_INVALID_AVP_BITS         = 3009
DIAMETER_RESULT_UNKNOWN_PEER             = 3010
DIAMETER_RESULT_AUTHENTICATION_REJECTED  = 4001
DIAMETER_RESULT_OUT_OF_SPACE             = 4002
DIAMETER_RESULT_ELECTION_LOST            = 4003 #official name: ELECTION_LOST
DIAMETER_RESULT_AVP_UNSUPPORTED          = 5001
DIAMETER_RESULT_UNKNOWN_SESSION_ID       = 5002
DIAMETER_RESULT_AUTHORIZATION_REJECTED   = 5003
DIAMETER_RESULT_INVALID_AVP_VALUE        = 5004
DIAMETER_RESULT_MISSING_AVP              = 5005
DIAMETER_RESULT_RESOURCES_EXCEEDED       = 5006
DIAMETER_RESULT_CONTRADICTING_AVPS       = 5007
DIAMETER_RESULT_AVP_NOT_ALLOWED          = 5008
DIAMETER_RESULT_AVP_OCCURS_TOO_MANY_TIMES= 5009
DIAMETER_RESULT_NO_COMMON_APPLICATION    = 5010
DIAMETER_RESULT_UNSUPPORTED_VERSION      = 5011
DIAMETER_RESULT_UNABLE_TO_COMPLY         = 5012
DIAMETER_RESULT_INVALID_BIT_IN_HEADER    = 5013
DIAMETER_RESULT_INVALID_AVP_LENGTH       = 5014
DIAMETER_RESULT_INVALID_MESSAGE_LENGTH   = 5015
DIAMETER_RESULT_INVALID_AVP_BIT_COMBO    = 5016
DIAMETER_RESULT_NO_COMMON_SECURITY       = 5017

#RFC4005 - Diameter Network Access Server Application
DIAMETER_COMMAND_AA                    = 265

#AVPs (section 4.1)
DI_NAS_PORT                              = 5
DI_NAS_PORT_ID                           = 87
DI_NAS_PORT_TYPE                         = 61
DI_CALLED_STATION_ID                     = 30
DI_CALLING_STATION_ID                    = 31
DI_CONNECT_INFO                          = 77
DI_ORIGINATING_LINE_INFO                 = 94
DI_REPLY_MESSAGE                         = 18

#AVPs (section 5)
DI_USER_PASSWORD                         = 2
DI_PASSWORD_RETRY                        = 75
DI_PROMPT                                = 76
DI_CHAP_AUTH                             = 402
DI_CHAP_ALGORITHM                        = 403
DI_CHAP_IDENT                            = 404
DI_CHAP_RESPONSE                         = 405
DI_CHAP_CHALLENGE                        = 60
DI_ARAP_PASSWORD                         = 70
DI_ARAP_CHALLENGE_RESPONSE               = 84
DI_ARAP_SECURITY                         = 73
DI_ARAP_SECURITY_DATA                    = 74

#AVPs (section 6)
DI_SERVICE_TYPE                          = 6
DI_CALLBACK_NUMBER                       = 19
DI_CALLBACK_ID                           = 20
DI_IDLE_TIMEOUT                          = 28
DI_PORT_LIMIT                            = 62
DI_NAS_FILTER_RULE                       = 400
DI_FILTER_ID                             = 11
DI_CONFIGURATION_TOKEN                   = 78
DI_QOS_FILTER_RULE                       = 407
DI_FRAMED_PROTOCOL                       = 7
DI_FRAMED_ROUTING                        = 10
DI_FRAMED_MTU                            = 12
DI_FRAMED_COMPRESSION                    = 13
DI_FRAMED_IP_ADDRESS                     = 8
DI_FRAMED_IP_NETMASK                     = 9
DI_FRAMED_ROUTE                          = 22
DI_FRAMED_POOL                           = 88
DI_FRAMED_INTERFACE_ID                   = 96
DI_FRAMED_IPV6_PREFIX                    = 97
DI_FRAMED_IPV6_ROUTE                     = 99
DI_FRAMED_IPV6_POOL                      = 100
DI_FRAMED_IPX_NETWORK                    = 23
DI_FRAMED_APPLETALK_LINK                 = 37
DI_FRAMED_APPLETALK_NETWORK              = 38
DI_FRAMED_APPLETALK_ZONE                 = 39
DI_ARAP_FEATURES                         = 71
DI_ARAP_ZONE_ACCESS                      = 72
DI_LOGIN_IP_HOST                         = 14
DI_LOGIN_IPV6_HOST                       = 98
DI_LOGIN_SERVICE                         = 15
DI_LOGIN_TCP_PORT                        = 16
DI_LOGIN_LAT_SERVICE                     = 34
DI_LOGIN_LAT_NODE                        = 35
DI_LOGIN_LAT_GROUP                       = 36
DI_LOGIN_LAT_PORT                        = 63

#AVPs (section 7)
DI_TUNNELING                             = 401
DI_TUNNEL_TYPE                           = 64
DI_TUNNEL_MEDIUM_TYPE                    = 65
DI_TUNNEL_CLIENT_ENDPOINT                = 66
DI_TUNNEL_SERVER_ENDPOINT                = 67
DI_TUNNEL_PASSWORD                       = 69
DI_TUNNEL_PRIVATE_GROUP_ID               = 81
DI_TUNNEL_ASSIGNMENT_ID                  = 82
DI_TUNNEL_PREFERENCE                     = 83
DI_TUNNEL_CLIENT_AUTH_ID                 = 90
DI_TUNNEL_SERVER_AUTH_ID                 = 91

#AVPs (section 8)
DI_ACCOUNTING_INPUT_OCTETS               = 363
DI_ACCOUNTING_OUTPUT_OCTETS              = 364
DI_ACCOUNTING_INPUT_PACKETS              = 365
DI_ACCOUNTING_OUTPUT_PACKETS             = 366
DI_ACCT_SESSION_TIME                     = 46
DI_ACCT_AUTHENTIC                        = 45
DI_ACOUNTING_AUTH_METHOD                 = 406
DI_ACCT_DELAY_TIME                       = 41
DI_ACCT_LINK_COUNT                       = 51
DI_ACCT_TUNNEL_CONNECTION                = 68
DI_ACCT_TUNNEL_PACKETS_LOST              = 86


#=============================================================================
#Credit Control application (rfc4006)

#Applications (section 1.3)
DIAMETER_APPLICATION_CREDIT_CONTROL = 4

#Message codes (section 3)
DIAMETER_COMMAND_CC                    = 272

#AVPs (section 8)
DI_CC_CORRELATION_ID                  = 411
DI_CC_INPUT_OCTETS                    = 412
DI_CC_MONEY                           = 413
DI_CC_OUTPUT_OCTETS                   = 414
DI_CC_REQUEST_NUMBER                  = 415
DI_CC_REQUEST_TYPE                    = 416
DI_CC_SERVICE_SPECIFIC_UNITS          = 417
DI_CC_SESSION_FAILOVER                = 418
DI_CC_SUB_SESSION_ID                  = 419
DI_CC_TIME                            = 420
DI_CC_TOTAL_OCTETS                    = 421
DI_CC_UNIT_TYPE                       = 454
DI_CHECK_BALANCE_RESULT               = 422
DI_COST_INFORMATION                   = 423
DI_COST_UNIT                          = 424
DI_CREDIT_CONTROL                     = 426
DI_CREDIT_CONTROL_FAILURE_HANDLING    = 427
DI_CURRENCY_CODE                      = 425
DI_DIRECT_DEBITING_FAILURE_HANDLING   = 428
DI_EXPONENT                           = 429
DI_FINAL_UNIT_ACTION                  = 449
DI_FINAL_UNIT_INDICATION              = 430
DI_GRANTED_SERVICE_UNIT               = 431
DI_G_S_U_POOL_IDENTIFIER              = 453
DI_G_S_U_POOL_REFERENCE               = 457
DI_MULTIPLE_SERVICES_CREDIT_CONTROL   = 456
DI_MULTIPLE_SERVICES_INDICATOR        = 455
DI_RATING_GROUP                       = 432
DI_REDIRECT_ADDRESS_TYPE              = 433
DI_REDIRECT_SERVER                    = 434
DI_REDIRECT_SERVER_ADDRESS            = 435
DI_REQUESTED_ACTION                   = 436
DI_REQUESTED_SERVICE_UNIT             = 437
DI_RESTRICTION_FILTER_RULE            = 438
DI_SERVICE_CONTEXT_ID                 = 461
DI_SERVICE_IDENTIFIER                 = 439
DI_SERVICE_PARAMETER_INFO             = 440
DI_SERVICE_PARAMETER_TYPE             = 441
DI_SERVICE_PARAMETER_VALUE            = 442
DI_SUBSCRIPTION_ID                    = 443
DI_SUBSCRIPTION_ID_DATA               = 444
DI_SUBSCRIPTION_ID_TYPE               = 450
DI_TARIFF_CHANGE_USAGE                = 452
DI_TARIFF_TIME_CHANGE                 = 451
DI_UNIT_VALUE                         = 445
DI_USED_SERVICE_UNIT                  = 446
DI_USER_EQUIPMENT_INFO                = 458
DI_USER_EQUIPMENT_INFO_TYPE           = 459
DI_USER_EQUIPMENT_INFO_VALUE          = 460
DI_VALUE_DIGITS                       = 447
DI_VALIDITY_TIME                      = 448

#enum for CC-Request-Type
DI_CC_REQUEST_TYPE_INITIAL_REQUEST     = 1
DI_CC_REQUEST_TYPE_UPDATE_REQUEST      = 2
DI_CC_REQUEST_TYPE_TERMINATION_REQUEST = 3
DI_CC_REQUEST_TYPE_EVENT_REQUEST       = 4
#enum for CC-Session-Failover
DI_CC_SESSION_FAILOVER_FAILOVER_NOT_SUPPORTED = 0
DI_CC_SESSION_FAILOVER_FAILOVER_SUPPORTED     = 1
#enum for Check-Balance-Result
DI_DI_CHECK_BALANCE_RESULT_ENOUGH_CREDIT = 0
DI_DI_CHECK_BALANCE_RESULT_NO_CREDIT     = 1
#enum for Credit-Control
DI_DI_CREDIT_CONTROL_CREDIT_AUTHORIZATION = 0
DI_DI_CREDIT_CONTROL_RE_AUTHORIZATION     = 1
#enum for Credit-Control-Failure-Handling
DI_CREDIT_CONTROL_FAILURE_HANDLING_TERMINATE           = 0
DI_CREDIT_CONTROL_FAILURE_HANDLING_CONTINUE            = 1
DI_CREDIT_CONTROL_FAILURE_HANDLING_RETRY_AND_TERMINATE = 2
#enum for Direct-Debiting-Failure-Handling
DI_DIRECT_DEBITING_FAILURE_HANDLING_TERMINATE_OR_BUFFER = 0
DI_DIRECT_DEBITING_FAILURE_HANDLING_CONTINUE = 1
#enum for Tariff-Change-Usage
DI_TARIFF_CHANGE_USAGE_UNIT_BEFORE_TARIFF_CHANGE = 0
DI_TARIFF_CHANGE_USAGE_UNIT_AFTER_TARIFF_CHANGE  = 1
DI_TARIFF_CHANGE_USAGE_UNIT_INDETERMINATE        = 2
#enum for CC-Unit-Type
DI_CC_UNIT_TYPE_TIME                   = 0
DI_CC_UNIT_TYPE_MONEY                  = 1
DI_CC_UNIT_TYPE_TOTAL_OCTETS           = 2
DI_CC_UNIT_TYPE_INPUT_OCTETS           = 3
DI_CC_UNIT_TYPE_OUTPUT_OCTETS          = 4
DI_CC_UNIT_TYPE_SERVICE_SPECIFIC_UNITS = 5
#enum for Final-Unit-Action
DI_FINAL_UNIT_ACTION_TERMINATE       = 0
DI_FINAL_UNIT_ACTION_REDIRECT        = 1
DI_FINAL_UNIT_ACTION_RESTRICT_ACCESS = 2
#enum for Redirect-Address-Type
DI_REDIRECT_ADDRESS_TYPE_IPV4_ADDRESS = 0
DI_REDIRECT_ADDRESS_TYPE_IPV6_ADDRESS = 1
DI_REDIRECT_ADDRESS_TYPE_URL          = 2
DI_REDIRECT_ADDRESS_TYPE_SIP_URL      = 3
#enum for Multiple-Services-Indicator
DI_MULTIPLE_SERVICES_INDICATOR_MULTIPLE_SERVICES_NOT_SUPPORTED = 0
DI_MULTIPLE_SERVICES_INDICATOR_MULTIPLE_SERVICES_SUPPORTED     = 1
#enum for Requested-Action
DI_REQUESTED_ACTION_DIRECT_DEBITING = 0
DI_REQUESTED_ACTION_REFUND_ACCOUNT  = 1
DI_REQUESTED_ACTION_CHECK_BALANCE   = 2
DI_REQUESTED_ACTION_PRICE_ENQUIRY   = 3
#enum for Subscription-Id-Type
DI_SUBSCRIPTION_ID_TYPE_END_USER_E164    = 0
DI_SUBSCRIPTION_ID_TYPE_END_USER_IMSI    = 1
DI_SUBSCRIPTION_ID_TYPE_END_USER_SIP_URI = 2
DI_SUBSCRIPTION_ID_TYPE_END_USER_NAI     = 3
DI_SUBSCRIPTION_ID_TYPE_END_USER_PRIVATE = 4
#enum for User-Equipment-Info-Type
DI_USER_EQUIPMENT_INFO_TYPE_IMEISV         = 0
DI_USER_EQUIPMENT_INFO_TYPE_MAC            = 1
DI_USER_EQUIPMENT_INFO_TYPE_EUI64          = 2
DI_USER_EQUIPMENT_INFO_TYPE_MODIFIED_EUI64  = 3

#Result codes
DIAMETER_RESULT_END_USER_SERVICE_DENIED         = 4010
DIAMETER_RESULT_CREDIT_CONTROL_NOT_APPLICABLE   = 4011
DIAMETER_RESULT_CREDIT_LIMIT_REACHED            = 4012
DIAMETER_RESULT_USER_UNKNOWN                    = 5030
DIAMETER_RESULT_RATING_FAILED                   = 5031

#=============================================================================
#RFC 4072 Diameter EAP Application
#applications (section 2.1)
DIAMETER_APPLICATION_EAP = 5

#message codes (section 3)
DIAMETER_COMMAND_EAP = 268

#AVPs (section 4.1)
DI_EAP_PAYLOAD                           = 462
DI_EAP_REISSUED_PAYLOAD                  = 463
DI_EAP_MASTER_SESSION_KEY                = 464
DI_EAP_KEY_NAME                          = 102
DI_ACCOUNTING_EAP_AUTH_METHOD            = 465

def _unittest():
    pass
