C# Class Opc.Ua.ServerBase

A base class for a UA server implementation.
Inheritance: IServerBase, IDisposable
Afficher le fichier Open project: OPCFoundation/UA-.NET Class Usage Examples

Méthodes publiques

Méthode Description
Dispose ( ) : void

Frees any unmanaged resources.

GetEndpoints ( ) : EndpointDescriptionCollection

Returns the endpoints supported by the server.

RequireEncryption ( EndpointDescription description ) : bool

Specifies if the server requires encryption; if so the server needs to send its certificate to the clients and validate the client certificates

ScheduleIncomingRequest ( IEndpointIncomingRequest request ) : void

Schedules an incoming request.

ServerBase ( ) : System

Initializes object with default values.

Start ( ApplicationConfiguration configuration ) : ServiceHost

Starts the server (called from a IIS host process).

Start ( ApplicationConfiguration configuration ) : void

Starts the server (called from a dedicated host process).

Méthodes protégées

Méthode Description
CreateHttpsServiceHost ( ServiceHost>.IDictionary hosts, ApplicationConfiguration configuration, BindingFactory bindingFactory, IList baseAddresses, ApplicationDescription serverDescription, List securityPolicies ) : List

Create a new service host for UA HTTPS.

CreateResponse ( RequestHeader requestHeader, Exception exception ) : ResponseHeader

Creates the response header.

CreateResponse ( RequestHeader requestHeader, StringTable stringTable ) : ResponseHeader

Creates the response header.

CreateResponse ( RequestHeader requestHeader, uint statusCode ) : ResponseHeader

Creates the response header.

CreateServiceHost ( ServerBase server ) : ServiceHost

Creates an instance of the service host.

CreateSinglePolicyServiceHost ( ServiceHost>.IDictionary hosts, ApplicationConfiguration configuration, BindingFactory bindingFactory, IList baseAddresses, ApplicationDescription serverDescription, MessageSecurityMode securityMode, string securityPolicyUri, string basePath ) : List

Create a new service host for protocols that support only one policy per host.

CreateUaTcpServiceHost ( ServiceHost>.IDictionary hosts, ApplicationConfiguration configuration, BindingFactory bindingFactory, IList baseAddresses, ApplicationDescription serverDescription, List securityPolicies ) : List

Create a new service host for UA TCP.

Dispose ( bool disposing ) : void

An overrideable version of the Dispose.

FilterByEndpointUrl ( Uri endpointUrl, IList baseAddresses ) : IList

Filters the list of addresses by the URL that the client provided.

FilterByProfile ( StringCollection profileUris, IList baseAddresses ) : IList

Filters the list of addresses by profile.

GetDiscoveryUrls ( ) : StringCollection

Returns the discovery URLs for the server.

GetEndpointInstance ( ServerBase server ) : EndpointBase

Returns an instance of the endpoint to use.

GetServiceContract ( ) : Type

Returns the service contract to use.

GetUserTokenPolicies ( ApplicationConfiguration configuration, EndpointDescription description ) : UserTokenPolicyCollection

Returns the UserTokenPolicies supported by the server.

InitializeRequestQueue ( ApplicationConfiguration configuration ) : void

Initializes the request queue.

InitializeServiceHosts ( ApplicationConfiguration configuration, BindingFactory bindingFactory, ApplicationDescription &serverDescription, EndpointDescriptionCollection &endpoints ) : IList

Creates the endpoints and creates the hosts.

LoadServerProperties ( ) : ServerProperties

Returns the properties for associated with the server instance.

NormalizeHostname ( string hostname ) : string

Checks for IP address or well known hostnames that map to the computer.

OnServerStarting ( ApplicationConfiguration configuration ) : void

Called before the server starts.

OnServerStopping ( ) : void

Called before the server stops

OnUpdateConfiguration ( ApplicationConfiguration configuration ) : void

Called when the server configuration is changed on disk.

Servers are free to ignore changes if it is difficult/impossible to apply them without a restart.

ProcessRequest ( IEndpointIncomingRequest request, object calldata ) : void

Processes the request.

StartApplication ( ApplicationConfiguration configuration ) : void

Starts the server application.

TranslateApplicationDescription ( Uri clientUrl, ApplicationDescription description, IList baseAddresses, Opc.Ua.LocalizedText applicationName ) : ApplicationDescription

Translates the discovery URLs based on the client url and returns an updated ApplicationDescription.

TranslateEndpointDescriptions ( Uri clientUrl, IList baseAddresses, IList endpoints, ApplicationDescription application ) : EndpointDescriptionCollection

Translates the endpoint descriptions based on the client url and profiles provided.

ValidateRequest ( RequestHeader requestHeader ) : void

Verifies that the request header is valid.

Private Methods

