peng3dnet.constants - Constants

This module is designed to be imported via from peng3dnet.constants import * without any side-effects.

peng3dnet.constants.MAX_PACKETLENGTH = 4294967295

Constant equal to the maximum packet length representable by the length prefix in bytes.

Currently equals roughly 4.3GB or 2**32-1 Bytes.

peng3dnet.constants.STRUCT_FORMAT_LENGTH32 = '!I'

Format of the struct used for the length prefix.

This struct should be able to store a single integer value.

Note that changing this format string will break compatibility with non-modified peers.

For performance reasons, peng3dnet.net.STRUCT_LENGTH32 should be used during runtime instead.

peng3dnet.constants.STRUCT_FORMAT_HEADER = '!IH'

Format of the struct used for the packet header.

This struct should be able to store a packet id encoded as an integer and a bitfield containing flags.

Note that changing this format string will break compatibility with non-modified peers.

For performance reasons, peng3dnet.net.STRUCT_HEADER should be used during runtime instead.

peng3dnet.constants.STATE_INIT = 0

Default connection state of every new connection.

peng3dnet.constants.STATE_HANDSHAKE_WAIT1 = 1

Connection state symbolizing the peer has to wait until its peer sends the required packet.

This connection state is part of the internal handshake and should not be used manually.

peng3dnet.constants.STATE_HANDSHAKE_WAIT2 = 2

Currently unused connection state.

peng3dnet.constants.STATE_WAITTYPE = 3

Active connection state if the server is waiting for the client to send the connection type.

This connection state is part of the internal handshake and should not be used manually.

peng3dnet.constants.STATE_HELLOWAIT = 4

Connection state used by the client to wait for the server to send a HelloPacket.

This connection state is part of the internal handshake and should not be used manually.

peng3dnet.constants.STATE_LOGGEDIN = 65

Generic state indicating an active connection and successful authentication.

peng3dnet.constants.STATE_ACTIVE = 64

Generic state indicating an active connection and successful handshake.

peng3dnet.constants.STATE_CLOSED = 128

Internal state indicating a closed connection that may be removed completely.

peng3dnet.constants.MODE_NOTSET = 0

Placeholder mode used to indicate that the mode has not yet been set.

peng3dnet.constants.MODE_CLOSED = 1

Internal mode used to indicate that the connection is not active.

peng3dnet.constants.MODE_PING = 2

Old internal mode used to indicate that a ping request is being made.

peng3dnet.constants.MODE_PLAY = 3

Generic mode used to indicate that the connection is in play mode.

The exact definition of this mode is up to the application.

peng3dnet.constants.MODE_CHAT = 4

Generic mode used to indicate that the connection is in chat mode.

peng3dnet.constants.CONNTYPE_NOTSET

Placeholder connection type.

Note that this connection type will cause errors if used, use CONNTYPE_CLASSIC instead.

peng3dnet.constants.CONNTYPE_CLASSIC

Classic connection type.

See also

See peng3dnet.conntypes.ClassicConnectionType for more information.

peng3dnet.constants.CONNTYPE_PING = 'ping'

Ping request connection type.

peng3dnet.constants.FLAG_COMPRESSED = 1

Flag bit set if the packet is compressed.

peng3dnet.constants.FLAG_ENCRYPTED_AES = 2

Flag bit set if the packet is AES-Encrypted.

Note that this flag is currently not implemented.

peng3dnet.constants.SIDE_CLIENT = 0

Constant used to indicate the client side of the server-client relationship.

peng3dnet.constants.SIDE_SERVER = 1

Constant used to indicate the server side of the server-client relationship.

peng3dnet.constants.SSLSEC_NONE = 0

SSL Security level indicating that there is no SSL tunneling active.

Default SSL Security level.

peng3dnet.constants.SSLSEC_WRAPPED = 1

SSL Security level indicating that the socket has been wrapped in a SSLSocket.

Note that this usually isn’t more secure compared to SSLSEC_NONE.

peng3dnet.constants.SSLSEC_ENCRYPTED = 2

SSL Security level indicating that the SSL Tunnel uses encryption.

Only encryption enabled by the default in the standard library module ssl is regarded as secure.

peng3dnet.constants.SSLSEC_SERVERAUTH = 3

SSL Security level indicating that the server certificate is authentic and valid.

This includes hostname verification.

peng3dnet.constants.SSLSEC_BOTHAUTH = 4

SSL Security level indicating that both server and client certificate are authentic and valid.

This includes hostname verification.

peng3dnet.constants.DEFAULT_CONFIG

Default configuration values.

This dictionary is used to look up default config values.

See also

See Configuration Options for peng3dnet for a list of all config options.