class documentation
class TestNetstring(TestMixin, basic.NetstringReceiver): (source)
Undocumented
Method | string |
Override this for notification when each complete string is received. |
Inherited from TestMixin
:
Method | connection |
Undocumented |
Method | connection |
Undocumented |
Constant | MAX |
Undocumented |
Instance Variable | closed |
Undocumented |
Instance Variable | received |
Undocumented |
Inherited from NetstringReceiver
(via TestMixin
):
Method | data |
Receives some characters of a netstring. |
Method | make |
Initializes the protocol. |
Method | send |
Sends a netstring. |
Instance Variable | broken |
Indicates if the connection is still functional |
Method | _check |
Checks if the netstring has a trailing comma at the expected position. |
Method | _check |
Makes sure that the received data represents a valid number. |
Method | _check |
Checks the sanity of lengthAsString. |
Method | _consume |
Consumes the content of self._remainingData. |
Method | _consume |
Consumes the length portion of self._remainingData. |
Method | _consume |
Consumes the payload portion of self._remainingData. |
Method | _extract |
Attempts to extract the length information of a netstring. |
Method | _extract |
Extracts payload information from self._remainingData. |
Method | _handle |
Terminates the connection and sets the flag self.brokenPeer. |
Method | _max |
Calculate and return the string size of self.MAX_LENGTH. |
Method | _payload |
Checks if enough data have been received to complete the netstring. |
Method | _prepare |
Sets up variables necessary for consuming the payload of a netstring. |
Method | _process |
Processes the length definition of a netstring. |
Method | _process |
Processes the actual payload with stringReceived . |
Constant | _LENGTH |
A pattern describing all strings that contain a netstring length specification. Examples for length specifications are b'0:', b'12:', and b'179:'. b'007:' is not a valid length specification, since leading zeros are not allowed. |
Constant | _LENGTH |
A pattern describing all strings that contain the first part of a netstring length specification (without the trailing comma). Examples are '0', '12', and '179'. '007' does not start a netstring length specification, since leading zeros are not allowed. |
Constant | _MISSING |
Undocumented |
Constant | _MISSING |
Undocumented |
Constant | _OVERFLOW |
Undocumented |
Constant | _PARSING |
Indicates that the NetstringReceiver is in the state of parsing the length portion of a netstring. |
Constant | _PARSING |
Indicates that the NetstringReceiver is in the state of parsing the payload portion (data and trailing comma) of a netstring. |
Constant | _TOO |
Undocumented |
Instance Variable | _current |
Undocumented |
Instance Variable | _expected |
Holds the payload size plus one for the trailing comma. |
Instance Variable | _payload |
Holds the payload portion of a netstring including the trailing comma |
Instance Variable | _remaining |
Holds the chunk of data that has not yet been consumed |
Instance Variable | _state |
Indicates if the protocol is consuming the length portion (PARSING_LENGTH) or the payload (PARSING_PAYLOAD) of a netstring |
Inherited from Protocol
(via TestMixin
, NetstringReceiver
):
Method | log |
Return a prefix matching the class name, to identify log messages related to this protocol instance. |
Class Variable | factory |
Undocumented |
Inherited from BaseProtocol
(via TestMixin
, NetstringReceiver
, Protocol
):
Instance Variable | connected |
Undocumented |
Instance Variable | transport |
Undocumented |
Override this for notification when each complete string is received.
Parameters | |
s | Undocumented |
string:bytes | The complete string which was received with all framing (length prefix, etc) removed. |
Raises | |
NotImplementedError | because the method has to be implemented by the child class. |