Méthode Description
GetBestDiscoveryUrl ( Uri clientUrl, BaseAddress baseAddress ) : string

Returns the best discovery URL for the base address based on the URL used by the client.

InitializeBaseAddresses ( ApplicationConfiguration configuration ) : void

Initializes the list of base addresses.

Stop ( ) : void

Method Details

CreateHttpsServiceHost() protected méthode

Create a new service host for UA HTTPS.
protected CreateHttpsServiceHost ( ServiceHost>.IDictionary hosts, ApplicationConfiguration configuration, BindingFactory bindingFactory, IList baseAddresses, ApplicationDescription serverDescription, List securityPolicies ) : List
hosts ServiceHost>.IDictionary
configuration ApplicationConfiguration
bindingFactory BindingFactory
baseAddresses IList
serverDescription ApplicationDescription
securityPolicies List
Résultat List

CreateResponse() protected méthode

Creates the response header.
protected CreateResponse ( RequestHeader requestHeader, Exception exception ) : ResponseHeader
requestHeader RequestHeader The object that contains description for the RequestHeader DataType.
exception System.Exception The exception used to create DiagnosticInfo assigned to the ServiceDiagnostics.
Résultat ResponseHeader

CreateResponse() protected méthode

Creates the response header.
protected CreateResponse ( RequestHeader requestHeader, StringTable stringTable ) : ResponseHeader
requestHeader RequestHeader The object that contains description for the RequestHeader DataType.
stringTable StringTable The thread safe table of string constants.
Résultat ResponseHeader

CreateResponse() protected méthode

Creates the response header.
If statusCode is bad.
protected CreateResponse ( RequestHeader requestHeader, uint statusCode ) : ResponseHeader
requestHeader RequestHeader The object that contains description for the RequestHeader DataType.
statusCode uint The status code.
Résultat ResponseHeader

CreateServiceHost() protected méthode

Creates an instance of the service host.
protected CreateServiceHost ( ServerBase server ) : ServiceHost
server ServerBase
Résultat ServiceHost

CreateSinglePolicyServiceHost() protected méthode

Create a new service host for protocols that support only one policy per host.
protected CreateSinglePolicyServiceHost ( ServiceHost>.IDictionary hosts, ApplicationConfiguration configuration, BindingFactory bindingFactory, IList baseAddresses, ApplicationDescription serverDescription, MessageSecurityMode securityMode, string securityPolicyUri, string basePath ) : List
hosts ServiceHost>.IDictionary The hosts.
configuration ApplicationConfiguration The configuration.
bindingFactory BindingFactory The binding factory.
baseAddresses IList The base addresses.
serverDescription ApplicationDescription The server description.
securityMode MessageSecurityMode The security mode.
securityPolicyUri string The security policy URI.
basePath string The base path to use when constructing the hosts.
Résultat List

CreateUaTcpServiceHost() protected méthode

Create a new service host for UA TCP.
protected CreateUaTcpServiceHost ( ServiceHost>.IDictionary hosts, ApplicationConfiguration configuration, BindingFactory bindingFactory, IList baseAddresses, ApplicationDescription serverDescription, List securityPolicies ) : List
hosts ServiceHost>.IDictionary
configuration ApplicationConfiguration
bindingFactory BindingFactory
baseAddresses IList
serverDescription ApplicationDescription
securityPolicies List
Résultat List

Dispose() public méthode

Frees any unmanaged resources.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

An overrideable version of the Dispose.
protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

FilterByEndpointUrl() protected méthode

Filters the list of addresses by the URL that the client provided.
protected FilterByEndpointUrl ( Uri endpointUrl, IList baseAddresses ) : IList
endpointUrl System.Uri
baseAddresses IList
Résultat IList

FilterByProfile() protected méthode

Filters the list of addresses by profile.
protected FilterByProfile ( StringCollection profileUris, IList baseAddresses ) : IList
profileUris StringCollection
baseAddresses IList
Résultat IList

GetDiscoveryUrls() protected méthode

Returns the discovery URLs for the server.
protected GetDiscoveryUrls ( ) : StringCollection
Résultat StringCollection

GetEndpointInstance() protected méthode

Returns an instance of the endpoint to use.
protected GetEndpointInstance ( ServerBase server ) : EndpointBase
server ServerBase
Résultat EndpointBase

GetEndpoints() public méthode

Returns the endpoints supported by the server.
public GetEndpoints ( ) : EndpointDescriptionCollection
Résultat EndpointDescriptionCollection

GetServiceContract() protected méthode

Returns the service contract to use.
protected GetServiceContract ( ) : Type
Résultat System.Type

GetUserTokenPolicies() protected méthode

