libiec61850  1.6.0
Typedefs | Functions
General server setup and management functions

Functions to create, configure, and manage an IEC 61850 server instance. More...

Typedefs

typedef struct sIedServer * IedServer
 
typedef struct sClientConnection * ClientConnection
 

Functions

LIB61850_API IedServer IedServer_create (IedModel *dataModel)
 Create a new IedServer instance. More...
 
LIB61850_API IedServer IedServer_createWithTlsSupport (IedModel *dataModel, TLSConfiguration tlsConfiguration)
 Create a new IedServer with TLS support. More...
 
LIB61850_API IedServer IedServer_createWithConfig (IedModel *dataModel, TLSConfiguration tlsConfiguration, IedServerConfig serverConfiguration)
 Create new new IedServer with extended configurations parameters. More...
 
LIB61850_API void IedServer_destroy (IedServer self)
 Destroy an IedServer instance and release all resources (memory, TCP sockets) More...
 
LIB61850_API bool IedServer_addAccessPoint (IedServer self, const char *ipAddr, int tcpPort, TLSConfiguration tlsConfiguration)
 Add a new local access point (server will listen to provided IP/port combination) More...
 
LIB61850_API void IedServer_setLocalIpAddress (IedServer self, const char *localIpAddress)
 Set the local IP address to listen on. More...
 
LIB61850_API void IedServer_setServerIdentity (IedServer self, const char *vendor, const char *model, const char *revision)
 Set the identify for the MMS identify service. More...
 
LIB61850_API void IedServer_setFilestoreBasepath (IedServer self, const char *basepath)
 Set the virtual filestore basepath for the MMS file services. More...
 
LIB61850_API void IedServer_setLogStorage (IedServer self, const char *logRef, LogStorage logStorage)
 Assign a LogStorage instance to a log reference. More...
 
LIB61850_API void IedServer_start (IedServer self, int tcpPort)
 Start handling client connections. More...
 
LIB61850_API void IedServer_stop (IedServer self)
 Stop handling client connections. More...
 
LIB61850_API void IedServer_startThreadless (IedServer self, int tcpPort)
 Start handling client connection for non-threaded mode. More...
 
LIB61850_API int IedServer_waitReady (IedServer self, unsigned int timeoutMs)
 Wait until a server connection is ready (with timeout) More...
 
LIB61850_API void IedServer_processIncomingData (IedServer self)
 handle incoming TCP data in non-threaded mode More...
 
LIB61850_API void IedServer_performPeriodicTasks (IedServer self)
 perform periodic background tasks in non-threaded mode More...
 
LIB61850_API void IedServer_stopThreadless (IedServer self)
 Stop handling client connections for non-threaded mode. More...
 
LIB61850_API IedModel * IedServer_getDataModel (IedServer self)
 Return the data model of the server. More...
 
LIB61850_API bool IedServer_isRunning (IedServer self)
 Check if IedServer instance is listening for client connections. More...
 
LIB61850_API int IedServer_getNumberOfOpenConnections (IedServer self)
 Get number of open MMS connections. More...
 
LIB61850_API MmsServer IedServer_getMmsServer (IedServer self)
 Get access to the underlying MmsServer instance. More...
 
LIB61850_API void IedServer_enableGoosePublishing (IedServer self)
 Enable all GOOSE control blocks. More...
 
LIB61850_API void IedServer_disableGoosePublishing (IedServer self)
 Disable all GOOSE control blocks. More...
 
LIB61850_API void IedServer_setGooseInterfaceId (IedServer self, const char *interfaceId)
 Set the Ethernet interface to be used by GOOSE publishing. More...
 
LIB61850_API void IedServer_setGooseInterfaceIdEx (IedServer self, LogicalNode *ln, const char *gcbName, const char *interfaceId)
 Set the Ethernet interface to be used by GOOSE publishing. More...
 
