libiec61850  1.2.0
Data Structures | Typedefs | Enumerations | Functions
General client side connection handling functions and data types

Data Structures

struct  LastApplError
 

Typedefs

typedef struct sIedConnection * IedConnection
 
typedef void(* IedConnectionClosedHandler) (void *parameter, IedConnection connection)
 

Enumerations

enum  IedConnectionState { IED_STATE_IDLE, IED_STATE_CONNECTED, IED_STATE_CLOSED }
 
enum  IedClientError {
  IED_ERROR_OK = 0, IED_ERROR_NOT_CONNECTED = 1, IED_ERROR_ALREADY_CONNECTED = 2, IED_ERROR_CONNECTION_LOST = 3,
  IED_ERROR_SERVICE_NOT_SUPPORTED = 4, IED_ERROR_CONNECTION_REJECTED = 5, IED_ERROR_USER_PROVIDED_INVALID_ARGUMENT = 10, IED_ERROR_ENABLE_REPORT_FAILED_DATASET_MISMATCH = 11,
  IED_ERROR_OBJECT_REFERENCE_INVALID = 12, IED_ERROR_UNEXPECTED_VALUE_RECEIVED = 13, IED_ERROR_TIMEOUT = 20, IED_ERROR_ACCESS_DENIED = 21,
  IED_ERROR_OBJECT_DOES_NOT_EXIST = 22, IED_ERROR_OBJECT_EXISTS = 23, IED_ERROR_OBJECT_ACCESS_UNSUPPORTED = 24, IED_ERROR_TYPE_INCONSISTENT = 25,
  IED_ERROR_TEMPORARILY_UNAVAILABLE = 26, IED_ERROR_OBJECT_UNDEFINED = 27, IED_ERROR_INVALID_ADDRESS = 28, IED_ERROR_HARDWARE_FAULT = 29,
  IED_ERROR_TYPE_UNSUPPORTED = 30, IED_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT = 31, IED_ERROR_OBJECT_VALUE_INVALID = 32, IED_ERROR_OBJECT_INVALIDATED = 33,
  IED_ERROR_SERVICE_NOT_IMPLEMENTED = 98, IED_ERROR_UNKNOWN = 99
}
 

Functions

IedConnection IedConnection_create (void)
 create a new IedConnection instance More...
 
IedConnection IedConnection_createWithTlsSupport (TLSConfiguration tlsConfig)
 create a new IedConnection instance that has support for TLS More...
 
void IedConnection_destroy (IedConnection self)
 destroy an IedConnection instance. More...
 
void IedConnection_setConnectTimeout (IedConnection self, uint32_t timeoutInMs)
 set the connect timeout in ms More...
 
void IedConnection_connect (IedConnection self, IedClientError *error, const char *hostname, int tcpPort)
 Connect to a server. More...
 
void IedConnection_abort (IedConnection self, IedClientError *error)
 Abort the connection. More...
 
void IedConnection_release (IedConnection self, IedClientError *error)
 Release the connection. More...
 
void IedConnection_close (IedConnection self)
 Close the connection. More...
 
IedConnectionState IedConnection_getState (IedConnection self)
 return the state of the connection. More...
 
LastApplError IedConnection_getLastApplError (IedConnection self)
 Access to last application error received by the client connection. More...
 
void IedConnection_installConnectionClosedHandler (IedConnection self, IedConnectionClosedHandler handler, void *parameter)
 Install a handler function that will be called when the connection is lost. More...
 
MmsConnection IedConnection_getMmsConnection (IedConnection self)
 get a handle to the underlying MmsConnection More...
 

Detailed Description

Typedef Documentation

typedef struct sIedConnection* IedConnection

An opaque handle to the instance data of the IedConnection object

typedef void(* IedConnectionClosedHandler) (void *parameter, IedConnection connection)

Enumeration Type Documentation

used to describe the error reason for most client side service functions

Enumerator
IED_ERROR_OK 

No error occurred - service request has been successful

IED_ERROR_NOT_CONNECTED 

The service request can not be executed because the client is not yet connected

IED_ERROR_ALREADY_CONNECTED 

Connect service not execute because the client is already connected

IED_ERROR_CONNECTION_LOST 

The service request can not be executed caused by a loss of connection

IED_ERROR_SERVICE_NOT_SUPPORTED 

The service or some given parameters are not supported by the client stack or by the server

IED_ERROR_CONNECTION_REJECTED 

Connection rejected by server

IED_ERROR_USER_PROVIDED_INVALID_ARGUMENT 

API function has been called with an invalid argument

IED_ERROR_ENABLE_REPORT_FAILED_DATASET_MISMATCH 
IED_ERROR_OBJECT_REFERENCE_INVALID 

The object provided object reference is invalid (there is a syntactical error).

IED_ERROR_UNEXPECTED_VALUE_RECEIVED 

Received object is of unexpected type

IED_ERROR_TIMEOUT 

The communication to the server failed with a timeout

IED_ERROR_ACCESS_DENIED 

The server rejected the access to the requested object/service due to access control

IED_ERROR_OBJECT_DOES_NOT_EXIST 

