Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a new setting MessageTransportMode which enables the user to decide if DataEfficiency or TimeCriticality is important #2882

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Libraries/Opc.Ua.Client/Session/Session.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* ========================================================================
* Copyright (c) 2005-2020 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -1045,7 +1045,7 @@ public static async Task<ITransportChannel> CreateChannelAsync(
ITransportChannel channel;
if (connection != null)
{
channel = SessionChannel.CreateUaBinaryChannel(
channel = UaChannelBase.CreateUaBinaryChannel(
configuration,
connection,
endpointDescription,
Expand Down Expand Up @@ -1408,7 +1408,7 @@ public SessionConfiguration SaveSessionConfiguration(Stream stream = null)
{

Nonce serverNonce = Nonce.CreateNonce(m_endpoint.Description?.SecurityPolicyUri, m_serverNonce);

var sessionConfiguration = new SessionConfiguration(this, serverNonce, m_userTokenSecurityPolicyUri, m_eccServerEphemeralKey, AuthenticationToken);

if (stream != null)
Expand Down Expand Up @@ -6671,6 +6671,7 @@ protected virtual void ProcessResponseAdditionalHeader(ResponseHeader responseHe
private ContinuationPointPolicy m_continuationPointPolicy
= ContinuationPointPolicy.Default;


private class AsyncRequestState
{
public uint RequestTypeId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2005-2021 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
Expand All @@ -11,7 +11,7 @@
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Expand Down Expand Up @@ -917,6 +917,13 @@ public IApplicationConfigurationBuilderClientOptions SetClientOperationLimits(Op
return this;
}

/// <inheritdoc/>
public IApplicationConfigurationBuilderClientOptions SetClientMessageTransportMode(MessageTransportMode messageTransportMode)
{
ApplicationConfiguration.ClientConfiguration.MessageTransportMode = messageTransportMode;
return this;
}

/// <inheritdoc/>
public IApplicationConfigurationBuilderTraceConfiguration SetOutputFilePath(string outputFilePath)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2005-2021 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
Expand All @@ -11,7 +11,7 @@
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Expand Down Expand Up @@ -313,6 +313,9 @@ public interface IApplicationConfigurationBuilderClientOptions :

/// <inheritdoc cref="ClientConfiguration.OperationLimits"/>
IApplicationConfigurationBuilderClientOptions SetClientOperationLimits(OperationLimits operationLimits);

/// <inheritdoc cref="ClientConfiguration.MessageTransportMode"/>
IApplicationConfigurationBuilderClientOptions SetClientMessageTransportMode(MessageTransportMode messageTransportMode);
}

/// <summary>
Expand Down Expand Up @@ -423,7 +426,7 @@ IApplicationConfigurationBuilderSecurityOptions AddSecurityConfiguration(
string appRoot = null,
string rejectedRoot = null
);

/// <summary>
/// Add the security configuration.
/// </summary>
Expand Down
74 changes: 55 additions & 19 deletions Stack/Opc.Ua.Core/Schema/ApplicationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public TraceConfiguration TraceConfiguration
}

/// <summary>
/// Disabling / enabling high resolution clock
/// Disabling / enabling high resolution clock
/// </summary>
/// <value><c>true</c> if high resolution clock is disabled; otherwise, <c>false</c>.</value>
[DataMember(IsRequired = false, EmitDefaultValue = false, Order = 12)]
Expand Down Expand Up @@ -416,7 +416,7 @@ public int MaxEncodingNestingLevels
}

/// <summary>
/// The number of times the decoder can recover from a decoder error
/// The number of times the decoder can recover from a decoder error
/// of an IEncodeable before throwing a decoder error.
/// </summary>
[DataMember(IsRequired = false, Order = 7)]
Expand Down Expand Up @@ -521,7 +521,7 @@ public bool DeleteOnLoad
}

/// <summary>
/// The masks used to select what is written to the output
/// The masks used to select what is written to the output
/// Masks supported by the trace feature:
/// - Do not output any messages -None = 0x0;
/// - Output error messages - Error = 0x1;
Expand Down Expand Up @@ -599,9 +599,9 @@ public string UriScheme
/// </summary>
/// <value>The name of the type.</value>
/// <remarks>
/// This can be any instance of the System.ServiceModel.Channels.Binding class
/// This can be any instance of the System.ServiceModel.Channels.Binding class
/// that implements these constructors:
///
///
/// XxxBinding(EndpointDescription description, EndpointConfiguration configuration);
/// XxxBinding(IList{EndpointDescription} descriptions, EndpointConfiguration configuration)
/// XxxBinding(EndpointConfiguration configuration)
Expand Down Expand Up @@ -929,7 +929,7 @@ public int NonceLength
/// <summary>
/// A store where invalid certificates can be placed for later review by the administrator.
/// </summary>
/// <value>
/// <value>
/// A store where invalid certificates can be placed for later review by the administrator.
/// </value>
[DataMember(IsRequired = false, EmitDefaultValue = false, Order = 7)]
Expand Down Expand Up @@ -1178,7 +1178,7 @@ public bool IsDeprecatedConfiguration

#endregion

#region Private Fields
#region Private Fields
private CertificateIdentifierCollection m_applicationCertificates;
private CertificateTrustList m_trustedIssuerCertificates;
private CertificateTrustList m_trustedPeerCertificates;
Expand Down Expand Up @@ -1944,7 +1944,7 @@ public int ShutdownDelay

/// <summary>
/// The server capabilities.
/// The latest set of server capabilities is listed
/// The latest set of server capabilities is listed
/// <see href="http://www.opcfoundation.org/UA/schemas/1.05/ServerCapabilities.csv">here.</see>
/// </summary>
/// <value>The array of server capabilites.</value>
Expand Down Expand Up @@ -2499,6 +2499,17 @@ public OperationLimits OperationLimits
get { return m_operationLimits; }
set { m_operationLimits = value; }
}

/// <summary>
/// The message transport mode.
/// </summary>
/// <value>The message transport mode.</value>
[DataMember(IsRequired = false, Order = 7)]
public MessageTransportMode MessageTransportMode
{
get { return m_messageTransportMode; }
set { m_messageTransportMode = value; }
}
#endregion

#region Private Members
Expand All @@ -2509,8 +2520,33 @@ public OperationLimits OperationLimits
private int m_minSubscriptionLifetime;
private ReverseConnectClientConfiguration m_reverseConnect;
private OperationLimits m_operationLimits;
private MessageTransportMode m_messageTransportMode;
#endregion
}

#region MessageTransportMode Enumeration
/// <summary>
/// The mode of message transportation.
/// </summary>
/// <remarks>
/// When using TCP this <see cref="MessageTransportMode"/> affects the configuration of the <seealso cref="System.Net.Sockets.Socket"/>.
/// </remarks>
[DataContract(Namespace = Namespaces.OpcUaConfig)]
public enum MessageTransportMode
{
/// <summary>
/// This mode signalizes, that delay in message transportation is accepted.
/// </summary>
[EnumMember()]
DataEfficient,

/// <summary>
/// This mode signalizes, that delay in message transportation is not accepted.
/// </summary>
[EnumMember()]
TimeCritical
}
#endregion
#endregion

#region ReverseConnectClientConfiguration Class
Expand Down Expand Up @@ -2786,9 +2822,9 @@ public string ApplicationUri
/// or similar network infrastructure. If these paths are specified in the configuration
/// file then the server will use the domain of the URL used by the client to determine
/// which, if any, or the alternate addresses to use instead of the primary addresses.
///
///
/// In the ideal world the server would provide these URLs during registration but this
/// table allows the administrator to provide the information to the discovery server
/// table allows the administrator to provide the information to the discovery server
/// directly without requiring a patch to the server.
/// </remarks>
[DataMember(IsRequired = false, EmitDefaultValue = false, Order = 2)]
Expand Down Expand Up @@ -2921,7 +2957,7 @@ public string StorePath
}

