From 3d927e909fc022a8064b1ad220fa5085e1ec63bc Mon Sep 17 00:00:00 2001 From: olivier R-D Date: Sun, 8 Jan 2017 09:17:22 +0100 Subject: [PATCH] cleanup extension object code for encoding/decoding and add support for registring on the fly --- opcua/common/utils.py | 6 +- opcua/ua/uaprotocol_auto.py | 899 +++++++++++++++++++--------- opcua/ua/uatypes.py | 60 ++ schemas/generate_protocol_python.py | 15 +- 4 files changed, 701 insertions(+), 279 deletions(-) diff --git a/opcua/common/utils.py b/opcua/common/utils.py index c87bc22b3..6a1be0fb6 100644 --- a/opcua/common/utils.py +++ b/opcua/common/utils.py @@ -1,3 +1,8 @@ +""" +Helper function and classes that do not rely on opcua library. +Helper function and classes depending on ua object are in ua_utils.py +""" + import logging import os from concurrent.futures import Future @@ -6,7 +11,6 @@ from socket import error as SocketError try: - # we prefer to use bundles asyncio version, otherwise fallback to trollius import asyncio except ImportError: import trollius as asyncio diff --git a/opcua/ua/uaprotocol_auto.py b/opcua/ua/uaprotocol_auto.py index ceea6115f..064adfda1 100644 --- a/opcua/ua/uaprotocol_auto.py +++ b/opcua/ua/uaprotocol_auto.py @@ -3,10 +3,8 @@ ''' from datetime import datetime -from enum import Enum, IntEnum +from enum import IntEnum -from opcua.common.utils import Buffer -from opcua.ua.uaerrors import UaError from opcua.ua.uatypes import * from opcua.ua import ua_binary as uabin from opcua.ua.object_ids import ObjectIds @@ -16114,268 +16112,633 @@ def __str__(self): __repr__ = __str__ -ExtensionClasses = { - ObjectIds.TrustListDataType_Encoding_DefaultBinary: TrustListDataType, - ObjectIds.Argument_Encoding_DefaultBinary: Argument, - ObjectIds.EnumValueType_Encoding_DefaultBinary: EnumValueType, - ObjectIds.OptionSet_Encoding_DefaultBinary: OptionSet, - ObjectIds.Union_Encoding_DefaultBinary: Union, - ObjectIds.TimeZoneDataType_Encoding_DefaultBinary: TimeZoneDataType, - ObjectIds.ApplicationDescription_Encoding_DefaultBinary: ApplicationDescription, - ObjectIds.RequestHeader_Encoding_DefaultBinary: RequestHeader, - ObjectIds.ResponseHeader_Encoding_DefaultBinary: ResponseHeader, - ObjectIds.ServiceFault_Encoding_DefaultBinary: ServiceFault, - ObjectIds.FindServersRequest_Encoding_DefaultBinary: FindServersRequest, - ObjectIds.FindServersResponse_Encoding_DefaultBinary: FindServersResponse, - ObjectIds.ServerOnNetwork_Encoding_DefaultBinary: ServerOnNetwork, - ObjectIds.FindServersOnNetworkRequest_Encoding_DefaultBinary: FindServersOnNetworkRequest, - ObjectIds.FindServersOnNetworkResponse_Encoding_DefaultBinary: FindServersOnNetworkResponse, - ObjectIds.UserTokenPolicy_Encoding_DefaultBinary: UserTokenPolicy, - ObjectIds.EndpointDescription_Encoding_DefaultBinary: EndpointDescription, - ObjectIds.GetEndpointsRequest_Encoding_DefaultBinary: GetEndpointsRequest, - ObjectIds.GetEndpointsResponse_Encoding_DefaultBinary: GetEndpointsResponse, - ObjectIds.RegisteredServer_Encoding_DefaultBinary: RegisteredServer, - ObjectIds.RegisterServerRequest_Encoding_DefaultBinary: RegisterServerRequest, - ObjectIds.RegisterServerResponse_Encoding_DefaultBinary: RegisterServerResponse, - ObjectIds.DiscoveryConfiguration_Encoding_DefaultBinary: DiscoveryConfiguration, - ObjectIds.MdnsDiscoveryConfiguration_Encoding_DefaultBinary: MdnsDiscoveryConfiguration, - ObjectIds.RegisterServer2Request_Encoding_DefaultBinary: RegisterServer2Request, - ObjectIds.RegisterServer2Response_Encoding_DefaultBinary: RegisterServer2Response, - ObjectIds.ChannelSecurityToken_Encoding_DefaultBinary: ChannelSecurityToken, - ObjectIds.OpenSecureChannelRequest_Encoding_DefaultBinary: OpenSecureChannelRequest, - ObjectIds.OpenSecureChannelResponse_Encoding_DefaultBinary: OpenSecureChannelResponse, - ObjectIds.CloseSecureChannelRequest_Encoding_DefaultBinary: CloseSecureChannelRequest, - ObjectIds.CloseSecureChannelResponse_Encoding_DefaultBinary: CloseSecureChannelResponse, - ObjectIds.SignedSoftwareCertificate_Encoding_DefaultBinary: SignedSoftwareCertificate, - ObjectIds.SignatureData_Encoding_DefaultBinary: SignatureData, - ObjectIds.CreateSessionRequest_Encoding_DefaultBinary: CreateSessionRequest, - ObjectIds.CreateSessionResponse_Encoding_DefaultBinary: CreateSessionResponse, - ObjectIds.UserIdentityToken_Encoding_DefaultBinary: UserIdentityToken, - ObjectIds.AnonymousIdentityToken_Encoding_DefaultBinary: AnonymousIdentityToken, - ObjectIds.UserNameIdentityToken_Encoding_DefaultBinary: UserNameIdentityToken, - ObjectIds.X509IdentityToken_Encoding_DefaultBinary: X509IdentityToken, - ObjectIds.KerberosIdentityToken_Encoding_DefaultBinary: KerberosIdentityToken, - ObjectIds.IssuedIdentityToken_Encoding_DefaultBinary: IssuedIdentityToken, - ObjectIds.ActivateSessionRequest_Encoding_DefaultBinary: ActivateSessionRequest, - ObjectIds.ActivateSessionResponse_Encoding_DefaultBinary: ActivateSessionResponse, - ObjectIds.CloseSessionRequest_Encoding_DefaultBinary: CloseSessionRequest, - ObjectIds.CloseSessionResponse_Encoding_DefaultBinary: CloseSessionResponse, - ObjectIds.CancelRequest_Encoding_DefaultBinary: CancelRequest, - ObjectIds.CancelResponse_Encoding_DefaultBinary: CancelResponse, - ObjectIds.NodeAttributes_Encoding_DefaultBinary: NodeAttributes, - ObjectIds.ObjectAttributes_Encoding_DefaultBinary: ObjectAttributes, - ObjectIds.VariableAttributes_Encoding_DefaultBinary: VariableAttributes, - ObjectIds.MethodAttributes_Encoding_DefaultBinary: MethodAttributes, - ObjectIds.ObjectTypeAttributes_Encoding_DefaultBinary: ObjectTypeAttributes, - ObjectIds.VariableTypeAttributes_Encoding_DefaultBinary: VariableTypeAttributes, - ObjectIds.ReferenceTypeAttributes_Encoding_DefaultBinary: ReferenceTypeAttributes, - ObjectIds.DataTypeAttributes_Encoding_DefaultBinary: DataTypeAttributes, - ObjectIds.ViewAttributes_Encoding_DefaultBinary: ViewAttributes, - ObjectIds.AddNodesItem_Encoding_DefaultBinary: AddNodesItem, - ObjectIds.AddNodesResult_Encoding_DefaultBinary: AddNodesResult, - ObjectIds.AddNodesRequest_Encoding_DefaultBinary: AddNodesRequest, - ObjectIds.AddNodesResponse_Encoding_DefaultBinary: AddNodesResponse, - ObjectIds.AddReferencesItem_Encoding_DefaultBinary: AddReferencesItem, - ObjectIds.AddReferencesRequest_Encoding_DefaultBinary: AddReferencesRequest, - ObjectIds.AddReferencesResponse_Encoding_DefaultBinary: AddReferencesResponse, - ObjectIds.DeleteNodesItem_Encoding_DefaultBinary: DeleteNodesItem, - ObjectIds.DeleteNodesRequest_Encoding_DefaultBinary: DeleteNodesRequest, - ObjectIds.DeleteNodesResponse_Encoding_DefaultBinary: DeleteNodesResponse, - ObjectIds.DeleteReferencesItem_Encoding_DefaultBinary: DeleteReferencesItem, - ObjectIds.DeleteReferencesRequest_Encoding_DefaultBinary: DeleteReferencesRequest, - ObjectIds.DeleteReferencesResponse_Encoding_DefaultBinary: DeleteReferencesResponse, - ObjectIds.ViewDescription_Encoding_DefaultBinary: ViewDescription, - ObjectIds.BrowseDescription_Encoding_DefaultBinary: BrowseDescription, - ObjectIds.ReferenceDescription_Encoding_DefaultBinary: ReferenceDescription, - ObjectIds.BrowseResult_Encoding_DefaultBinary: BrowseResult, - ObjectIds.BrowseRequest_Encoding_DefaultBinary: BrowseRequest, - ObjectIds.BrowseResponse_Encoding_DefaultBinary: BrowseResponse, - ObjectIds.BrowseNextRequest_Encoding_DefaultBinary: BrowseNextRequest, - ObjectIds.BrowseNextResponse_Encoding_DefaultBinary: BrowseNextResponse, - ObjectIds.RelativePathElement_Encoding_DefaultBinary: RelativePathElement, - ObjectIds.RelativePath_Encoding_DefaultBinary: RelativePath, - ObjectIds.BrowsePath_Encoding_DefaultBinary: BrowsePath, - ObjectIds.BrowsePathTarget_Encoding_DefaultBinary: BrowsePathTarget, - ObjectIds.BrowsePathResult_Encoding_DefaultBinary: BrowsePathResult, - ObjectIds.TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary: TranslateBrowsePathsToNodeIdsRequest, - ObjectIds.TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary: TranslateBrowsePathsToNodeIdsResponse, - ObjectIds.RegisterNodesRequest_Encoding_DefaultBinary: RegisterNodesRequest, - ObjectIds.RegisterNodesResponse_Encoding_DefaultBinary: RegisterNodesResponse, - ObjectIds.UnregisterNodesRequest_Encoding_DefaultBinary: UnregisterNodesRequest, - ObjectIds.UnregisterNodesResponse_Encoding_DefaultBinary: UnregisterNodesResponse, - ObjectIds.EndpointConfiguration_Encoding_DefaultBinary: EndpointConfiguration, - ObjectIds.SupportedProfile_Encoding_DefaultBinary: SupportedProfile, - ObjectIds.SoftwareCertificate_Encoding_DefaultBinary: SoftwareCertificate, - ObjectIds.QueryDataDescription_Encoding_DefaultBinary: QueryDataDescription, - ObjectIds.NodeTypeDescription_Encoding_DefaultBinary: NodeTypeDescription, - ObjectIds.QueryDataSet_Encoding_DefaultBinary: QueryDataSet, - ObjectIds.NodeReference_Encoding_DefaultBinary: NodeReference, - ObjectIds.ContentFilterElement_Encoding_DefaultBinary: ContentFilterElement, - ObjectIds.ContentFilter_Encoding_DefaultBinary: ContentFilter, - ObjectIds.ElementOperand_Encoding_DefaultBinary: ElementOperand, - ObjectIds.LiteralOperand_Encoding_DefaultBinary: LiteralOperand, - ObjectIds.AttributeOperand_Encoding_DefaultBinary: AttributeOperand, - ObjectIds.SimpleAttributeOperand_Encoding_DefaultBinary: SimpleAttributeOperand, - ObjectIds.ContentFilterElementResult_Encoding_DefaultBinary: ContentFilterElementResult, - ObjectIds.ContentFilterResult_Encoding_DefaultBinary: ContentFilterResult, - ObjectIds.ParsingResult_Encoding_DefaultBinary: ParsingResult, - ObjectIds.QueryFirstRequest_Encoding_DefaultBinary: QueryFirstRequest, - ObjectIds.QueryFirstResponse_Encoding_DefaultBinary: QueryFirstResponse, - ObjectIds.QueryNextRequest_Encoding_DefaultBinary: QueryNextRequest, - ObjectIds.QueryNextResponse_Encoding_DefaultBinary: QueryNextResponse, - ObjectIds.ReadValueId_Encoding_DefaultBinary: ReadValueId, - ObjectIds.ReadRequest_Encoding_DefaultBinary: ReadRequest, - ObjectIds.ReadResponse_Encoding_DefaultBinary: ReadResponse, - ObjectIds.HistoryReadValueId_Encoding_DefaultBinary: HistoryReadValueId, - ObjectIds.HistoryReadResult_Encoding_DefaultBinary: HistoryReadResult, - ObjectIds.HistoryReadDetails_Encoding_DefaultBinary: HistoryReadDetails, - ObjectIds.ReadEventDetails_Encoding_DefaultBinary: ReadEventDetails, - ObjectIds.ReadRawModifiedDetails_Encoding_DefaultBinary: ReadRawModifiedDetails, - ObjectIds.ReadProcessedDetails_Encoding_DefaultBinary: ReadProcessedDetails, - ObjectIds.ReadAtTimeDetails_Encoding_DefaultBinary: ReadAtTimeDetails, - ObjectIds.HistoryData_Encoding_DefaultBinary: HistoryData, - ObjectIds.ModificationInfo_Encoding_DefaultBinary: ModificationInfo, - ObjectIds.HistoryModifiedData_Encoding_DefaultBinary: HistoryModifiedData, - ObjectIds.HistoryEvent_Encoding_DefaultBinary: HistoryEvent, - ObjectIds.HistoryReadRequest_Encoding_DefaultBinary: HistoryReadRequest, - ObjectIds.HistoryReadResponse_Encoding_DefaultBinary: HistoryReadResponse, - ObjectIds.WriteValue_Encoding_DefaultBinary: WriteValue, - ObjectIds.WriteRequest_Encoding_DefaultBinary: WriteRequest, - ObjectIds.WriteResponse_Encoding_DefaultBinary: WriteResponse, - ObjectIds.HistoryUpdateDetails_Encoding_DefaultBinary: HistoryUpdateDetails, - ObjectIds.UpdateDataDetails_Encoding_DefaultBinary: UpdateDataDetails, - ObjectIds.UpdateStructureDataDetails_Encoding_DefaultBinary: UpdateStructureDataDetails, - ObjectIds.UpdateEventDetails_Encoding_DefaultBinary: UpdateEventDetails, - ObjectIds.DeleteRawModifiedDetails_Encoding_DefaultBinary: DeleteRawModifiedDetails, - ObjectIds.DeleteAtTimeDetails_Encoding_DefaultBinary: DeleteAtTimeDetails, - ObjectIds.DeleteEventDetails_Encoding_DefaultBinary: DeleteEventDetails, - ObjectIds.HistoryUpdateResult_Encoding_DefaultBinary: HistoryUpdateResult, - ObjectIds.HistoryUpdateRequest_Encoding_DefaultBinary: HistoryUpdateRequest, - ObjectIds.HistoryUpdateResponse_Encoding_DefaultBinary: HistoryUpdateResponse, - ObjectIds.CallMethodRequest_Encoding_DefaultBinary: CallMethodRequest, - ObjectIds.CallMethodResult_Encoding_DefaultBinary: CallMethodResult, - ObjectIds.CallRequest_Encoding_DefaultBinary: CallRequest, - ObjectIds.CallResponse_Encoding_DefaultBinary: CallResponse, - ObjectIds.MonitoringFilter_Encoding_DefaultBinary: MonitoringFilter, - ObjectIds.DataChangeFilter_Encoding_DefaultBinary: DataChangeFilter, - ObjectIds.EventFilter_Encoding_DefaultBinary: EventFilter, - ObjectIds.AggregateConfiguration_Encoding_DefaultBinary: AggregateConfiguration, - ObjectIds.AggregateFilter_Encoding_DefaultBinary: AggregateFilter, - ObjectIds.MonitoringFilterResult_Encoding_DefaultBinary: MonitoringFilterResult, - ObjectIds.EventFilterResult_Encoding_DefaultBinary: EventFilterResult, - ObjectIds.AggregateFilterResult_Encoding_DefaultBinary: AggregateFilterResult, - ObjectIds.MonitoringParameters_Encoding_DefaultBinary: MonitoringParameters, - ObjectIds.MonitoredItemCreateRequest_Encoding_DefaultBinary: MonitoredItemCreateRequest, - ObjectIds.MonitoredItemCreateResult_Encoding_DefaultBinary: MonitoredItemCreateResult, - ObjectIds.CreateMonitoredItemsRequest_Encoding_DefaultBinary: CreateMonitoredItemsRequest, - ObjectIds.CreateMonitoredItemsResponse_Encoding_DefaultBinary: CreateMonitoredItemsResponse, - ObjectIds.MonitoredItemModifyRequest_Encoding_DefaultBinary: MonitoredItemModifyRequest, - ObjectIds.MonitoredItemModifyResult_Encoding_DefaultBinary: MonitoredItemModifyResult, - ObjectIds.ModifyMonitoredItemsRequest_Encoding_DefaultBinary: ModifyMonitoredItemsRequest, - ObjectIds.ModifyMonitoredItemsResponse_Encoding_DefaultBinary: ModifyMonitoredItemsResponse, - ObjectIds.SetMonitoringModeRequest_Encoding_DefaultBinary: SetMonitoringModeRequest, - ObjectIds.SetMonitoringModeResponse_Encoding_DefaultBinary: SetMonitoringModeResponse, - ObjectIds.SetTriggeringRequest_Encoding_DefaultBinary: SetTriggeringRequest, - ObjectIds.SetTriggeringResponse_Encoding_DefaultBinary: SetTriggeringResponse, - ObjectIds.DeleteMonitoredItemsRequest_Encoding_DefaultBinary: DeleteMonitoredItemsRequest, - ObjectIds.DeleteMonitoredItemsResponse_Encoding_DefaultBinary: DeleteMonitoredItemsResponse, - ObjectIds.CreateSubscriptionRequest_Encoding_DefaultBinary: CreateSubscriptionRequest, - ObjectIds.CreateSubscriptionResponse_Encoding_DefaultBinary: CreateSubscriptionResponse, - ObjectIds.ModifySubscriptionRequest_Encoding_DefaultBinary: ModifySubscriptionRequest, - ObjectIds.ModifySubscriptionResponse_Encoding_DefaultBinary: ModifySubscriptionResponse, - ObjectIds.SetPublishingModeRequest_Encoding_DefaultBinary: SetPublishingModeRequest, - ObjectIds.SetPublishingModeResponse_Encoding_DefaultBinary: SetPublishingModeResponse, - ObjectIds.NotificationMessage_Encoding_DefaultBinary: NotificationMessage, - ObjectIds.NotificationData_Encoding_DefaultBinary: NotificationData, - ObjectIds.DataChangeNotification_Encoding_DefaultBinary: DataChangeNotification, - ObjectIds.MonitoredItemNotification_Encoding_DefaultBinary: MonitoredItemNotification, - ObjectIds.EventNotificationList_Encoding_DefaultBinary: EventNotificationList, - ObjectIds.EventFieldList_Encoding_DefaultBinary: EventFieldList, - ObjectIds.HistoryEventFieldList_Encoding_DefaultBinary: HistoryEventFieldList, - ObjectIds.StatusChangeNotification_Encoding_DefaultBinary: StatusChangeNotification, - ObjectIds.SubscriptionAcknowledgement_Encoding_DefaultBinary: SubscriptionAcknowledgement, - ObjectIds.PublishRequest_Encoding_DefaultBinary: PublishRequest, - ObjectIds.PublishResponse_Encoding_DefaultBinary: PublishResponse, - ObjectIds.RepublishRequest_Encoding_DefaultBinary: RepublishRequest, - ObjectIds.RepublishResponse_Encoding_DefaultBinary: RepublishResponse, - ObjectIds.TransferResult_Encoding_DefaultBinary: TransferResult, - ObjectIds.TransferSubscriptionsRequest_Encoding_DefaultBinary: TransferSubscriptionsRequest, - ObjectIds.TransferSubscriptionsResponse_Encoding_DefaultBinary: TransferSubscriptionsResponse, - ObjectIds.DeleteSubscriptionsRequest_Encoding_DefaultBinary: DeleteSubscriptionsRequest, - ObjectIds.DeleteSubscriptionsResponse_Encoding_DefaultBinary: DeleteSubscriptionsResponse, - ObjectIds.BuildInfo_Encoding_DefaultBinary: BuildInfo, - ObjectIds.RedundantServerDataType_Encoding_DefaultBinary: RedundantServerDataType, - ObjectIds.EndpointUrlListDataType_Encoding_DefaultBinary: EndpointUrlListDataType, - ObjectIds.NetworkGroupDataType_Encoding_DefaultBinary: NetworkGroupDataType, - ObjectIds.SamplingIntervalDiagnosticsDataType_Encoding_DefaultBinary: SamplingIntervalDiagnosticsDataType, - ObjectIds.ServerDiagnosticsSummaryDataType_Encoding_DefaultBinary: ServerDiagnosticsSummaryDataType, - ObjectIds.ServerStatusDataType_Encoding_DefaultBinary: ServerStatusDataType, - ObjectIds.SessionDiagnosticsDataType_Encoding_DefaultBinary: SessionDiagnosticsDataType, - ObjectIds.SessionSecurityDiagnosticsDataType_Encoding_DefaultBinary: SessionSecurityDiagnosticsDataType, - ObjectIds.ServiceCounterDataType_Encoding_DefaultBinary: ServiceCounterDataType, - ObjectIds.StatusResult_Encoding_DefaultBinary: StatusResult, - ObjectIds.SubscriptionDiagnosticsDataType_Encoding_DefaultBinary: SubscriptionDiagnosticsDataType, - ObjectIds.ModelChangeStructureDataType_Encoding_DefaultBinary: ModelChangeStructureDataType, - ObjectIds.SemanticChangeStructureDataType_Encoding_DefaultBinary: SemanticChangeStructureDataType, - ObjectIds.Range_Encoding_DefaultBinary: Range, - ObjectIds.EUInformation_Encoding_DefaultBinary: EUInformation, - ObjectIds.ComplexNumberType_Encoding_DefaultBinary: ComplexNumberType, - ObjectIds.DoubleComplexNumberType_Encoding_DefaultBinary: DoubleComplexNumberType, - ObjectIds.AxisInformation_Encoding_DefaultBinary: AxisInformation, - ObjectIds.XVType_Encoding_DefaultBinary: XVType, - ObjectIds.ProgramDiagnosticDataType_Encoding_DefaultBinary: ProgramDiagnosticDataType, - ObjectIds.Annotation_Encoding_DefaultBinary: Annotation, -} - - -def extensionobject_from_binary(data): - """ - Convert binary-coded ExtensionObject to a Python object. - Returns an object, or None if TypeId is zero - """ - TypeId = NodeId.from_binary(data) - Encoding = ord(data.read(1)) - body = None - if Encoding & (1 << 0): - length = uabin.Primitives.Int32.unpack(data) - if length < 1: - body = Buffer(b"") - else: - body = data.copy(length) - data.skip(length) - if TypeId.Identifier == 0: - return None - elif TypeId.Identifier not in ExtensionClasses: - e = ExtensionObject() - e.TypeId = TypeId - e.Encoding = Encoding - if body is not None: - e.Body = body.read(len(body)) - return e - klass = ExtensionClasses[TypeId.Identifier] - if body is None: - raise UaError("parsing ExtensionObject {0} without data".format(klass.__name__)) - return klass.from_binary(body) - - -def extensionobject_to_binary(obj): - """ - Convert Python object to binary-coded ExtensionObject. - If obj is None, convert to empty ExtensionObject (TypeId = 0, no Body). - Returns a binary string - """ - if isinstance(obj, ExtensionObject): - return obj.to_binary() - TypeId = NodeId() - Encoding = 0 - Body = None - if obj is not None: - TypeId = FourByteNodeId(getattr(ObjectIds, "{0}_Encoding_DefaultBinary".format(obj.__class__.__name__))) - Encoding |= (1 << 0) - Body = obj.to_binary() - packet = [] - packet.append(TypeId.to_binary()) - packet.append(uabin.Primitives.UInt8.pack(Encoding)) - if Body: - packet.append(uabin.Primitives.Bytes.pack(Body)) - return b''.join(packet) +nid = NodeId(ObjectIds.TrustListDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = TrustListDataType +extension_object_ids['TrustListDataType'] = nid +nid = NodeId(ObjectIds.Argument_Encoding_DefaultBinary) +extension_object_classes[nid] = Argument +extension_object_ids['Argument'] = nid +nid = NodeId(ObjectIds.EnumValueType_Encoding_DefaultBinary) +extension_object_classes[nid] = EnumValueType +extension_object_ids['EnumValueType'] = nid +nid = NodeId(ObjectIds.OptionSet_Encoding_DefaultBinary) +extension_object_classes[nid] = OptionSet +extension_object_ids['OptionSet'] = nid +nid = NodeId(ObjectIds.Union_Encoding_DefaultBinary) +extension_object_classes[nid] = Union +extension_object_ids['Union'] = nid +nid = NodeId(ObjectIds.TimeZoneDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = TimeZoneDataType +extension_object_ids['TimeZoneDataType'] = nid +nid = NodeId(ObjectIds.ApplicationDescription_Encoding_DefaultBinary) +extension_object_classes[nid] = ApplicationDescription +extension_object_ids['ApplicationDescription'] = nid +nid = NodeId(ObjectIds.RequestHeader_Encoding_DefaultBinary) +extension_object_classes[nid] = RequestHeader +extension_object_ids['RequestHeader'] = nid +nid = NodeId(ObjectIds.ResponseHeader_Encoding_DefaultBinary) +extension_object_classes[nid] = ResponseHeader +extension_object_ids['ResponseHeader'] = nid +nid = NodeId(ObjectIds.ServiceFault_Encoding_DefaultBinary) +extension_object_classes[nid] = ServiceFault +extension_object_ids['ServiceFault'] = nid +nid = NodeId(ObjectIds.FindServersRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = FindServersRequest +extension_object_ids['FindServersRequest'] = nid +nid = NodeId(ObjectIds.FindServersResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = FindServersResponse +extension_object_ids['FindServersResponse'] = nid +nid = NodeId(ObjectIds.ServerOnNetwork_Encoding_DefaultBinary) +extension_object_classes[nid] = ServerOnNetwork +extension_object_ids['ServerOnNetwork'] = nid +nid = NodeId(ObjectIds.FindServersOnNetworkRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = FindServersOnNetworkRequest +extension_object_ids['FindServersOnNetworkRequest'] = nid +nid = NodeId(ObjectIds.FindServersOnNetworkResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = FindServersOnNetworkResponse +extension_object_ids['FindServersOnNetworkResponse'] = nid +nid = NodeId(ObjectIds.UserTokenPolicy_Encoding_DefaultBinary) +extension_object_classes[nid] = UserTokenPolicy +extension_object_ids['UserTokenPolicy'] = nid +nid = NodeId(ObjectIds.EndpointDescription_Encoding_DefaultBinary) +extension_object_classes[nid] = EndpointDescription +extension_object_ids['EndpointDescription'] = nid +nid = NodeId(ObjectIds.GetEndpointsRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = GetEndpointsRequest +extension_object_ids['GetEndpointsRequest'] = nid +nid = NodeId(ObjectIds.GetEndpointsResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = GetEndpointsResponse +extension_object_ids['GetEndpointsResponse'] = nid +nid = NodeId(ObjectIds.RegisteredServer_Encoding_DefaultBinary) +extension_object_classes[nid] = RegisteredServer +extension_object_ids['RegisteredServer'] = nid +nid = NodeId(ObjectIds.RegisterServerRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = RegisterServerRequest +extension_object_ids['RegisterServerRequest'] = nid +nid = NodeId(ObjectIds.RegisterServerResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = RegisterServerResponse +extension_object_ids['RegisterServerResponse'] = nid +nid = NodeId(ObjectIds.DiscoveryConfiguration_Encoding_DefaultBinary) +extension_object_classes[nid] = DiscoveryConfiguration +extension_object_ids['DiscoveryConfiguration'] = nid +nid = NodeId(ObjectIds.MdnsDiscoveryConfiguration_Encoding_DefaultBinary) +extension_object_classes[nid] = MdnsDiscoveryConfiguration +extension_object_ids['MdnsDiscoveryConfiguration'] = nid +nid = NodeId(ObjectIds.RegisterServer2Request_Encoding_DefaultBinary) +extension_object_classes[nid] = RegisterServer2Request +extension_object_ids['RegisterServer2Request'] = nid +nid = NodeId(ObjectIds.RegisterServer2Response_Encoding_DefaultBinary) +extension_object_classes[nid] = RegisterServer2Response +extension_object_ids['RegisterServer2Response'] = nid +nid = NodeId(ObjectIds.ChannelSecurityToken_Encoding_DefaultBinary) +extension_object_classes[nid] = ChannelSecurityToken +extension_object_ids['ChannelSecurityToken'] = nid +nid = NodeId(ObjectIds.OpenSecureChannelRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = OpenSecureChannelRequest +extension_object_ids['OpenSecureChannelRequest'] = nid +nid = NodeId(ObjectIds.OpenSecureChannelResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = OpenSecureChannelResponse +extension_object_ids['OpenSecureChannelResponse'] = nid +nid = NodeId(ObjectIds.CloseSecureChannelRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = CloseSecureChannelRequest +extension_object_ids['CloseSecureChannelRequest'] = nid +nid = NodeId(ObjectIds.CloseSecureChannelResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = CloseSecureChannelResponse +extension_object_ids['CloseSecureChannelResponse'] = nid +nid = NodeId(ObjectIds.SignedSoftwareCertificate_Encoding_DefaultBinary) +extension_object_classes[nid] = SignedSoftwareCertificate +extension_object_ids['SignedSoftwareCertificate'] = nid +nid = NodeId(ObjectIds.SignatureData_Encoding_DefaultBinary) +extension_object_classes[nid] = SignatureData +extension_object_ids['SignatureData'] = nid +nid = NodeId(ObjectIds.CreateSessionRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = CreateSessionRequest +extension_object_ids['CreateSessionRequest'] = nid +nid = NodeId(ObjectIds.CreateSessionResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = CreateSessionResponse +extension_object_ids['CreateSessionResponse'] = nid +nid = NodeId(ObjectIds.UserIdentityToken_Encoding_DefaultBinary) +extension_object_classes[nid] = UserIdentityToken +extension_object_ids['UserIdentityToken'] = nid +nid = NodeId(ObjectIds.AnonymousIdentityToken_Encoding_DefaultBinary) +extension_object_classes[nid] = AnonymousIdentityToken +extension_object_ids['AnonymousIdentityToken'] = nid +nid = NodeId(ObjectIds.UserNameIdentityToken_Encoding_DefaultBinary) +extension_object_classes[nid] = UserNameIdentityToken +extension_object_ids['UserNameIdentityToken'] = nid +nid = NodeId(ObjectIds.X509IdentityToken_Encoding_DefaultBinary) +extension_object_classes[nid] = X509IdentityToken +extension_object_ids['X509IdentityToken'] = nid +nid = NodeId(ObjectIds.KerberosIdentityToken_Encoding_DefaultBinary) +extension_object_classes[nid] = KerberosIdentityToken +extension_object_ids['KerberosIdentityToken'] = nid +nid = NodeId(ObjectIds.IssuedIdentityToken_Encoding_DefaultBinary) +extension_object_classes[nid] = IssuedIdentityToken +extension_object_ids['IssuedIdentityToken'] = nid +nid = NodeId(ObjectIds.ActivateSessionRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = ActivateSessionRequest +extension_object_ids['ActivateSessionRequest'] = nid +nid = NodeId(ObjectIds.ActivateSessionResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = ActivateSessionResponse +extension_object_ids['ActivateSessionResponse'] = nid +nid = NodeId(ObjectIds.CloseSessionRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = CloseSessionRequest +extension_object_ids['CloseSessionRequest'] = nid +nid = NodeId(ObjectIds.CloseSessionResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = CloseSessionResponse +extension_object_ids['CloseSessionResponse'] = nid +nid = NodeId(ObjectIds.CancelRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = CancelRequest +extension_object_ids['CancelRequest'] = nid +nid = NodeId(ObjectIds.CancelResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = CancelResponse +extension_object_ids['CancelResponse'] = nid +nid = NodeId(ObjectIds.NodeAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = NodeAttributes +extension_object_ids['NodeAttributes'] = nid +nid = NodeId(ObjectIds.ObjectAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = ObjectAttributes +extension_object_ids['ObjectAttributes'] = nid +nid = NodeId(ObjectIds.VariableAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = VariableAttributes +extension_object_ids['VariableAttributes'] = nid +nid = NodeId(ObjectIds.MethodAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = MethodAttributes +extension_object_ids['MethodAttributes'] = nid +nid = NodeId(ObjectIds.ObjectTypeAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = ObjectTypeAttributes +extension_object_ids['ObjectTypeAttributes'] = nid +nid = NodeId(ObjectIds.VariableTypeAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = VariableTypeAttributes +extension_object_ids['VariableTypeAttributes'] = nid +nid = NodeId(ObjectIds.ReferenceTypeAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = ReferenceTypeAttributes +extension_object_ids['ReferenceTypeAttributes'] = nid +nid = NodeId(ObjectIds.DataTypeAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = DataTypeAttributes +extension_object_ids['DataTypeAttributes'] = nid +nid = NodeId(ObjectIds.ViewAttributes_Encoding_DefaultBinary) +extension_object_classes[nid] = ViewAttributes +extension_object_ids['ViewAttributes'] = nid +nid = NodeId(ObjectIds.AddNodesItem_Encoding_DefaultBinary) +extension_object_classes[nid] = AddNodesItem +extension_object_ids['AddNodesItem'] = nid +nid = NodeId(ObjectIds.AddNodesResult_Encoding_DefaultBinary) +extension_object_classes[nid] = AddNodesResult +extension_object_ids['AddNodesResult'] = nid +nid = NodeId(ObjectIds.AddNodesRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = AddNodesRequest +extension_object_ids['AddNodesRequest'] = nid +nid = NodeId(ObjectIds.AddNodesResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = AddNodesResponse +extension_object_ids['AddNodesResponse'] = nid +nid = NodeId(ObjectIds.AddReferencesItem_Encoding_DefaultBinary) +extension_object_classes[nid] = AddReferencesItem +extension_object_ids['AddReferencesItem'] = nid +nid = NodeId(ObjectIds.AddReferencesRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = AddReferencesRequest +extension_object_ids['AddReferencesRequest'] = nid +nid = NodeId(ObjectIds.AddReferencesResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = AddReferencesResponse +extension_object_ids['AddReferencesResponse'] = nid +nid = NodeId(ObjectIds.DeleteNodesItem_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteNodesItem +extension_object_ids['DeleteNodesItem'] = nid +nid = NodeId(ObjectIds.DeleteNodesRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteNodesRequest +extension_object_ids['DeleteNodesRequest'] = nid +nid = NodeId(ObjectIds.DeleteNodesResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteNodesResponse +extension_object_ids['DeleteNodesResponse'] = nid +nid = NodeId(ObjectIds.DeleteReferencesItem_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteReferencesItem +extension_object_ids['DeleteReferencesItem'] = nid +nid = NodeId(ObjectIds.DeleteReferencesRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteReferencesRequest +extension_object_ids['DeleteReferencesRequest'] = nid +nid = NodeId(ObjectIds.DeleteReferencesResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteReferencesResponse +extension_object_ids['DeleteReferencesResponse'] = nid +nid = NodeId(ObjectIds.ViewDescription_Encoding_DefaultBinary) +extension_object_classes[nid] = ViewDescription +extension_object_ids['ViewDescription'] = nid +nid = NodeId(ObjectIds.BrowseDescription_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowseDescription +extension_object_ids['BrowseDescription'] = nid +nid = NodeId(ObjectIds.ReferenceDescription_Encoding_DefaultBinary) +extension_object_classes[nid] = ReferenceDescription +extension_object_ids['ReferenceDescription'] = nid +nid = NodeId(ObjectIds.BrowseResult_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowseResult +extension_object_ids['BrowseResult'] = nid +nid = NodeId(ObjectIds.BrowseRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowseRequest +extension_object_ids['BrowseRequest'] = nid +nid = NodeId(ObjectIds.BrowseResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowseResponse +extension_object_ids['BrowseResponse'] = nid +nid = NodeId(ObjectIds.BrowseNextRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowseNextRequest +extension_object_ids['BrowseNextRequest'] = nid +nid = NodeId(ObjectIds.BrowseNextResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowseNextResponse +extension_object_ids['BrowseNextResponse'] = nid +nid = NodeId(ObjectIds.RelativePathElement_Encoding_DefaultBinary) +extension_object_classes[nid] = RelativePathElement +extension_object_ids['RelativePathElement'] = nid +nid = NodeId(ObjectIds.RelativePath_Encoding_DefaultBinary) +extension_object_classes[nid] = RelativePath +extension_object_ids['RelativePath'] = nid +nid = NodeId(ObjectIds.BrowsePath_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowsePath +extension_object_ids['BrowsePath'] = nid +nid = NodeId(ObjectIds.BrowsePathTarget_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowsePathTarget +extension_object_ids['BrowsePathTarget'] = nid +nid = NodeId(ObjectIds.BrowsePathResult_Encoding_DefaultBinary) +extension_object_classes[nid] = BrowsePathResult +extension_object_ids['BrowsePathResult'] = nid +nid = NodeId(ObjectIds.TranslateBrowsePathsToNodeIdsRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = TranslateBrowsePathsToNodeIdsRequest +extension_object_ids['TranslateBrowsePathsToNodeIdsRequest'] = nid +nid = NodeId(ObjectIds.TranslateBrowsePathsToNodeIdsResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = TranslateBrowsePathsToNodeIdsResponse +extension_object_ids['TranslateBrowsePathsToNodeIdsResponse'] = nid +nid = NodeId(ObjectIds.RegisterNodesRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = RegisterNodesRequest +extension_object_ids['RegisterNodesRequest'] = nid +nid = NodeId(ObjectIds.RegisterNodesResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = RegisterNodesResponse +extension_object_ids['RegisterNodesResponse'] = nid +nid = NodeId(ObjectIds.UnregisterNodesRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = UnregisterNodesRequest +extension_object_ids['UnregisterNodesRequest'] = nid +nid = NodeId(ObjectIds.UnregisterNodesResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = UnregisterNodesResponse +extension_object_ids['UnregisterNodesResponse'] = nid +nid = NodeId(ObjectIds.EndpointConfiguration_Encoding_DefaultBinary) +extension_object_classes[nid] = EndpointConfiguration +extension_object_ids['EndpointConfiguration'] = nid +nid = NodeId(ObjectIds.SupportedProfile_Encoding_DefaultBinary) +extension_object_classes[nid] = SupportedProfile +extension_object_ids['SupportedProfile'] = nid +nid = NodeId(ObjectIds.SoftwareCertificate_Encoding_DefaultBinary) +extension_object_classes[nid] = SoftwareCertificate +extension_object_ids['SoftwareCertificate'] = nid +nid = NodeId(ObjectIds.QueryDataDescription_Encoding_DefaultBinary) +extension_object_classes[nid] = QueryDataDescription +extension_object_ids['QueryDataDescription'] = nid +nid = NodeId(ObjectIds.NodeTypeDescription_Encoding_DefaultBinary) +extension_object_classes[nid] = NodeTypeDescription +extension_object_ids['NodeTypeDescription'] = nid +nid = NodeId(ObjectIds.QueryDataSet_Encoding_DefaultBinary) +extension_object_classes[nid] = QueryDataSet +extension_object_ids['QueryDataSet'] = nid +nid = NodeId(ObjectIds.NodeReference_Encoding_DefaultBinary) +extension_object_classes[nid] = NodeReference +extension_object_ids['NodeReference'] = nid +nid = NodeId(ObjectIds.ContentFilterElement_Encoding_DefaultBinary) +extension_object_classes[nid] = ContentFilterElement +extension_object_ids['ContentFilterElement'] = nid +nid = NodeId(ObjectIds.ContentFilter_Encoding_DefaultBinary) +extension_object_classes[nid] = ContentFilter +extension_object_ids['ContentFilter'] = nid +nid = NodeId(ObjectIds.ElementOperand_Encoding_DefaultBinary) +extension_object_classes[nid] = ElementOperand +extension_object_ids['ElementOperand'] = nid +nid = NodeId(ObjectIds.LiteralOperand_Encoding_DefaultBinary) +extension_object_classes[nid] = LiteralOperand +extension_object_ids['LiteralOperand'] = nid +nid = NodeId(ObjectIds.AttributeOperand_Encoding_DefaultBinary) +extension_object_classes[nid] = AttributeOperand +extension_object_ids['AttributeOperand'] = nid +nid = NodeId(ObjectIds.SimpleAttributeOperand_Encoding_DefaultBinary) +extension_object_classes[nid] = SimpleAttributeOperand +extension_object_ids['SimpleAttributeOperand'] = nid +nid = NodeId(ObjectIds.ContentFilterElementResult_Encoding_DefaultBinary) +extension_object_classes[nid] = ContentFilterElementResult +extension_object_ids['ContentFilterElementResult'] = nid +nid = NodeId(ObjectIds.ContentFilterResult_Encoding_DefaultBinary) +extension_object_classes[nid] = ContentFilterResult +extension_object_ids['ContentFilterResult'] = nid +nid = NodeId(ObjectIds.ParsingResult_Encoding_DefaultBinary) +extension_object_classes[nid] = ParsingResult +extension_object_ids['ParsingResult'] = nid +nid = NodeId(ObjectIds.QueryFirstRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = QueryFirstRequest +extension_object_ids['QueryFirstRequest'] = nid +nid = NodeId(ObjectIds.QueryFirstResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = QueryFirstResponse +extension_object_ids['QueryFirstResponse'] = nid +nid = NodeId(ObjectIds.QueryNextRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = QueryNextRequest +extension_object_ids['QueryNextRequest'] = nid +nid = NodeId(ObjectIds.QueryNextResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = QueryNextResponse +extension_object_ids['QueryNextResponse'] = nid +nid = NodeId(ObjectIds.ReadValueId_Encoding_DefaultBinary) +extension_object_classes[nid] = ReadValueId +extension_object_ids['ReadValueId'] = nid +nid = NodeId(ObjectIds.ReadRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = ReadRequest +extension_object_ids['ReadRequest'] = nid +nid = NodeId(ObjectIds.ReadResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = ReadResponse +extension_object_ids['ReadResponse'] = nid +nid = NodeId(ObjectIds.HistoryReadValueId_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryReadValueId +extension_object_ids['HistoryReadValueId'] = nid +nid = NodeId(ObjectIds.HistoryReadResult_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryReadResult +extension_object_ids['HistoryReadResult'] = nid +nid = NodeId(ObjectIds.HistoryReadDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryReadDetails +extension_object_ids['HistoryReadDetails'] = nid +nid = NodeId(ObjectIds.ReadEventDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = ReadEventDetails +extension_object_ids['ReadEventDetails'] = nid +nid = NodeId(ObjectIds.ReadRawModifiedDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = ReadRawModifiedDetails +extension_object_ids['ReadRawModifiedDetails'] = nid +nid = NodeId(ObjectIds.ReadProcessedDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = ReadProcessedDetails +extension_object_ids['ReadProcessedDetails'] = nid +nid = NodeId(ObjectIds.ReadAtTimeDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = ReadAtTimeDetails +extension_object_ids['ReadAtTimeDetails'] = nid +nid = NodeId(ObjectIds.HistoryData_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryData +extension_object_ids['HistoryData'] = nid +nid = NodeId(ObjectIds.ModificationInfo_Encoding_DefaultBinary) +extension_object_classes[nid] = ModificationInfo +extension_object_ids['ModificationInfo'] = nid +nid = NodeId(ObjectIds.HistoryModifiedData_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryModifiedData +extension_object_ids['HistoryModifiedData'] = nid +nid = NodeId(ObjectIds.HistoryEvent_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryEvent +extension_object_ids['HistoryEvent'] = nid +nid = NodeId(ObjectIds.HistoryReadRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryReadRequest +extension_object_ids['HistoryReadRequest'] = nid +nid = NodeId(ObjectIds.HistoryReadResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryReadResponse +extension_object_ids['HistoryReadResponse'] = nid +nid = NodeId(ObjectIds.WriteValue_Encoding_DefaultBinary) +extension_object_classes[nid] = WriteValue +extension_object_ids['WriteValue'] = nid +nid = NodeId(ObjectIds.WriteRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = WriteRequest +extension_object_ids['WriteRequest'] = nid +nid = NodeId(ObjectIds.WriteResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = WriteResponse +extension_object_ids['WriteResponse'] = nid +nid = NodeId(ObjectIds.HistoryUpdateDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryUpdateDetails +extension_object_ids['HistoryUpdateDetails'] = nid +nid = NodeId(ObjectIds.UpdateDataDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = UpdateDataDetails +extension_object_ids['UpdateDataDetails'] = nid +nid = NodeId(ObjectIds.UpdateStructureDataDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = UpdateStructureDataDetails +extension_object_ids['UpdateStructureDataDetails'] = nid +nid = NodeId(ObjectIds.UpdateEventDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = UpdateEventDetails +extension_object_ids['UpdateEventDetails'] = nid +nid = NodeId(ObjectIds.DeleteRawModifiedDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteRawModifiedDetails +extension_object_ids['DeleteRawModifiedDetails'] = nid +nid = NodeId(ObjectIds.DeleteAtTimeDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteAtTimeDetails +extension_object_ids['DeleteAtTimeDetails'] = nid +nid = NodeId(ObjectIds.DeleteEventDetails_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteEventDetails +extension_object_ids['DeleteEventDetails'] = nid +nid = NodeId(ObjectIds.HistoryUpdateResult_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryUpdateResult +extension_object_ids['HistoryUpdateResult'] = nid +nid = NodeId(ObjectIds.HistoryUpdateRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryUpdateRequest +extension_object_ids['HistoryUpdateRequest'] = nid +nid = NodeId(ObjectIds.HistoryUpdateResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryUpdateResponse +extension_object_ids['HistoryUpdateResponse'] = nid +nid = NodeId(ObjectIds.CallMethodRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = CallMethodRequest +extension_object_ids['CallMethodRequest'] = nid +nid = NodeId(ObjectIds.CallMethodResult_Encoding_DefaultBinary) +extension_object_classes[nid] = CallMethodResult +extension_object_ids['CallMethodResult'] = nid +nid = NodeId(ObjectIds.CallRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = CallRequest +extension_object_ids['CallRequest'] = nid +nid = NodeId(ObjectIds.CallResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = CallResponse +extension_object_ids['CallResponse'] = nid +nid = NodeId(ObjectIds.MonitoringFilter_Encoding_DefaultBinary) +extension_object_classes[nid] = MonitoringFilter +extension_object_ids['MonitoringFilter'] = nid +nid = NodeId(ObjectIds.DataChangeFilter_Encoding_DefaultBinary) +extension_object_classes[nid] = DataChangeFilter +extension_object_ids['DataChangeFilter'] = nid +nid = NodeId(ObjectIds.EventFilter_Encoding_DefaultBinary) +extension_object_classes[nid] = EventFilter +extension_object_ids['EventFilter'] = nid +nid = NodeId(ObjectIds.AggregateConfiguration_Encoding_DefaultBinary) +extension_object_classes[nid] = AggregateConfiguration +extension_object_ids['AggregateConfiguration'] = nid +nid = NodeId(ObjectIds.AggregateFilter_Encoding_DefaultBinary) +extension_object_classes[nid] = AggregateFilter +extension_object_ids['AggregateFilter'] = nid +nid = NodeId(ObjectIds.MonitoringFilterResult_Encoding_DefaultBinary) +extension_object_classes[nid] = MonitoringFilterResult +extension_object_ids['MonitoringFilterResult'] = nid +nid = NodeId(ObjectIds.EventFilterResult_Encoding_DefaultBinary) +extension_object_classes[nid] = EventFilterResult +extension_object_ids['EventFilterResult'] = nid +nid = NodeId(ObjectIds.AggregateFilterResult_Encoding_DefaultBinary) +extension_object_classes[nid] = AggregateFilterResult +extension_object_ids['AggregateFilterResult'] = nid +nid = NodeId(ObjectIds.MonitoringParameters_Encoding_DefaultBinary) +extension_object_classes[nid] = MonitoringParameters +extension_object_ids['MonitoringParameters'] = nid +nid = NodeId(ObjectIds.MonitoredItemCreateRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = MonitoredItemCreateRequest +extension_object_ids['MonitoredItemCreateRequest'] = nid +nid = NodeId(ObjectIds.MonitoredItemCreateResult_Encoding_DefaultBinary) +extension_object_classes[nid] = MonitoredItemCreateResult +extension_object_ids['MonitoredItemCreateResult'] = nid +nid = NodeId(ObjectIds.CreateMonitoredItemsRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = CreateMonitoredItemsRequest +extension_object_ids['CreateMonitoredItemsRequest'] = nid +nid = NodeId(ObjectIds.CreateMonitoredItemsResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = CreateMonitoredItemsResponse +extension_object_ids['CreateMonitoredItemsResponse'] = nid +nid = NodeId(ObjectIds.MonitoredItemModifyRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = MonitoredItemModifyRequest +extension_object_ids['MonitoredItemModifyRequest'] = nid +nid = NodeId(ObjectIds.MonitoredItemModifyResult_Encoding_DefaultBinary) +extension_object_classes[nid] = MonitoredItemModifyResult +extension_object_ids['MonitoredItemModifyResult'] = nid +nid = NodeId(ObjectIds.ModifyMonitoredItemsRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = ModifyMonitoredItemsRequest +extension_object_ids['ModifyMonitoredItemsRequest'] = nid +nid = NodeId(ObjectIds.ModifyMonitoredItemsResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = ModifyMonitoredItemsResponse +extension_object_ids['ModifyMonitoredItemsResponse'] = nid +nid = NodeId(ObjectIds.SetMonitoringModeRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = SetMonitoringModeRequest +extension_object_ids['SetMonitoringModeRequest'] = nid +nid = NodeId(ObjectIds.SetMonitoringModeResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = SetMonitoringModeResponse +extension_object_ids['SetMonitoringModeResponse'] = nid +nid = NodeId(ObjectIds.SetTriggeringRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = SetTriggeringRequest +extension_object_ids['SetTriggeringRequest'] = nid +nid = NodeId(ObjectIds.SetTriggeringResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = SetTriggeringResponse +extension_object_ids['SetTriggeringResponse'] = nid +nid = NodeId(ObjectIds.DeleteMonitoredItemsRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteMonitoredItemsRequest +extension_object_ids['DeleteMonitoredItemsRequest'] = nid +nid = NodeId(ObjectIds.DeleteMonitoredItemsResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteMonitoredItemsResponse +extension_object_ids['DeleteMonitoredItemsResponse'] = nid +nid = NodeId(ObjectIds.CreateSubscriptionRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = CreateSubscriptionRequest +extension_object_ids['CreateSubscriptionRequest'] = nid +nid = NodeId(ObjectIds.CreateSubscriptionResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = CreateSubscriptionResponse +extension_object_ids['CreateSubscriptionResponse'] = nid +nid = NodeId(ObjectIds.ModifySubscriptionRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = ModifySubscriptionRequest +extension_object_ids['ModifySubscriptionRequest'] = nid +nid = NodeId(ObjectIds.ModifySubscriptionResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = ModifySubscriptionResponse +extension_object_ids['ModifySubscriptionResponse'] = nid +nid = NodeId(ObjectIds.SetPublishingModeRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = SetPublishingModeRequest +extension_object_ids['SetPublishingModeRequest'] = nid +nid = NodeId(ObjectIds.SetPublishingModeResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = SetPublishingModeResponse +extension_object_ids['SetPublishingModeResponse'] = nid +nid = NodeId(ObjectIds.NotificationMessage_Encoding_DefaultBinary) +extension_object_classes[nid] = NotificationMessage +extension_object_ids['NotificationMessage'] = nid +nid = NodeId(ObjectIds.NotificationData_Encoding_DefaultBinary) +extension_object_classes[nid] = NotificationData +extension_object_ids['NotificationData'] = nid +nid = NodeId(ObjectIds.DataChangeNotification_Encoding_DefaultBinary) +extension_object_classes[nid] = DataChangeNotification +extension_object_ids['DataChangeNotification'] = nid +nid = NodeId(ObjectIds.MonitoredItemNotification_Encoding_DefaultBinary) +extension_object_classes[nid] = MonitoredItemNotification +extension_object_ids['MonitoredItemNotification'] = nid +nid = NodeId(ObjectIds.EventNotificationList_Encoding_DefaultBinary) +extension_object_classes[nid] = EventNotificationList +extension_object_ids['EventNotificationList'] = nid +nid = NodeId(ObjectIds.EventFieldList_Encoding_DefaultBinary) +extension_object_classes[nid] = EventFieldList +extension_object_ids['EventFieldList'] = nid +nid = NodeId(ObjectIds.HistoryEventFieldList_Encoding_DefaultBinary) +extension_object_classes[nid] = HistoryEventFieldList +extension_object_ids['HistoryEventFieldList'] = nid +nid = NodeId(ObjectIds.StatusChangeNotification_Encoding_DefaultBinary) +extension_object_classes[nid] = StatusChangeNotification +extension_object_ids['StatusChangeNotification'] = nid +nid = NodeId(ObjectIds.SubscriptionAcknowledgement_Encoding_DefaultBinary) +extension_object_classes[nid] = SubscriptionAcknowledgement +extension_object_ids['SubscriptionAcknowledgement'] = nid +nid = NodeId(ObjectIds.PublishRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = PublishRequest +extension_object_ids['PublishRequest'] = nid +nid = NodeId(ObjectIds.PublishResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = PublishResponse +extension_object_ids['PublishResponse'] = nid +nid = NodeId(ObjectIds.RepublishRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = RepublishRequest +extension_object_ids['RepublishRequest'] = nid +nid = NodeId(ObjectIds.RepublishResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = RepublishResponse +extension_object_ids['RepublishResponse'] = nid +nid = NodeId(ObjectIds.TransferResult_Encoding_DefaultBinary) +extension_object_classes[nid] = TransferResult +extension_object_ids['TransferResult'] = nid +nid = NodeId(ObjectIds.TransferSubscriptionsRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = TransferSubscriptionsRequest +extension_object_ids['TransferSubscriptionsRequest'] = nid +nid = NodeId(ObjectIds.TransferSubscriptionsResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = TransferSubscriptionsResponse +extension_object_ids['TransferSubscriptionsResponse'] = nid +nid = NodeId(ObjectIds.DeleteSubscriptionsRequest_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteSubscriptionsRequest +extension_object_ids['DeleteSubscriptionsRequest'] = nid +nid = NodeId(ObjectIds.DeleteSubscriptionsResponse_Encoding_DefaultBinary) +extension_object_classes[nid] = DeleteSubscriptionsResponse +extension_object_ids['DeleteSubscriptionsResponse'] = nid +nid = NodeId(ObjectIds.BuildInfo_Encoding_DefaultBinary) +extension_object_classes[nid] = BuildInfo +extension_object_ids['BuildInfo'] = nid +nid = NodeId(ObjectIds.RedundantServerDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = RedundantServerDataType +extension_object_ids['RedundantServerDataType'] = nid +nid = NodeId(ObjectIds.EndpointUrlListDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = EndpointUrlListDataType +extension_object_ids['EndpointUrlListDataType'] = nid +nid = NodeId(ObjectIds.NetworkGroupDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = NetworkGroupDataType +extension_object_ids['NetworkGroupDataType'] = nid +nid = NodeId(ObjectIds.SamplingIntervalDiagnosticsDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = SamplingIntervalDiagnosticsDataType +extension_object_ids['SamplingIntervalDiagnosticsDataType'] = nid +nid = NodeId(ObjectIds.ServerDiagnosticsSummaryDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = ServerDiagnosticsSummaryDataType +extension_object_ids['ServerDiagnosticsSummaryDataType'] = nid +nid = NodeId(ObjectIds.ServerStatusDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = ServerStatusDataType +extension_object_ids['ServerStatusDataType'] = nid +nid = NodeId(ObjectIds.SessionDiagnosticsDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = SessionDiagnosticsDataType +extension_object_ids['SessionDiagnosticsDataType'] = nid +nid = NodeId(ObjectIds.SessionSecurityDiagnosticsDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = SessionSecurityDiagnosticsDataType +extension_object_ids['SessionSecurityDiagnosticsDataType'] = nid +nid = NodeId(ObjectIds.ServiceCounterDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = ServiceCounterDataType +extension_object_ids['ServiceCounterDataType'] = nid +nid = NodeId(ObjectIds.StatusResult_Encoding_DefaultBinary) +extension_object_classes[nid] = StatusResult +extension_object_ids['StatusResult'] = nid +nid = NodeId(ObjectIds.SubscriptionDiagnosticsDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = SubscriptionDiagnosticsDataType +extension_object_ids['SubscriptionDiagnosticsDataType'] = nid +nid = NodeId(ObjectIds.ModelChangeStructureDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = ModelChangeStructureDataType +extension_object_ids['ModelChangeStructureDataType'] = nid +nid = NodeId(ObjectIds.SemanticChangeStructureDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = SemanticChangeStructureDataType +extension_object_ids['SemanticChangeStructureDataType'] = nid +nid = NodeId(ObjectIds.Range_Encoding_DefaultBinary) +extension_object_classes[nid] = Range +extension_object_ids['Range'] = nid +nid = NodeId(ObjectIds.EUInformation_Encoding_DefaultBinary) +extension_object_classes[nid] = EUInformation +extension_object_ids['EUInformation'] = nid +nid = NodeId(ObjectIds.ComplexNumberType_Encoding_DefaultBinary) +extension_object_classes[nid] = ComplexNumberType +extension_object_ids['ComplexNumberType'] = nid +nid = NodeId(ObjectIds.DoubleComplexNumberType_Encoding_DefaultBinary) +extension_object_classes[nid] = DoubleComplexNumberType +extension_object_ids['DoubleComplexNumberType'] = nid +nid = NodeId(ObjectIds.AxisInformation_Encoding_DefaultBinary) +extension_object_classes[nid] = AxisInformation +extension_object_ids['AxisInformation'] = nid +nid = NodeId(ObjectIds.XVType_Encoding_DefaultBinary) +extension_object_classes[nid] = XVType +extension_object_ids['XVType'] = nid +nid = NodeId(ObjectIds.ProgramDiagnosticDataType_Encoding_DefaultBinary) +extension_object_classes[nid] = ProgramDiagnosticDataType +extension_object_ids['ProgramDiagnosticDataType'] = nid +nid = NodeId(ObjectIds.Annotation_Encoding_DefaultBinary) +extension_object_classes[nid] = Annotation +extension_object_ids['Annotation'] = nid diff --git a/opcua/ua/uatypes.py b/opcua/ua/uatypes.py index ee1a6e36b..b5a2177c2 100644 --- a/opcua/ua/uatypes.py +++ b/opcua/ua/uatypes.py @@ -16,6 +16,7 @@ from opcua.ua.uaerrors import UaError from opcua.ua.uaerrors import UaStatusCodeError from opcua.ua.uaerrors import UaStringParsingError +from opcua.common.utils import Buffer if sys.version_info.major > 2: @@ -1099,3 +1100,62 @@ def get_default_value(vtype): raise RuntimeError("function take a uatype as argument, got:", vtype) +# These dictionnaries are used to register extensions classes for automatic +# decoding and encoding +extension_object_classes = {} +extension_object_ids = {} + + +def extensionobject_from_binary(data): + """ + Convert binary-coded ExtensionObject to a Python object. + Returns an object, or None if TypeId is zero + """ + TypeId = NodeId.from_binary(data) + Encoding = ord(data.read(1)) + body = None + if Encoding & (1 << 0): + length = uabin.Primitives.Int32.unpack(data) + if length < 1: + body = Buffer(b"") + else: + body = data.copy(length) + data.skip(length) + if TypeId.Identifier == 0: + return None + elif TypeId in extension_object_classes: + klass = extension_object_classes[TypeId] + if body is None: + raise UaError("parsing ExtensionObject {0} without data".format(klass.__name__)) + return klass.from_binary(body) + else: + e = ExtensionObject() + e.TypeId = TypeId + e.Encoding = Encoding + if body is not None: + e.Body = body.read(len(body)) + return e + + +def extensionobject_to_binary(obj): + """ + Convert Python object to binary-coded ExtensionObject. + If obj is None, convert to empty ExtensionObject (TypeId = 0, no Body). + Returns a binary string + """ + if isinstance(obj, ExtensionObject): + return obj.to_binary() + if obj is None: + TypeId = NodeId() + Encoding = 0 + Body = None + else: + TypeId = extension_object_ids[obj.__class__.__name__] + Encoding = 0x01 + Body = obj.to_binary() + packet = [] + packet.append(TypeId.to_binary()) + packet.append(uabin.Primitives.UInt8.pack(Encoding)) + if Body: + packet.append(uabin.Primitives.Bytes.pack(Body)) + return b''.join(packet) diff --git a/schemas/generate_protocol_python.py b/schemas/generate_protocol_python.py index 367ada199..b9103e7f3 100644 --- a/schemas/generate_protocol_python.py +++ b/schemas/generate_protocol_python.py @@ -54,19 +54,15 @@ def run(self): self.iidx = 0 self.write("") self.write("") - self.write("ExtensionClasses = {") for struct in self.model.structs: if struct.name in IgnoredStructs: continue if struct.name.endswith("Node") or struct.name.endswith("NodeId"): continue if "ExtensionObject" in struct.parents: - self.write(" ObjectIds.{0}_Encoding_DefaultBinary: {0},".format(struct.name)) - self.write("}") - self.write("") - with open('uaprotocol_auto_add.py') as f: - for line in f: - self.write(line.rstrip()) + self.write("nid = NodeId(ObjectIds.{0}_Encoding_DefaultBinary)".format(struct.name)) + self.write("extension_object_classes[nid] = {0}".format(struct.name)) + self.write("extension_object_ids['{0}'] = nid".format(struct.name)) def write(self, line): if line: @@ -79,10 +75,9 @@ def make_header(self): self.write("'''") self.write("") self.write("from datetime import datetime") - self.write("from enum import Enum, IntEnum") + self.write("from enum import IntEnum") self.write("") - self.write("from opcua.common.utils import Buffer") - self.write("from opcua.ua.uaerrors import UaError") + #self.write("from opcua.ua.uaerrors import UaError") self.write("from opcua.ua.uatypes import *") self.write("from opcua.ua import ua_binary as uabin") self.write("from opcua.ua.object_ids import ObjectIds")