Base Module (C++ Implementation)¶
C++ implementation of some base functions
-
class
py2p.cbase.flags¶ Storage container for protocol level flags
Note
This is not actually a class, it just makes it formatted much neater to treat it as such. In the C++ implementation this is a module. You should not need to import it.
Main flags:
Sub-flags:
-
broadcast
-
-
compression¶
-
-
whisper
-
-
handshake¶
-
-
ping
-
-
pong
-
-
notify¶
-
-
peers¶
-
-
request¶
-
-
resend¶
-
-
response¶
-
-
store¶
-
-
retrieve¶
-
C++-planned compression methods:
Other implementations’ and/or planned compression methods:
-
class
py2p.cbase.pathfinding_message¶ C++ implementation of the pathfinding_message object
-
__init__¶ x.__init__(...) initializes x; see help(type(x)) for signature
-
compression¶ A list of the compression methods available for use
-
compression_used¶ Return the compression method used, or None if there is none
-
feed_string()¶ Constructs a pathfinding_message from a string or bytes object.
Parameters: - string – The string you wish to parse
- sizeless – A boolean which describes whether this string has its size header (default: it does)
- compressions – A list containing the standardized compression methods this message might be under (default: [])
Returns: A cbase.pathfinding_message from the given string
Raises: TypeError– Fed a non-string, non-bytes argumentAssertionError– Initial size header is incorrectException– Unrecognized compression method fed in compressionsstruct.error– Packet headers are incorrect OR unrecognized compressionIndexError– See struct.error
Note
If you feed a unicode object, it will be decoded using utf-8. All other objects are treated as raw_unicode_escape. If you desire a particular codec, encode it yourself before feeding it in.
Warning
This part is a work in progress. Currently errors often cause segfaults, and the above Exceptions are not consistently raised.
-
id¶ Return the message ID
-
msg_type¶ Return the message type
-
packets¶ Return the packets of this message
-
payload¶ Return the payload of this message
-
sender¶ Return the sender ID of this message
-
string¶ Return the string of this message
-
time¶ Return the message time
-
time_58¶ Return the message encoded in base_58
-