LIB61850_API void IedServer_useGooseVlanTag (IedServer self, LogicalNode *ln, const char *gcbName, bool useVlanTag)
 Enable/disable the use of VLAN tags in GOOSE messages. More...
 
LIB61850_API void IedServer_setTimeQuality (IedServer self, bool leapSecondKnown, bool clockFailure, bool clockNotSynchronized, int subsecondPrecision)
 Set the time quality for all timestamps internally generated by this IedServer instance. More...
 

Detailed Description

Functions to create, configure, and manage an IEC 61850 server instance.

Typedef Documentation

◆ ClientConnection

typedef struct sClientConnection* ClientConnection

An opaque handle for a client connection

◆ IedServer

typedef struct sIedServer* IedServer

An opaque handle for an IED server instance

Function Documentation

◆ IedServer_addAccessPoint()

LIB61850_API bool IedServer_addAccessPoint ( IedServer  self,
const char *  ipAddr,
int  tcpPort,
TLSConfiguration  tlsConfiguration 
)

Add a new local access point (server will listen to provided IP/port combination)

Parameters
selfthe instance of IedServer to operate on.
ipAddrthe local IP address to listen on
tcpPortthe local TCP port to listen on or -1 to use the standard TCP port \oaram tlsConfiguration the TLS configuration or NULL when TLS is not used for this access point
Returns
true in case of success, false otherwise

◆ IedServer_create()

LIB61850_API IedServer IedServer_create ( IedModel *  dataModel)

Create a new IedServer instance.

Parameters
dataModelreference to the IedModel data structure to be used as IEC 61850 data model of the device
Returns
the new IedServer instance

◆ IedServer_createWithConfig()

LIB61850_API IedServer IedServer_createWithConfig ( IedModel *  dataModel,
TLSConfiguration  tlsConfiguration,
IedServerConfig  serverConfiguration 
)

Create new new IedServer with extended configurations parameters.

Parameters
dataModelreference to the IedModel data structure to be used as IEC 61850 data model of the device
tlsConfigurationTLS configuration object, or NULL to not use TLS
serverConfigurationIED server configuration object for advanced server configuration

◆ IedServer_createWithTlsSupport()

LIB61850_API IedServer IedServer_createWithTlsSupport ( IedModel *  dataModel,
TLSConfiguration  tlsConfiguration 
)

Create a new IedServer with TLS support.

Parameters
dataModelreference to the IedModel data structure to be used as IEC 61850 data model of the device
tlsConfigurationTLS configuration object, or NULL to not use TLS
Returns
the new IedServer instance

◆ IedServer_destroy()

LIB61850_API void IedServer_destroy ( IedServer  self)

Destroy an IedServer instance and release all resources (memory, TCP sockets)

Parameters
selfthe instance of IedServer to operate on.

◆ IedServer_disableGoosePublishing()

LIB61850_API void IedServer_disableGoosePublishing ( IedServer  self)

Disable all GOOSE control blocks.

This will set the GoEna attribute of all configured GOOSE control blocks to false. This will stop GOOSE transmission.

Note
This function has no effect when CONFIG_INCLUDE_GOOSE_SUPPORT is not set.
Parameters
selfthe instance of IedServer to operate on.

◆ IedServer_enableGoosePublishing()

LIB61850_API void IedServer_enableGoosePublishing ( IedServer  self)

Enable all GOOSE control blocks.

This will set the GoEna attribute of all configured GOOSE control blocks to true. If this method is not called at the startup or reset of the server then configured GOOSE control blocks keep inactive until a MMS client enables them by writing to the GOOSE control block.

Note
This function has no effect when CONFIG_INCLUDE_GOOSE_SUPPORT is not set.
Parameters
selfthe instance of IedServer to operate on.

◆ IedServer_getDataModel()

LIB61850_API IedModel* IedServer_getDataModel ( IedServer  self)

Return the data model of the server.

Parameters
selfthe instance of IedServer to operate on.
Returns
the IedModel* instance of the server

◆ IedServer_getMmsServer()

