Package Peach :: Package Generators :: Module stun :: Class StunErrorCodeAttribute
[hide private]

Class StunErrorCodeAttribute

source code



ERROR-CODE

The ERROR-CODE attribute is present in the Binding Error Response and
Shared Secret Error Response.  It is a numeric value in the range of
100 to 699 plus a textual reason phrase encoded in UTF-8, and is
consistent in its code assignments and semantics with SIP [10] and
HTTP [15].  The reason phrase is meant for user consumption, and can
be anything appropriate for the response code.  The lengths of the
reason phrases MUST be a multiple of 4 (measured in bytes).  This can
be accomplished by added spaces to the end of the text, if necessary.
Recommended reason phrases for the defined response codes are
presented below.

To facilitate processing, the class of the error code (the hundreds
digit) is encoded separately from the rest of the code.

  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                   0                     |Class|     Number    |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |      Reason Phrase (variable)                                ..
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The class represents the hundreds digit of the response code.  The
value MUST be between 1 and 6.  The number represents the response
code modulo 100, and its value MUST be between 0 and 99.

The following response codes, along with their recommended reason
phrases (in brackets) are defined at this time:

400 (Bad Request): The request was malformed.  The client should not
         retry the request without modification from the previous
         attempt.

401 (Unauthorized): The Binding Request did not contain a MESSAGE-
         INTEGRITY attribute.

420 (Unknown Attribute): The server did not understand a mandatory
         attribute in the request.

430 (Stale Credentials): The Binding Request did contain a MESSAGE-
         INTEGRITY attribute, but it used a shared secret that has
         expired.  The client should obtain a new shared secret and try
         again.

431 (Integrity Check Failure): The Binding Request contained a
         MESSAGE-INTEGRITY attribute, but the HMAC failed verification.
         This could be a sign of a potential attack, or client
         implementation error.

432 (Missing Username): The Binding Request contained a MESSAGE-
         INTEGRITY attribute, but not a USERNAME attribute.  Both must be
         present for integrity checks.

433 (Use TLS): The Shared Secret request has to be sent over TLS, but
         was not received over TLS.

500 (Server Error): The server has suffered a temporary error. The
         client should try again.

600 (Global Failure:) The server is refusing to fulfill the request.
         The client should not retry.

Instance Methods [hide private]

Inherited from StunAttribute: __init__, getRawValue

Inherited from StunAttribute (private): _getValue

Class Variables [hide private]

Inherited from StunAttribute: CHANGED_ADDRESS, CHANGE_REQUEST, ERROR_CODE, MAPPED_ADDRESS, MESSAGE_INTEGRITY, PASSWORD, REFLECTED_FROM, RESPONSE_ADDRESS, SOURCE_ADDRESS, UNKNOWN_ATTRIBUTES, USERNAME

Inherited from StunAttribute (private): _generator, _length, _type