24 #ifndef SRC_INC_API_CS104_SLAVE_H_
25 #define SRC_INC_API_CS104_SLAVE_H_
50 typedef struct sCS104_Slave* CS104_Slave;
53 CS104_MODE_SINGLE_REDUNDANCY_GROUP,
54 CS104_MODE_CONNECTION_IS_REDUNDANCY_GROUP,
55 CS104_MODE_MULTIPLE_REDUNDANCY_GROUPS
62 } eCS104_IPAddressType;
64 typedef struct sCS104_RedundancyGroup* CS104_RedundancyGroup;
77 CS104_CON_EVENT_CONNECTION_OPENED = 0,
78 CS104_CON_EVENT_CONNECTION_CLOSED = 1,
79 CS104_CON_EVENT_ACTIVATED = 2,
80 CS104_CON_EVENT_DEACTIVATED = 3
81 } CS104_PeerConnectionEvent;
222 CS104_Slave_setASDUHandler(CS104_Slave
self,
CS101_ASDUHandler handler,
void* parameter);
318 CS104_Slave_getNumberOfQueueEntries(CS104_Slave
self, CS104_RedundancyGroup redGroup);
353 CS104_RedundancyGroup
struct sCS101_ASDU * CS101_ASDU
Application Service Data Unit (ASDU) for the CS101/CS104 application layer.
Definition: iec60870_common.h:216
void CS104_Slave_start(CS104_Slave self)
Start the CS 104 slave. The slave (server) will listen on the configured TCP/IP port.
void CS104_RedundancyGroup_destroy(CS104_RedundancyGroup self)
Destroy the instance and release all resources.
void(* CS104_SlaveRawMessageHandler)(void *parameter, IMasterConnection connection, uint8_t *msg, int msgSize, bool send)
Callback handler for sent and received messages.
Definition: cs104_slave.h:106
void CS104_Slave_setLocalPort(CS104_Slave self, int tcpPort)
Set the local TCP port to bind the server.
CS104_APCIParameters CS104_Slave_getConnectionParameters(CS104_Slave self)
Get the APCI parameters instance. APCI parameters are CS 104 specific parameters.
CS104_Slave CS104_Slave_create(int maxLowPrioQueueSize, int maxHighPrioQueueSize)
Create a new instance of a CS104 slave (server)
void CS104_Slave_destroy(CS104_Slave self)
Delete the slave instance. Release all resources.
void CS104_Slave_setLocalAddress(CS104_Slave self, const char *ipAddress)
Set the local IP address to bind the server use "0.0.0.0" to bind to all interfaces.
void CS104_Slave_setServerMode(CS104_Slave self, CS104_ServerMode serverMode)
Set one of the server modes.
void CS104_RedundancyGroup_addAllowedClient(CS104_RedundancyGroup self, const char *ipAddress)
Add an allowed client to the redundancy group.
void CS104_Slave_startThreadless(CS104_Slave self)
Start the slave (server) in non-threaded mode.
int CS104_Slave_getOpenConnections(CS104_Slave self)
Get the number of connected clients.
void CS104_Slave_setConnectionRequestHandler(CS104_Slave self, CS104_ConnectionRequestHandler handler, void *parameter)
Set the connection request handler.
void CS104_Slave_tick(CS104_Slave self)
Protocol stack tick function for non-threaded mode.
void CS104_Slave_stop(CS104_Slave self)
Stop the server.
void(* CS104_ConnectionEventHandler)(void *parameter, IMasterConnection connection, CS104_PeerConnectionEvent event)
Handler that is called when a peer connection is established or closed, or START_DT/STOP_DT is issued...
Definition: cs104_slave.h:91
CS104_Slave CS104_Slave_createSecure(int maxLowPrioQueueSize, int maxHighPrioQueueSize, TLSConfiguration tlsConfig)
Create a new instance of a CS104 slave (server) with TLS enabled.
void CS104_Slave_stopThreadless(CS104_Slave self)
Stop the server in non-threaded mode.
void CS104_Slave_setConnectionEventHandler(CS104_Slave self, CS104_ConnectionEventHandler handler, void *parameter)
Set the connection event handler.
void CS104_Slave_setRawMessageHandler(CS104_Slave self, CS104_SlaveRawMessageHandler handler, void *parameter)
Set the raw message callback (called when a message is sent or received)
bool(* CS104_ConnectionRequestHandler)(void *parameter, const char *ipAddress)
Connection request handler is called when a client tries to connect to the server.
Definition: cs104_slave.h:74
void CS104_Slave_addRedundancyGroup(CS104_Slave self, CS104_RedundancyGroup redundancyGroup)
Add a new redundancy group to the server.
CS101_AppLayerParameters CS104_Slave_getAppLayerParameters(CS104_Slave self)
Get the application layer parameters instance..
bool CS104_Slave_isRunning(CS104_Slave self)
Check if slave is running.
void CS104_Slave_enqueueASDU(CS104_Slave self, CS101_ASDU asdu)
Add an ASDU to the low-priority queue of the slave (use for periodic and spontaneous messages)
void CS104_Slave_setReadHandler(CS104_Slave self, CS101_ReadHandler handler, void *parameter)
set handler for read request (C_RD_NA_1 - 102)
void CS104_RedundancyGroup_addAllowedClientEx(CS104_RedundancyGroup self, const uint8_t *ipAddress, eCS104_IPAddressType addressType)
Add an allowed client to the redundancy group.
CS104_RedundancyGroup CS104_RedundancyGroup_create(const char *name)
Create a new redundancy group.
void CS104_Slave_setMaxOpenConnections(CS104_Slave self, int maxOpenConnections)
set the maximum number of open client connections allowed
bool(* CS101_ReadHandler)(void *parameter, IMasterConnection connection, CS101_ASDU asdu, int ioa)
Handler for read command (C_RD_NA_1 - 102)
Definition: iec60870_slave.h:218
bool(* CS101_InterrogationHandler)(void *parameter, IMasterConnection connection, CS101_ASDU asdu, uint8_t qoi)
Handler for interrogation command (C_IC_NA_1 - 100).
Definition: iec60870_slave.h:208
bool(* CS101_CounterInterrogationHandler)(void *parameter, IMasterConnection connection, CS101_ASDU asdu, QualifierOfCIC qcc)
Handler for counter interrogation command (C_CI_NA_1 - 101).
Definition: iec60870_slave.h:213
bool(* CS101_ASDUHandler)(void *parameter, IMasterConnection connection, CS101_ASDU asdu)
Handler for ASDUs that are not handled by other handlers (default handler)
Definition: iec60870_slave.h:248
bool(* CS101_ClockSynchronizationHandler)(void *parameter, IMasterConnection connection, CS101_ASDU asdu, CP56Time2a newTime)
Handler for clock synchronization command (C_CS_NA_1 - 103)
Definition: iec60870_slave.h:233
Common slave side definitions for IEC 60870-5-101/104 These types are used by CS101/CS104 slaves.
Definition: iec60870_common.h:112
Definition: iec60870_slave.h:179
Definition: iec60870_common.h:273
Definition: iec60870_slave.h:65