libiec61850
1.6.0
|
Data Structures | |
struct | LastApplError |
Typedefs | |
typedef struct sIedConnection * | IedConnection |
typedef void(* | IedConnection_GenericServiceHandler) (uint32_t invokeId, void *parameter, IedClientError err) |
Generic serivce callback handler. More... | |
typedef void(* | IedConnectionClosedHandler) (void *parameter, IedConnection connection) |
Callback handler that is invoked when the connection is closed. More... | |
typedef void(* | IedConnection_StateChangedHandler) (void *parameter, IedConnection connection, IedConnectionState newState) |
Callback handler that is invoked whenever the connection state (IedConnectionState) changes. More... | |
Functions | |
LIB61850_API const char * | IedClientError_toString (IedClientError err) |
Convert error value to string. More... | |
LIB61850_API IedConnection | IedConnection_create (void) |
create a new IedConnection instance More... | |
LIB61850_API IedConnection | IedConnection_createEx (TLSConfiguration tlsConfig, bool useThreads) |
create a new IedConnection instance (extended version) More... | |
LIB61850_API IedConnection | IedConnection_createWithTlsSupport (TLSConfiguration tlsConfig) |
create a new IedConnection instance that has support for TLS More... | |
LIB61850_API void | IedConnection_destroy (IedConnection self) |
destroy an IedConnection instance. More... | |
LIB61850_API void | IedConnection_setLocalAddress (IedConnection self, const char *localIpAddress, int localPort) |
Set the local IP address and port to be used by the client. More... | |
LIB61850_API void | IedConnection_setConnectTimeout (IedConnection self, uint32_t timeoutInMs) |
set the connect timeout in ms More... | |
LIB61850_API void | IedConnection_setMaxOutstandingCalls (IedConnection self, int calling, int called) |
Set the maximum number outstanding calls allowed for this connection. More... | |
LIB61850_API void | IedConnection_setRequestTimeout (IedConnection self, uint32_t timeoutInMs) |
set the request timeout in ms More... | |
LIB61850_API uint32_t | IedConnection_getRequestTimeout (IedConnection self) |
get the request timeout in ms for this connection More... | |
LIB61850_API void | IedConnection_setTimeQuality (IedConnection self, bool leapSecondKnown, bool clockFailure, bool clockNotSynchronized, int subsecondPrecision) |
Set the time quality for all timestamps generated by this IedConnection instance. More... | |
LIB61850_API bool | IedConnection_tick (IedConnection self) |
Perform MMS message handling and house-keeping tasks (for non-thread mode only) More... | |
LIB61850_API void | IedConnection_connect (IedConnection self, IedClientError *error, const char *hostname, int tcpPort) |
Connect to a server. More... | |
LIB61850_API void | IedConnection_connectAsync (IedConnection self, IedClientError *error, const char *hostname, int tcpPort) |
Asynchronously connect to a server. More... | |
LIB61850_API void | IedConnection_abort (IedConnection self, IedClientError *error) |
Abort the connection. More... | |
LIB61850_API void | IedConnection_abortAsync (IedConnection self, IedClientError *error) |
Asynchronously abort the connection. More... | |
LIB61850_API void | IedConnection_release (IedConnection self, IedClientError *error) |
Release the connection. More... | |
LIB61850_API void | IedConnection_releaseAsync (IedConnection self, IedClientError *error) |
Asynchronously release the connection. More... | |
LIB61850_API void | IedConnection_close (IedConnection self) |
Close the connection. More... | |
LIB61850_API IedConnectionState | IedConnection_getState (IedConnection self) |
return the state of the connection. More... | |
LIB61850_API LastApplError | IedConnection_getLastApplError (IedConnection self) |
Access to last application error received by the client connection. More... | |
LIB61850_API void | IedConnection_installConnectionClosedHandler (IedConnection self, IedConnectionClosedHandler handler, void *parameter) |
Install a handler function that is called when the connection is lost/closed. More... | |
LIB61850_API void | IedConnection_installStateChangedHandler (IedConnection self, IedConnection_StateChangedHandler handler, void *parameter) |
Install a handler function that is called when the connection state changes. More... | |
LIB61850_API MmsConnection | IedConnection_getMmsConnection (IedConnection self) |
get a handle to the underlying MmsConnection More... | |
typedef struct sIedConnection* IedConnection |
An opaque handle to the instance data of the IedConnection object
typedef void(* IedConnection_GenericServiceHandler) (uint32_t invokeId, void *parameter, IedClientError err) |
Generic serivce callback handler.
NOTE: This callback handler is used by several asynchronous service functions that require only a simple feedback in form of a success (IED_ERROR_OK) or failure (other err value).
invokeId | the invoke ID used by the related service request |
parameter | user provided parameter |
err | the result code. IED_ERROR_OK indicates success. |
typedef void(* IedConnection_StateChangedHandler) (void *parameter, IedConnection connection, IedConnectionState newState) |
Callback handler that is invoked whenever the connection state (IedConnectionState) changes.
user | provided parameter |
connection | the related connection |
newState | the new state of the connection |
typedef void(* IedConnectionClosedHandler) (void *parameter, IedConnection connection) |
Callback handler that is invoked when the connection is closed.
user | provided parameter |
connection | the connection object of the closed connection |
enum IedClientError |
used to describe the error reason for most client side service functions
enum IedConnectionState |
LIB61850_API const char* IedClientError_toString | ( | IedClientError | err | ) |
Convert error value to string.
LIB61850_API 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.
self | the connection object |
error | the error code if an error occurs |
LIB61850_API void IedConnection_abortAsync | ( | IedConnection | self, |
IedClientError * | error | ||
) |
Asynchronously 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. If the connection is not in "connected" state an IED_ERROR_NOT_CONNECTED error will be reported.
NOTE: This function works asynchronously. The IedConnection object should not be destroyed before the connection state changes to IED_STATE_CLOSED.
self | the connection object |
error | the error code if an error occurs |
LIB61850_API void IedConnection_close | ( | IedConnection | self | ) |
Close the connection.
This will close the MMS association and the underlying TCP connection.
self | the connection object |
LIB61850_API void IedConnection_connect | ( | IedConnection | self, |
IedClientError * | error, | ||
const char * | hostname, | ||
int | tcpPort | ||
) |
Connect to a server.
NOTE: Function will block until connection is up or timeout happened.
self | the connection object |
error | the error code if an error occurs |
hostname | the host name or IP address of the server to connect to |
tcpPort | the TCP port number of the server to connect to |
LIB61850_API void IedConnection_connectAsync | ( | IedConnection | self, |
IedClientError * | error, | ||
const char * | hostname, | ||
int | tcpPort | ||
) |
Asynchronously connect to a server.
The function will return immediately. No error doesn't indicate that the connection is established. The current connection state has to be tracked by polling the IedConnection_getState function or by using IedConnection_StateChangedHandler
self | the connection object |
error | the error code if an error occurs |
hostname | the host name or IP address of the server to connect to |
tcpPort | the TCP port number of the server to connect to |
LIB61850_API 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 "CLOSED" state. Before it can be used the connect method has to be called. The connection will be in non-TLS and thread mode.
LIB61850_API IedConnection IedConnection_createEx | ( | TLSConfiguration | tlsConfig, |
bool | useThreads | ||
) |
create a new IedConnection instance (extended version)
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 "CLOSED" state. Before it can be used the IedConnection_connect or IedConnection_connectAsync method has to be called. The connection will use TLS when a TLSConfiguration object is provided. The useThread is false the IedConnection is in non-thread mode and the IedConnection_tick function has to be called periodically to receive messages and perform the house-keeping tasks.
tlsConfig | the TLS configuration to be used, or NULL for non-TLS connection |
useThreads | when true, the IedConnection is in thread mode |
LIB61850_API 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 "CLOSED" state. Before it can be used the IedConnection_connect or IedConnection_connectAsync method has to be called. The connection will use TLS when a TLSConfiguration object is provided. The connection will be in thread mode.
tlsConfig | the TLS configuration to be used |
LIB61850_API 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.
self | the connection object |
LIB61850_API LastApplError IedConnection_getLastApplError | ( | IedConnection | self | ) |
Access to last application error received by the client connection.
self | the connection object |
LIB61850_API 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.
self | the connection object |
LIB61850_API uint32_t IedConnection_getRequestTimeout | ( | IedConnection | self | ) |
get the request timeout in ms for this connection
self | the connection object |
LIB61850_API 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.
self | the connection object |
LIB61850_API void IedConnection_installConnectionClosedHandler | ( | IedConnection | self, |
IedConnectionClosedHandler | handler, | ||
void * | parameter | ||
) |
Install a handler function that is called when the connection is lost/closed.
self | the connection object |
handler | that callback function |
parameter | the user provided parameter that is handed over to the callback function |
LIB61850_API void IedConnection_installStateChangedHandler | ( | IedConnection | self, |
IedConnection_StateChangedHandler | handler, | ||
void * | parameter | ||
) |
Install a handler function that is called when the connection state changes.
self | the connection object |
handler | that callback function |
parameter | the user provided parameter that is handed over to the callback function |
LIB61850_API 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.
self | the connection object |
error | the error code if an error occurs |
LIB61850_API void IedConnection_releaseAsync | ( | IedConnection | self, |
IedClientError * | error | ||
) |
Asynchronously 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.
self | the connection object |
error | the error code if an error occurs |
LIB61850_API 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.
self | the connection object |
timoutInMs | the connection timeout in ms |
LIB61850_API void IedConnection_setLocalAddress | ( | IedConnection | self, |
const char * | localIpAddress, | ||
int | localPort | ||
) |
Set the local IP address and port to be used by the client.
NOTE: This function is optional. When not used the OS decides what IP address and TCP port to use.
self | IedConnection instance |
localIpAddress | the local IP address or hostname as C string |
localPort | the local TCP port to use. When < 1 the OS will chose the TCP port to use. |
LIB61850_API void IedConnection_setMaxOutstandingCalls | ( | IedConnection | self, |
int | calling, | ||
int | called | ||
) |
Set the maximum number outstanding calls allowed for this connection.
self | the connection object |
calling | the maximum outstanding calls allowed by the caller (client) |
called | the maximum outstanding calls allowed by the called endpoint (server) |
LIB61850_API void IedConnection_setRequestTimeout | ( | IedConnection | self, |
uint32_t | timeoutInMs | ||
) |
set the request timeout in ms
Set the request timeout for this connection. You can call this function any time to adjust timeout behavior.
self | the connection object |
timoutInMs | the connection timeout in ms |
LIB61850_API void IedConnection_setTimeQuality | ( | IedConnection | self, |
bool | leapSecondKnown, | ||
bool | clockFailure, | ||
bool | clockNotSynchronized, | ||
int | subsecondPrecision | ||
) |
Set the time quality for all timestamps generated by this IedConnection instance.
self | the connection object |
leapSecondKnown | set/unset leap seconds known flag |
clockFailure | set/unset clock failure flag |
clockNotSynchronized | set/unset clock not synchronized flag |
subsecondPrecision | set the subsecond precision (number of significant bits of the fractionOfSecond part of the time stamp) |
LIB61850_API bool IedConnection_tick | ( | IedConnection | self | ) |
Perform MMS message handling and house-keeping tasks (for non-thread mode only)
This function has to be called periodically by the user application in non-thread mode. The return value helps to decide when the stack has nothing to do and other tasks can be executed.
NOTE: When using non-thread mode you should NOT use the synchronous (blocking) API functions. The synchronous functions will block forever when IedConnection_tick is not called in a separate thread.