Returns the UserTokenPolicies supported by the server.
protected GetUserTokenPolicies ( ApplicationConfiguration configuration, EndpointDescription description ) : UserTokenPolicyCollection
configuration ApplicationConfiguration The configuration.
description EndpointDescription The description.
Résultat UserTokenPolicyCollection

InitializeRequestQueue() protected méthode

Initializes the request queue.
protected InitializeRequestQueue ( ApplicationConfiguration configuration ) : void
configuration ApplicationConfiguration The configuration.
Résultat void

InitializeServiceHosts() protected méthode

Creates the endpoints and creates the hosts.
protected InitializeServiceHosts ( ApplicationConfiguration configuration, BindingFactory bindingFactory, ApplicationDescription &serverDescription, EndpointDescriptionCollection &endpoints ) : IList
configuration ApplicationConfiguration The object that stores the configurable configuration information for a UA application.
bindingFactory BindingFactory The object of a class that manages a mapping between a URL scheme and a binding.
serverDescription ApplicationDescription The object of the class that contains a description for the ApplicationDescription DataType.
endpoints EndpointDescriptionCollection The collection of objects.
Résultat IList

LoadServerProperties() protected méthode

Returns the properties for associated with the server instance.
protected LoadServerProperties ( ) : ServerProperties
Résultat ServerProperties

NormalizeHostname() protected méthode

Checks for IP address or well known hostnames that map to the computer.
protected NormalizeHostname ( string hostname ) : string
hostname string The hostname.
Résultat string

OnServerStarting() protected méthode

Called before the server starts.
protected OnServerStarting ( ApplicationConfiguration configuration ) : void
configuration ApplicationConfiguration The object that stores the configurable configuration information for a UA application.
Résultat void

OnServerStopping() protected méthode

Called before the server stops
protected OnServerStopping ( ) : void
Résultat void

OnUpdateConfiguration() protected méthode

Called when the server configuration is changed on disk.
Servers are free to ignore changes if it is difficult/impossible to apply them without a restart.
protected OnUpdateConfiguration ( ApplicationConfiguration configuration ) : void
configuration ApplicationConfiguration The object that stores the configurable configuration information for a UA application.
Résultat void

ProcessRequest() protected méthode

Processes the request.
protected ProcessRequest ( IEndpointIncomingRequest request, object calldata ) : void
request IEndpointIncomingRequest The request.
calldata object The calldata passed with the request.
Résultat void

RequireEncryption() public static méthode

Specifies if the server requires encryption; if so the server needs to send its certificate to the clients and validate the client certificates
public static RequireEncryption ( EndpointDescription description ) : bool
description EndpointDescription The description.
Résultat bool

ScheduleIncomingRequest() public méthode

Schedules an incoming request.
public ScheduleIncomingRequest ( IEndpointIncomingRequest request ) : void
request IEndpointIncomingRequest The request.
Résultat void

ServerBase() public méthode

Initializes object with default values.
public ServerBase ( ) : System
Résultat System

Start() public méthode

Starts the server (called from a IIS host process).
public Start ( ApplicationConfiguration configuration ) : ServiceHost
configuration ApplicationConfiguration The object that stores the configurable configuration information /// for a UA application
Résultat ServiceHost

Start() public méthode

Starts the server (called from a dedicated host process).
public Start ( ApplicationConfiguration configuration ) : void
configuration ApplicationConfiguration The object that stores the configurable configuration /// information for a UA application. ///
Résultat void

StartApplication() protected méthode

Starts the server application.
protected StartApplication ( ApplicationConfiguration configuration ) : void
configuration ApplicationConfiguration The object that stores the configurable configuration information for a UA application.
Résultat void

TranslateApplicationDescription() protected méthode

Translates the discovery URLs based on the client url and returns an updated ApplicationDescription.
protected TranslateApplicationDescription ( Uri clientUrl, ApplicationDescription description, IList baseAddresses, Opc.Ua.LocalizedText applicationName ) : ApplicationDescription
clientUrl System.Uri The client URL.
description ApplicationDescription The application description.
baseAddresses IList The base addresses.
applicationName Opc.Ua.LocalizedText The localized application name.
Résultat ApplicationDescription

TranslateEndpointDescriptions() protected méthode

Translates the endpoint descriptions based on the client url and profiles provided.
protected TranslateEndpointDescriptions ( Uri clientUrl, IList baseAddresses, IList endpoints, ApplicationDescription application ) : EndpointDescriptionCollection
clientUrl System.Uri The client URL.
baseAddresses IList The base addresses.
endpoints IList The endpoints.
application ApplicationDescription The application to use with the endpoints.
Résultat EndpointDescriptionCollection

ValidateRequest() protected méthode

Verifies that the request header is valid.
protected ValidateRequest ( RequestHeader requestHeader ) : void
requestHeader RequestHeader The object that contains description for the RequestHeader DataType.
Résultat void