@@ 218-245 (lines=28) @@ | ||
215 | __repr__ = __str__ |
|
216 | ||
217 | ||
218 | class SequenceHeader(uatypes.FrozenClass): |
|
219 | ||
220 | def __init__(self): |
|
221 | self.SequenceNumber = None |
|
222 | self.RequestId = None |
|
223 | self._freeze = True |
|
224 | ||
225 | @staticmethod |
|
226 | def from_binary(data): |
|
227 | obj = SequenceHeader() |
|
228 | obj.SequenceNumber = uabin.Primitives.UInt32.unpack(data) |
|
229 | obj.RequestId = uabin.Primitives.UInt32.unpack(data) |
|
230 | return obj |
|
231 | ||
232 | def to_binary(self): |
|
233 | b = [] |
|
234 | b.append(uabin.Primitives.UInt32.pack(self.SequenceNumber)) |
|
235 | b.append(uabin.Primitives.UInt32.pack(self.RequestId)) |
|
236 | return b"".join(b) |
|
237 | ||
238 | @staticmethod |
|
239 | def max_size(): |
|
240 | return struct.calcsize("<II") |
|
241 | ||
242 | def __str__(self): |
|
243 | return "{0}(SequenceNumber:{1}, RequestId:{2} )".format( |
|
244 | self.__class__.__name__, self.SequenceNumber, self.RequestId) |
|
245 | __repr__ = __str__ |
|
246 | ||
247 | ||
248 | class CryptographyNone: |
|
@@ 112-134 (lines=23) @@ | ||
109 | __repr__ = __str__ |
|
110 | ||
111 | ||
112 | class ErrorMessage(uatypes.FrozenClass): |
|
113 | ||
114 | def __init__(self): |
|
115 | self.Error = uatypes.StatusCode() |
|
116 | self.Reason = "" |
|
117 | self._freeze = True |
|
118 | ||
119 | def to_binary(self): |
|
120 | b = [] |
|
121 | b.append(self.Error.to_binary()) |
|
122 | b.append(uabin.Primitives.String.pack(self.Reason)) |
|
123 | return b"".join(b) |
|
124 | ||
125 | @staticmethod |
|
126 | def from_binary(data): |
|
127 | ack = ErrorMessage() |
|
128 | ack.Error = uatypes.StatusCode.from_binary(data) |
|
129 | ack.Reason = uabin.Primitives.String.unpack(data) |
|
130 | return ack |
|
131 | ||
132 | def __str__(self): |
|
133 | return "MessageAbort(error:{0}, reason:{1})".format(self.Error, self.Reason) |
|
134 | __repr__ = __str__ |
|
135 | ||
136 | ||
137 | class Acknowledge(uatypes.FrozenClass): |