|
|
@@ -25,14 +25,21 @@ |
|
|
|
import os |
|
|
|
import unittest |
|
|
|
|
|
|
|
from ctypes import Structure, POINTER, CFUNCTYPE, pointer, sizeof |
|
|
|
from ctypes import Array, Structure, POINTER, CFUNCTYPE, pointer, sizeof |
|
|
|
from ctypes import c_uint8, c_uint16, c_ssize_t, c_size_t, c_uint64, c_int |
|
|
|
from ctypes import CDLL |
|
|
|
|
|
|
|
class StructureRepr(object): |
|
|
|
@staticmethod |
|
|
|
def __specialrepr(obj): |
|
|
|
if isinstance(obj, Array): |
|
|
|
return '[ %s ]' % ', '.join(hex(x) for x in obj) |
|
|
|
|
|
|
|
return repr(obj) |
|
|
|
|
|
|
|
def __repr__(self): #pragma: no cover |
|
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join('%s=%s' % |
|
|
|
(k, getattr(self, k)) for k, v in self._fields_)) |
|
|
|
(k, self.__specialrepr(getattr(self, k))) for k, v in self._fields_)) |
|
|
|
|
|
|
|
class PktBuf(Structure): |
|
|
|
_fields_ = [ |
|
|
|