-
Notifications
You must be signed in to change notification settings - Fork 1
Protocol
major edited this page Jul 25, 2019
·
2 revisions
This page explains the Darwin packet object, as well as the data structures for low-level networking code.
A class used to create a Darwin packet.
-
_fields_ (
list): a list containing the different tuples used to create a C-like structure to be able to talk to Darwin -
DARWIN_FILTER_CODE_NO (
int): the default Darwin filter code, which basically means "no filter" -
DEFAULT_CERTITUDE_LIST_SIZE (
int): the default certitude list size, which is1, to allow FAMs (see flexible array members on C99) for both C and C++ code -
DEFAULT_MAX_CERTITUDE_SIZE (
int): the maximum number of certitudes that can be stored in thedarwinprotocol.DarwinPacketobject -
RESPONSE_TYPE (
dict): a dict used to associate packet type Python strings with their respective C enumerations -
PACKET_TYPE (
dict): a dict used to associate packet type Python strings with their respective C enumerations
__init__(self,
bytes_descr=None,
packet_type="other",
response_type="no",
filter_code=DARWIN_FILTER_CODE_NO,
certitude_list=None,
certitude_size=0,
body_size=0, )Create a Darwin packet instance.
-
bytes_descr (
bytes): if provided, the Darwin packet will be reconstructed with the bytes given. Any other argument will be ignored -
packet_type (
str): the packet type to be sent."darwin"for any packet coming from a Darwin filter,"other"for everything else -
response_type (
str): the response type which tells what Darwin is expected to do."no"to not answer anything,"back"to answer back to us,"darwin"to send the answer to the next filter, and"both"to apply both the"back"and"darwin"response types -
filter_code (
int): the filter code to be provided -
body_size (
int): the size of the body sent to Darwin -
event_id (
str): a string that represents an UUID, associated with a Darwin call. Useful with asynchronous calls, to bind the results -
certitude_size (
int): the number of certitude values returned. Default is0 -
certitude_list (
list): the Darwin certitude list. Default is[]. A certitude has to be superior or equal to0. If an error occurs, the certitude will be strictly superior to100 -
max_certitude_size (
int): the maximum number of certitudes that can be stored in thedarwinprotocol.DarwinPacketobject. Default isdarwinprotocol.DarwinPacket.DEFAULT_MAX_CERTITUDE_SIZE -
verbose (
bool): whether to print debug info or not. Default isFalse
_parse_bytes(self, bytes_descr)Used internally when creating a Darwin packet from bytes.
-
bytes_descr (
bytes): the bytes which will reconstruct the Darwin packet
get_python_descr(self)Return the header converted to a Python dict object.
dict: the header content converted to a Python dict object.