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