def from_binary(data): hello = Hello() hello.ProtocolVersion = uatype_UInt32.unpack(data.read(4))[0] hello.ReceiveBufferSize = uatype_UInt32.unpack(data.read(4))[0] hello.SendBufferSize = uatype_UInt32.unpack(data.read(4))[0] hello.MaxMessageSize = uatype_UInt32.unpack(data.read(4))[0] hello.MaxChunkCount = uatype_UInt32.unpack(data.read(4))[0] hello.EndpointUrl = uatypes.unpack_string(data) return hello
def from_string(data): hdr = Header() hdr.MessageType, hdr.ChunkType, hdr.packet_size = struct.unpack("<3scI", data.read(8)) hdr.body_size = hdr.packet_size - 8 if hdr.MessageType in (MessageType.SecureOpen, MessageType.SecureClose, MessageType.SecureMessage): hdr.body_size -= 4 hdr.ChannelId = uatype_UInt32.unpack(data.read(4))[0] return hdr
def from_string(data): hdr = Header() hdr.MessageType, hdr.ChunkType, hdr.packet_size = struct.unpack( "<3scI", data.read(8)) hdr.body_size = hdr.packet_size - 8 if hdr.MessageType in (MessageType.SecureOpen, MessageType.SecureClose, MessageType.SecureMessage): hdr.body_size -= 4 hdr.ChannelId = uatype_UInt32.unpack(data.read(4))[0] return hdr
def from_binary(data): obj = SequenceHeader() obj.SequenceNumber = uatype_UInt32.unpack(data.read(4))[0] obj.RequestId = uatype_UInt32.unpack(data.read(4))[0] return obj
def from_binary(data): obj = SymmetricAlgorithmHeader() obj.TokenId = uatype_UInt32.unpack(data.read(4))[0] return obj