MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / header_to_binary

Function header_to_binary

opcua/ua/ua_binary.py:510–519  ·  view source on GitHub ↗
(hdr)

Source from the content-addressed store, hash-verified

508
509
510def header_to_binary(hdr):
511 b = []
512 b.append(struct.pack("<3ss", hdr.MessageType, hdr.ChunkType))
513 size = hdr.body_size + 8
514 if hdr.MessageType in (ua.MessageType.SecureOpen, ua.MessageType.SecureClose, ua.MessageType.SecureMessage):
515 size += 4
516 b.append(Primitives.UInt32.pack(size))
517 if hdr.MessageType in (ua.MessageType.SecureOpen, ua.MessageType.SecureClose, ua.MessageType.SecureMessage):
518 b.append(Primitives.UInt32.pack(hdr.ChannelId))
519 return b"".join(b)
520
521
522def header_from_binary(data):

Callers 3

from_header_and_bodyMethod · 0.90
to_binaryMethod · 0.90
uatcp_to_binaryFunction · 0.85

Calls 1

packMethod · 0.45

Tested by

no test coverage detected