LIB61850_API MmsServer IedServer_getMmsServer ( IedServer  self)

Get access to the underlying MmsServer instance.

This function should be handled with care. Since direct interaction with the MmsServer can interfere with the IedServer.

Parameters
selfthe instance of IedServer to operate on.
Returns
MmsServer instance that is used by the IedServer

◆ IedServer_getNumberOfOpenConnections()

LIB61850_API int IedServer_getNumberOfOpenConnections ( IedServer  self)

Get number of open MMS connections.

Parameters
selfthe instance of IedServer to operate on
Returns
the number of open and accepted MMS connections

◆ IedServer_isRunning()

LIB61850_API bool IedServer_isRunning ( IedServer  self)

Check if IedServer instance is listening for client connections.

Parameters
selfthe instance of IedServer to operate on.
Returns
true if IedServer instance is listening for client connections

◆ IedServer_performPeriodicTasks()

LIB61850_API void IedServer_performPeriodicTasks ( IedServer  self)

perform periodic background tasks in non-threaded mode

The function should be called periodically. If the function is called more often the more accurate are internal timeouts (e.g. for reports).

Parameters
selfthe instance of IedServer to operate on.

◆ IedServer_processIncomingData()

LIB61850_API void IedServer_processIncomingData ( IedServer  self)

handle incoming TCP data in non-threaded mode

The function should be called periodically. If the function is called more often the response time for incoming messages will be faster. As an alternative the function may only be called if new TCP data is available.

Parameters
selfthe instance of IedServer to operate on.

◆ IedServer_setFilestoreBasepath()

LIB61850_API void IedServer_setFilestoreBasepath ( IedServer  self,
const char *  basepath 
)

Set the virtual filestore basepath for the MMS file services.

All external file service accesses will be mapped to paths relative to the base directory. NOTE: This function is only available when the CONFIG_SET_FILESTORE_BASEPATH_AT_RUNTIME option in stack_config.h is set.

Parameters
selfthe IedServer instance
basepaththe new virtual filestore basepath

◆ IedServer_setGooseInterfaceId()

LIB61850_API void IedServer_setGooseInterfaceId ( IedServer  self,
const char *  interfaceId 
)

Set the Ethernet interface to be used by GOOSE publishing.

This function can be used to set the GOOSE interface ID. If not used or set to NULL the default interface ID from stack_config.h is used.

Note
the interface ID is operating system specific!
This function has no effect when CONFIG_INCLUDE_GOOSE_SUPPORT is not set.
Parameters
selfthe instance of IedServer to operate on.
interfaceIdthe ID of the ethernet interface to be used for GOOSE publishing

◆ IedServer_setGooseInterfaceIdEx()

LIB61850_API void IedServer_setGooseInterfaceIdEx ( IedServer  self,
LogicalNode *  ln,
const char *  gcbName,
const char *  interfaceId 
)

Set the Ethernet interface to be used by GOOSE publishing.

This function can be used to set the GOOSE interface ID forG all CBs (parameter ln = NULL) or for a specific GCB specified by the logical node instance and the GCB name.

Note
This function has no effect when CONFIG_INCLUDE_GOOSE_SUPPORT is not set.
Parameters
selfthe instance of IedServer to operate on.
lnthe logical node that contains the GCB or NULL to set the ethernet interface ID for all GCBs
gcbNamethe name (not object reference!) of the GCB
interfaceIdthe ID of the ethernet interface to be used for GOOSE publishing

◆ IedServer_setLocalIpAddress()

LIB61850_API void IedServer_setLocalIpAddress ( IedServer  self,
const char *  localIpAddress 
)

Set the local IP address to listen on.

Parameters
selfthe IedServer instance
localIpAddressthe local IP address as C string (an internal copy will be created)

◆ IedServer_setLogStorage()

LIB61850_API void IedServer_setLogStorage ( IedServer  self,
const char *  logRef,
LogStorage  logStorage 
)

