summaryrefslogtreecommitdiffstats
path: root/tester/rt/tftpy/TftpPacketFactory.py
diff options
context:
space:
mode:
Diffstat (limited to 'tester/rt/tftpy/TftpPacketFactory.py')
-rw-r--r--tester/rt/tftpy/TftpPacketFactory.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tester/rt/tftpy/TftpPacketFactory.py b/tester/rt/tftpy/TftpPacketFactory.py
index 928fe07..41f39a9 100644
--- a/tester/rt/tftpy/TftpPacketFactory.py
+++ b/tester/rt/tftpy/TftpPacketFactory.py
@@ -1,10 +1,15 @@
+# vim: ts=4 sw=4 et ai:
+# -*- coding: utf8 -*-
"""This module implements the TftpPacketFactory class, which can take a binary
buffer, and return the appropriate TftpPacket object to represent it, via the
parse() method."""
-from __future__ import absolute_import, division, print_function, unicode_literals
+
from .TftpShared import *
from .TftpPacketTypes import *
+import logging
+
+log = logging.getLogger('tftpy.TftpPacketFactory')
class TftpPacketFactory(object):
"""This class generates TftpPacket objects. It is responsible for parsing
@@ -25,7 +30,7 @@ class TftpPacketFactory(object):
corresponding TftpPacket object. The buffer is the raw bytes off of
the network."""
log.debug("parsing a %d byte packet" % len(buffer))
- (opcode,) = struct.unpack("!H", buffer[:2])
+ (opcode,) = struct.unpack(str("!H"), buffer[:2])
log.debug("opcode is %d" % opcode)
packet = self.__create(opcode)
packet.buffer = buffer