org.opcfoundation.ua.transport
Interface SecureChannel

All Superinterfaces:
RequestChannel
All Known Implementing Classes:
HttpsClientSecureChannel, SecureChannelTcp, ServiceChannel

public interface SecureChannel
extends RequestChannel

Client's SecureChannel connection.

If the connection fails, and the transport channel is stateful (TCP), and the secure channel has pending service requests, it attempts to reconnect the transport channel. If the reconnect fails there is a timeout sequence of the following wait periods { 0, 1, 2, 4, 8, 16, 32, 64, 120, 120, ... }.

If error recovery mode fails to re-establish new security token before the old expires, the secure channel will be closed.


Method Summary
 void close()
          Close the secure channel.
 AsyncResult<SecureChannel> closeAsync()
          Close the secure channel.
 void dispose()
          Close and dispose.
 ServerConnection getConnection()
          Get current socket connection if applicable for the binding type.
 String getConnectURL()
          Return the URL of the connection.
 EndpointConfiguration getEndpointConfiguration()
          getEndpointConfiguration.
 EndpointDescription getEndpointDescription()
          getEndpointDescription.
 EncoderContext getMessageContext()
          getMessageContext.
 MessageSecurityMode getMessageSecurityMode()
          Get message security mode.
 int getOperationTimeout()
          Get operation timeout
 int getSecureChannelId()
          Get secure channel ID
 SecurityPolicy getSecurityPolicy()
          Get security policy
 void initialize(String connectUrl, TransportChannelSettings settings, EncoderContext ctx)
          Initialize a secure channel with endpoint identified by the URL.
 void initialize(TransportChannelSettings settings, EncoderContext ctx)
          Initialize a secure channel with endpoint identified by the URL.
 boolean isOpen()
          Is the secure channel open.
 void open()
          Open the secure channel with the endpoint identified by the URL.
 AsyncResult<SecureChannel> openAsync()
          Open the secure channel asynchronously.
 ServiceResponse serviceRequest(ServiceRequest request)
          Sends a request over the secure channel.
 AsyncResult<ServiceResponse> serviceRequestAsync(ServiceRequest request)
          Asynchronous operation to send a request over the secure channel.
 void setOperationTimeout(int timeout)
          Set operation timeout
 

Method Detail

initialize

void initialize(String connectUrl,
                TransportChannelSettings settings,
                EncoderContext ctx)
                throws ServiceResultException
Initialize a secure channel with endpoint identified by the URL.

Parameters:
connectUrl - connect url
settings - a TransportChannelSettings object.
ctx - a EncoderContext object.
Throws:
ServiceResultException - if any.

initialize

void initialize(TransportChannelSettings settings,
                EncoderContext ctx)
                throws ServiceResultException
Initialize a secure channel with endpoint identified by the URL.

Parameters:
settings - a TransportChannelSettings object.
ctx - a EncoderContext object.
Throws:
ServiceResultException - if any.

open

void open()
          throws ServiceResultException
Open the secure channel with the endpoint identified by the URL. Once the channel is open if will be assigned a secure channel id. The channel must be initialzied before hand. If the operation timeouts or the thread is interrupted a ServiceResultException is thrown with StatusCodes.Bad_Timeout.

Throws:
ServiceResultException - if any.

openAsync

AsyncResult<SecureChannel> openAsync()
Open the secure channel asynchronously.

Returns:
async result

serviceRequest

ServiceResponse serviceRequest(ServiceRequest request)
                               throws ServiceResultException
Sends a request over the secure channel.

If the operation timeouts or the thread is interrupted a ServiceResultException is thrown with StatusCodes.Bad_Timeout.

Sends a request over the secure channel.

If the operation timeouts or the thread is interrupted a ServiceResultException is thrown with StatusCodes.Bad_Timeout.

Specified by:
serviceRequest in interface RequestChannel
Parameters:
request - the request
Returns:
the response
Throws:
ServiceResultException - if error

serviceRequestAsync

AsyncResult<ServiceResponse> serviceRequestAsync(ServiceRequest request)
Asynchronous operation to send a request over the secure channel. Asynchronous operation to send a request over the secure channel.

Specified by:
serviceRequestAsync in interface RequestChannel
Parameters:
request - the request
Returns:
the result

getSecureChannelId

int getSecureChannelId()
Get secure channel ID

Returns:
secure channel id

getConnection

ServerConnection getConnection()
Get current socket connection if applicable for the binding type.

Returns:
connection or null

getMessageSecurityMode

MessageSecurityMode getMessageSecurityMode()
Get message security mode.

Returns:
security mode or null

getSecurityPolicy

SecurityPolicy getSecurityPolicy()
Get security policy

Returns:
security policy or null if channel has not been initialized

getConnectURL

String getConnectURL()
Return the URL of the connection. This value is only available when the channel is in Open or Closing state, if not the return value is null.

Returns:
connect URL or null

isOpen

boolean isOpen()
Is the secure channel open.

Returns:
true if the channel is open

close

void close()
Close the secure channel. This method does nothing if the channel is already closed or has never been opened.

This method sends CloseSecureChannelRequest to the server and closes the socket connection. If sending of the message fails and thus the servers never receives notification about closed secure channel, then there is no resend attempt. The secure channel will eventually time out in the server.

All pending requests will fault with Bad_SecureChannelClosed


closeAsync

AsyncResult<SecureChannel> closeAsync()
Close the secure channel. This method does nothing if the channel is already closed or has never been opened.

This method sends CloseSecureChannelRequest to the server and closes the socket connection. If sending of the message fails and thus the servers never receives notification about closed secure channel, then there is no resend attempt. The secure channel will eventually time out in the server.

All pending requests will fault with Bad_SecureChannelClosed

Returns:
asynchronous monitor object

dispose

void dispose()
Close and dispose. The object becomes unusuable.


getEndpointDescription

EndpointDescription getEndpointDescription()

getEndpointDescription.

Returns:
a EndpointDescription object.

getEndpointConfiguration

EndpointConfiguration getEndpointConfiguration()

getEndpointConfiguration.

Returns:
a EndpointConfiguration object.

getMessageContext

EncoderContext getMessageContext()

getMessageContext.

Returns:
a EncoderContext object.

setOperationTimeout

void setOperationTimeout(int timeout)
Set operation timeout

Parameters:
timeout - in milliseconds

getOperationTimeout

int getOperationTimeout()
Get operation timeout

Returns:
timeout in milliseconds


Copyright © 2018. All rights reserved.