Assign a LogStorage instance to a log reference.

Note
configuration option CONFIG_IEC61850_LOG_SERVICE is required
Parameters
selfthe IedServer instance
logRefthe log reference to assign the log storage to
logStoragethe log storage instance to assign

◆ IedServer_setServerIdentity()

LIB61850_API void IedServer_setServerIdentity ( IedServer  self,
const char *  vendor,
const char *  model,
const char *  revision 
)

Set the identify for the MMS identify service.

CONFIG_IEC61850_SUPPORT_SERVER_IDENTITY required

Parameters
selfthe IedServer instance
vendorthe IED vendor name
modelthe IED model name
revisionthe IED revision/version number

◆ IedServer_setTimeQuality()

LIB61850_API void IedServer_setTimeQuality ( IedServer  self,
bool  leapSecondKnown,
bool  clockFailure,
bool  clockNotSynchronized,
int  subsecondPrecision 
)

Set the time quality for all timestamps internally generated by this IedServer instance.

You can call this function during the initialization of the server or whenever a time quality flag has to be updated (on clock failure or change of time synchronization state).

Parameters
selfthe instance of IedServer to operate on.
leapSecondKnownset/unset leap seconds known flag
clockFailureset/unset clock failure flag
clockNotSynchronizedset/unset clock not synchronized flag
subsecondPrecisionset the subsecond precision (number of significant bits of the fractionOfSecond part of the time stamp)

◆ IedServer_start()

LIB61850_API void IedServer_start ( IedServer  self,
int  tcpPort 
)

Start handling client connections.

Parameters
selfthe instance of IedServer to operate on.
tcpPortthe TCP port the server is listening (-1 for using the default MMS or secure MMS port)

◆ IedServer_startThreadless()

LIB61850_API void IedServer_startThreadless ( IedServer  self,
int  tcpPort 
)

Start handling client connection for non-threaded mode.

This function will instruct the TCP(IP stack to listen for incoming connections. In order to accept new connection the function IedServer_processIncomingData has to be called periodically.

Parameters
selfthe instance of IedServer to operate on.
tcpPortthe TCP port the server is listening (-1 for using the default MMS or secure MMS port)

◆ IedServer_stop()

LIB61850_API void IedServer_stop ( IedServer  self)

Stop handling client connections.

Parameters
selfthe instance of IedServer to operate on.

◆ IedServer_stopThreadless()

LIB61850_API void IedServer_stopThreadless ( IedServer  self)

Stop handling client connections for non-threaded mode.

Parameters
selfthe instance of IedServer to operate on.

◆ IedServer_useGooseVlanTag()

LIB61850_API void IedServer_useGooseVlanTag ( IedServer  self,
LogicalNode *  ln,
const char *  gcbName,
bool  useVlanTag 
)

Enable/disable the use of VLAN tags in GOOSE messages.

This function can be used to enable/disable VLAN tagging for all GCBs (parameter ln = NULL) or for a specific GCB specified by the logical node instance and the GCB name.

Note
This function has no effect when CONFIG_INCLUDE_GOOSE_SUPPORT is not set.
Parameters
selfthe instance of IedServer to operate on
lnthe logical node that contains the GCB or NULL to enable/disable VLAN tagging for all GCBs
gcbNamethe name (not object reference!) of the GCB
useVlanTagtrue to enable VLAN tagging, false otherwise

◆ IedServer_waitReady()

LIB61850_API int IedServer_waitReady ( IedServer  self,
unsigned int  timeoutMs 
)

Wait until a server connection is ready (with timeout)

The function will wait until a server connection is ready (data available) or the timeout elapsed. This function is intended for the non-threaded mode. Its use is optional. It is equivalent of using select on sockets on Linux. If the return value is != 0 the IedServer_processIncomingData function should be called.

Parameters
selfthe IedServer instance
timeoutMsthe timeout to wait when no connection is ready
Returns
0 if no connection is ready; otherwise at least one connection is ready