/// <summary>
/// The name of the certificate store that contains the trusted certificates.
/// The name of the certificate store that contains the trusted certificates.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false, Order = 2)]
[Obsolete("Use StoreType/StorePath instead")]
Expand All @@ -2932,7 +2968,7 @@ public string StoreName
}

/// <summary>
/// The location of the certificate store that contains the trusted certificates.
/// The location of the certificate store that contains the trusted certificates.
/// </summary>
[DataMember(IsRequired = false, EmitDefaultValue = false, Order = 3)]
[Obsolete("Use StoreType/StorePath instead")]
Expand Down Expand Up @@ -3196,7 +3232,7 @@ public string StoreLocation
/// <value>
/// The distinguished name of an X509 certificate acording to the Abstract Syntax Notation One (ASN.1) syntax.
/// </value>
/// <remarks> The subject field identifies the entity associated with the public key stored in the subject public
/// <remarks> The subject field identifies the entity associated with the public key stored in the subject public
/// key field. The subject name MAY be carried in the subject field and/or the subjectAltName extension.
/// Where it is non-empty, the subject field MUST contain an X.500 distinguished name (DN).
/// Name is defined by the following ASN.1 structures:
Expand All @@ -3212,26 +3248,26 @@ public string StoreLocation
/// universalString UniversalString (SIZE (1..MAX)),
/// utf8String UTF8String (SIZE (1..MAX)),
/// bmpString BMPString (SIZE (1..MAX)) }
/// The Name describes a hierarchical name composed of attributes, such as country name, and
/// corresponding values, such as US. The type of the component AttributeValue is determined by
/// The Name describes a hierarchical name composed of attributes, such as country name, and
/// corresponding values, such as US. The type of the component AttributeValue is determined by
/// the AttributeType; in general it will be a DirectoryString.
/// String X.500 AttributeType:
/// <list type="bullet">
/// <item>CN commonName</item>
/// <item>CN commonName</item>
/// <item>L localityName</item>
/// <item>ST stateOrProvinceName</item>
/// <item>O organizationName</item>
/// <item>O organizationName</item>
/// <item>OU organizationalUnitName</item>
/// <item>C countryName</item>
/// <item>STREET streetAddress</item>
/// <item>DC domainComponent</item>
/// <item>UID userid</item>
/// </list>
/// This notation is designed to be convenient for common forms of name. This section gives a few
/// This notation is designed to be convenient for common forms of name. This section gives a few
/// examples of distinguished names written using this notation. First is a name containing three relative
/// distinguished names (RDNs):
/// <code>CN=Steve Kille,O=Isode Limited,C=GB</code>
///
///
/// RFC 3280 Internet X.509 Public Key Infrastructure, April 2002
/// RFC 2253 LADPv3 Distinguished Names, December 1997
/// </remarks>
Expand Down
9 changes: 9 additions & 0 deletions Stack/Opc.Ua.Core/Schema/ApplicationConfiguration.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<xs:element name="OperationLimits" type="OperationLimits" minOccurs="0" />
<xs:element name="AuditingEnabled" type="xs:boolean" minOccurs="0" />
<xs:element name="HttpsMutualTls" type="xs:boolean" minOccurs="0" />
<xs:element name="MessageTransportMode" type="MessageTransportMode" default="DataEfficient" minOccurs="0" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
Expand Down Expand Up @@ -214,6 +215,13 @@
<xs:element name="MaxMonitoredItemsPerCall" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>

