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

Method process

opcua/server/uaprocessor.py:85–110  ·  view source on GitHub ↗
(self, header, body)

Source from the content-addressed store, hash-verified

83 self.send_response(requestdata.requesthdr.RequestHandle, requestdata.seqhdr, response)
84
85 def process(self, header, body):
86 msg = self._connection.receive_from_header_and_body(header, body)
87 if isinstance(msg, ua.Message):
88 if header.MessageType == ua.MessageType.SecureOpen:
89 self.open_secure_channel(msg.SecurityHeader(), msg.SequenceHeader(), msg.body())
90
91 elif header.MessageType == ua.MessageType.SecureClose:
92 self._connection.close()
93 return False
94
95 elif header.MessageType == ua.MessageType.SecureMessage:
96 return self.process_message(msg.SequenceHeader(), msg.body())
97 elif isinstance(msg, ua.Hello):
98 ack = ua.Acknowledge()
99 ack.ReceiveBufferSize = msg.ReceiveBufferSize
100 ack.SendBufferSize = msg.SendBufferSize
101 data = uatcp_to_binary(ua.MessageType.Acknowledge, ack)
102 self.socket.write(data)
103 elif isinstance(msg, ua.ErrorMessage):
104 self.logger.warning("Received an error message type")
105 elif msg is None:
106 pass # msg is a ChunkType.Intermediate of an ua.MessageType.SecureMessage
107 else:
108 self.logger.warning("Unsupported message type: %s", header.MessageType)
109 raise utils.ServiceError(ua.StatusCodes.BadTcpMessageTypeInvalid)
110 return True
111
112 def process_message(self, seqhdr, body):
113 typeid = nodeid_from_binary(body)

Callers 1

_process_dataMethod · 0.80

Calls 9

open_secure_channelMethod · 0.95
process_messageMethod · 0.95
uatcp_to_binaryFunction · 0.90
SecurityHeaderMethod · 0.80
SequenceHeaderMethod · 0.80
bodyMethod · 0.80
closeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected