From 3555f10e45db212ecf22ff1c44a8298388c0e9d2 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 12 Feb 2017 21:51:11 -0500 Subject: [PATCH] add optional little_endian argument to new_protocol method. Also, pass the value of this argument to the Protocol constructor. this gives the user of the new_protocol the ability to specify byte order when creating the protocol --- src/Rammbock/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Rammbock/core.py b/src/Rammbock/core.py index 95317af..60d8f49 100644 --- a/src/Rammbock/core.py +++ b/src/Rammbock/core.py @@ -157,7 +157,7 @@ def clear_message_streams(self): for server in self._servers: server.empty() - def new_protocol(self, protocol_name): + def new_protocol(self, protocol_name, little_endian=False): """Start defining a new protocol template. All messages sent and received from a connection that uses a protocol @@ -167,7 +167,7 @@ def new_protocol(self, protocol_name): raise Exception('Can not start a new protocol definition in middle of old.') if protocol_name in self._protocols: raise Exception('Protocol %s already defined' % protocol_name) - self._init_new_message_stack(Protocol(protocol_name, library=self)) + self._init_new_message_stack(Protocol(protocol_name, little_endian, library=self)) self._protocol_in_progress = True def end_protocol(self):