<xs:simpleType name="MessageTransportMode">
<xs:restriction base="xs:string">
<xs:enumeration value="DataEfficient" />
<xs:enumeration value="TimeCritical" />
</xs:restriction>
</xs:simpleType>

<xs:complexType name="DiscoveryServerConfiguration">
<xs:complexContent mixed="false">
Expand Down Expand Up @@ -249,6 +257,7 @@
<xs:element name="MinSubscriptionLifetime" type="xs:int" minOccurs="0" />
<xs:element name="ReverseConnect" type="ReverseConnectClientConfiguration" minOccurs="0" />
<xs:element name="OperationLimits" type="OperationLimits" minOccurs="0" />
<xs:element name="MessageTransportMode" type="MessageTransportMode" minOccurs="0" />
</xs:sequence>
</xs:complexType>

Expand Down
4 changes: 2 additions & 2 deletions Stack/Opc.Ua.Core/Stack/Client/DiscoveryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ public virtual ServerOnNetworkCollection FindServersOnNetwork(
private EndpointDescriptionCollection PatchEndpointUrls(EndpointDescriptionCollection endpoints)
{
// if a server is behind a firewall, can only be accessed with a FQDN or IP address
// it may return URLs that are not accessible to the client. This problem can be avoided
// by assuming that the domain in the URL used to call GetEndpoints can be used to
// it may return URLs that are not accessible to the client. This problem can be avoided
// by assuming that the domain in the URL used to call GetEndpoints can be used to
// access any of the endpoints. This code patches the returned endpoints accordingly.
Uri endpointUrl = Utils.ParseUri(this.Endpoint.EndpointUrl);
if (endpointUrl != null)
Expand Down
10 changes: 6 additions & 4 deletions Stack/Opc.Ua.Core/Stack/Client/RegistrationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ public static ITransportChannel Create(
Uri endpointUrl = new Uri(description.EndpointUrl);
channel = new RegistrationChannel();

TransportChannelSettings settings = new TransportChannelSettings();
settings.Configuration = endpointConfiguration;
settings.Description = description;
settings.ClientCertificate = clientCertificate;
var settings = new TransportChannelSettings {
Configuration = endpointConfiguration,
Description = description,
ClientCertificate = clientCertificate,
TransportMode = configuration?.ClientConfiguration?.MessageTransportMode ?? MessageTransportMode.DataEfficient
};
channel.Initialize(endpointUrl, settings);
}

Expand Down
10 changes: 4 additions & 6 deletions Stack/Opc.Ua.Core/Stack/Client/SessionChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Opc.Ua
public partial class SessionChannel
{
#region Constructors

/// <summary>
/// Creates a new transport channel that supports the ISessionChannel service contract.
/// </summary>
Expand All @@ -29,8 +30,7 @@ public partial class SessionChannel
/// <param name="clientCertificate">The client certificate.</param>
/// <param name="messageContext">The message context to use when serializing the messages.</param>
/// <returns></returns>
public static ITransportChannel Create(
ApplicationConfiguration configuration,
public static ITransportChannel Create(ApplicationConfiguration configuration,
EndpointDescription description,
EndpointConfiguration endpointConfiguration,
X509Certificate2 clientCertificate,
Expand All @@ -49,8 +49,7 @@ public static ITransportChannel Create(
/// <param name="clientCertificateChain">The client certificate chain.</param>
/// <param name="messageContext">The message context to use when serializing the messages.</param>
/// <returns></returns>
public static ITransportChannel Create(
ApplicationConfiguration configuration,
public static ITransportChannel Create(ApplicationConfiguration configuration,
EndpointDescription description,
EndpointConfiguration endpointConfiguration,
X509Certificate2 clientCertificate,
Expand Down Expand Up @@ -80,8 +79,7 @@ public static ITransportChannel Create(
/// <param name="clientCertificateChain">The client certificate chain.</param>
/// <param name="messageContext">The message context to use when serializing the messages.</param>
/// <returns></returns>
public static ITransportChannel Create(
ApplicationConfiguration configuration,
public static ITransportChannel Create(ApplicationConfiguration configuration,
ITransportWaitingConnection connection,
EndpointDescription description,
EndpointConfiguration endpointConfiguration,
Expand Down
Loading
Loading