The server reported that the requested object does not exist (returned by server)

IED_ERROR_OBJECT_EXISTS 

The server reported that the requested object already exists

IED_ERROR_OBJECT_ACCESS_UNSUPPORTED 

The server does not support the requested access method (returned by server)

IED_ERROR_TYPE_INCONSISTENT 

The server expected an object of another type (returned by server)

IED_ERROR_TEMPORARILY_UNAVAILABLE 

The object or service is temporarily unavailable (returned by server)

IED_ERROR_OBJECT_UNDEFINED 

The specified object is not defined in the server (returned by server)

IED_ERROR_INVALID_ADDRESS 

The specified address is invalid (returned by server)

IED_ERROR_HARDWARE_FAULT 

Service failed due to a hardware fault (returned by server)

IED_ERROR_TYPE_UNSUPPORTED 

The requested data type is not supported by the server (returned by server)

IED_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT 

The provided attributes are inconsistent (returned by server)

IED_ERROR_OBJECT_VALUE_INVALID 

The provided object value is invalid (returned by server)

IED_ERROR_OBJECT_INVALIDATED 

The object is invalidated (returned by server)

IED_ERROR_SERVICE_NOT_IMPLEMENTED 

Service not implemented

IED_ERROR_UNKNOWN 

unknown error

Connection state of the IedConnection instance (either idle, connected or closed)

Enumerator
IED_STATE_IDLE 
IED_STATE_CONNECTED 
IED_STATE_CLOSED 

Function Documentation

void IedConnection_abort ( IedConnection  self,
IedClientError error 
)

Abort the connection.

This will close the MMS association by sending an ACSE abort message to the server. After sending the abort message the connection is closed immediately. The client can assume the connection to be closed when the function returns and the destroy method can be called. If the connection is not in "connected" state an IED_ERROR_NOT_CONNECTED error will be reported.

Parameters
selfthe connection object
errorthe error code if an error occurs
void IedConnection_close ( IedConnection  self)

Close the connection.

This will close the MMS association and the underlying TCP connection.

Parameters
selfthe connection object
void IedConnection_connect ( IedConnection  self,
IedClientError error,
const char *  hostname,
int  tcpPort 
)

Connect to a server.

Parameters
selfthe connection object
errorthe error code if an error occurs
hostnamethe host name or IP address of the server to connect to
tcpPortthe TCP port number of the server to connect to
IedConnection IedConnection_create ( void  )

create a new IedConnection instance

This function creates a new IedConnection instance that is used to handle a connection to an IED. It allocated all required resources. The new connection is in the "idle" state. Before it can be used the connect method has to be called.

Returns
the new IedConnection instance
IedConnection IedConnection_createWithTlsSupport ( TLSConfiguration  tlsConfig)

create a new IedConnection instance that has support for TLS

This function creates a new IedConnection instance that is used to handle a connection to an IED. It allocated all required resources. The new connection is in the "idle" state. Before it can be used the connect method has to be called. The connection will use TLS when a TLSConfiguration object is provided.

Parameters
tlsConfigthe TLS configuration to be used
Returns
the new IedConnection instance
void IedConnection_destroy ( IedConnection  self)

destroy an IedConnection instance.

The connection will be closed if it is in "connected" state. All allocated resources of the connection will be freed.

Parameters
selfthe connection object
LastApplError IedConnection_getLastApplError ( IedConnection  self)

Access to last application error received by the client connection.

Parameters
selfthe connection object
Returns
the LastApplError value
MmsConnection IedConnection_getMmsConnection ( IedConnection  self)

get a handle to the underlying MmsConnection

Get access to the underlying MmsConnection instance used by this IedConnection. This can be used to set/change specific MmsConnection parameters or to call low-level MMS services/functions.

Parameters
selfthe connection object
Returns
the MmsConnection instance used by this IedConnection.
IedConnectionState IedConnection_getState ( IedConnection  self)

return the state of the connection.

This function can be used to determine if the connection is established or closed.

Parameters
selfthe connection object
Returns
the connection state
void IedConnection_installConnectionClosedHandler ( IedConnection  self,
IedConnectionClosedHandler  handler,
void *  parameter 
)

Install a handler function that will be called when the connection is lost.

Parameters
selfthe connection object
handlerthat callback function
parameterthe user provided parameter that is handed over to the callback function
void IedConnection_release ( IedConnection  self,
IedClientError error 
)

Release the connection.

This will release the MMS association by sending an MMS conclude message to the server. The client can NOT assume the connection to be closed when the function returns, It can also fail if the server returns with a negative response. To be sure that the connection will be close the close or abort methods should be used. If the connection is not in "connected" state an IED_ERROR_NOT_CONNECTED error will be reported.

Parameters
selfthe connection object
errorthe error code if an error occurs
void IedConnection_setConnectTimeout ( IedConnection  self,
uint32_t  timeoutInMs 
)

set the connect timeout in ms

Set the connect timeout for this connection. This function has to be called before IedConnection_connect is called.

Parameters
selfthe connection object
timoutInMsthe connection timeout in ms