24 #ifndef SRC_IEC60870_CS101_CS101_SLAVE_H_
25 #define SRC_IEC60870_CS101_CS101_SLAVE_H_
93 int class1QueueSize,
int class2QueueSize);
struct sCS101_ASDU * CS101_ASDU
Application Service Data Unit (ASDU) for the CS101/CS104 application layer.
Definition: iec60870_common.h:216
void(* IEC60870_RawMessageHandler)(void *parameter, uint8_t *msg, int msgSize, bool sent)
Callback handler for sent and received messages.
Definition: iec60870_common.h:105
void(* IEC60870_LinkLayerStateChangedHandler)(void *parameter, int address, LinkLayerState newState)
Callback handler for link layer state changes.
Definition: iec60870_common.h:91
IEC60870_LinkLayerMode
link layer mode for serial link layers
Definition: iec60870_common.h:64
CS101_Slave CS101_Slave_create(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode)
Create a new balanced or unbalanced CS101 slave.
void CS101_Slave_setDelayAcquisitionHandler(CS101_Slave self, CS101_DelayAcquisitionHandler handler, void *parameter)
Set the handler for the delay acquisition message.
LinkLayerParameters CS101_Slave_getLinkLayerParameters(CS101_Slave self)
Returns the link layer parameters object of this slave instance.
void CS101_Slave_destroy(CS101_Slave self)
Destroy the slave instance and cleanup all resources.
CS101_AppLayerParameters CS101_Slave_getAppLayerParameters(CS101_Slave self)
Returns the application layer parameters object of this slave instance.
void CS101_Slave_enqueueUserDataClass1(CS101_Slave self, CS101_ASDU asdu)
Enqueue an ASDU into the class 1 data queue.
struct sCS101_Slave * CS101_Slave
CS101_Slave type.
Definition: cs101_slave.h:59
void CS101_Slave_stop(CS101_Slave self)
Stops the background thread that handles the link layer connections.
void CS101_Slave_setClockSyncHandler(CS101_Slave self, CS101_ClockSynchronizationHandler handler, void *parameter)
Set the handler for the clock synchronization message.
void CS101_Slave_setLinkLayerAddress(CS101_Slave self, int address)
Set the local link layer address.
void CS101_Slave_setReadHandler(CS101_Slave self, CS101_ReadHandler handler, void *parameter)
Set the handler for the read message.
bool CS101_Slave_isClass1QueueFull(CS101_Slave self)
Check if the class 1 ASDU is full.
void CS101_Slave_setLinkLayerAddressOtherStation(CS101_Slave self, int address)
Set the link layer address of the remote station.
CS101_Slave CS101_Slave_createEx(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, int class1QueueSize, int class2QueueSize)
Create a new balanced or unbalanced CS101 slave.
bool CS101_Slave_isClass2QueueFull(CS101_Slave self)
Check if the class 2 ASDU is full.
void CS101_Slave_start(CS101_Slave self)
Start a background thread that handles the link layer connections.
void CS101_Slave_setASDUHandler(CS101_Slave self, CS101_ASDUHandler handler, void *parameter)
Set the handler for a received ASDU.
void CS101_Slave_enqueueUserDataClass2(CS101_Slave self, CS101_ASDU asdu)
Enqueue an ASDU into the class 2 data queue.
void CS101_Slave_setCounterInterrogationHandler(CS101_Slave self, CS101_CounterInterrogationHandler handler, void *parameter)
Set the handler for the counter interrogation message.
void CS101_Slave_setResetCUHandler(CS101_Slave self, CS101_ResetCUHandler handler, void *parameter)
Set the handler for the reset CU (communication unit) message.
void CS101_Slave_setResetProcessHandler(CS101_Slave self, CS101_ResetProcessHandler handler, void *parameter)
Set the handler for the reset process message.
void CS101_Slave_setLinkLayerStateChanged(CS101_Slave self, IEC60870_LinkLayerStateChangedHandler handler, void *parameter)
Set a callback handler for link layer state changes.
void CS101_Slave_addPlugin(CS101_Slave self, CS101_SlavePlugin plugin)
Register a plugin instance with this slave instance.
void CS101_Slave_setDIR(CS101_Slave self, bool dir)
Set the value of the DIR bit when sending messages (only balanced mode)
void CS101_Slave_run(CS101_Slave self)
Receive a new message and run the link layer state machines.
void CS101_Slave_flushQueues(CS101_Slave self)
Remove all ASDUs from the class 1/2 data queues.
void CS101_Slave_setInterrogationHandler(CS101_Slave self, CS101_InterrogationHandler handler, void *parameter)
Set the handler for the general interrogation message.
void CS101_Slave_setIdleTimeout(CS101_Slave self, int timeoutInMs)
Set the idle timeout.
void CS101_Slave_setRawMessageHandler(CS101_Slave self, IEC60870_RawMessageHandler handler, void *parameter)
Set the raw message callback (called when a message is sent or received)
bool(* CS101_ResetProcessHandler)(void *parameter, IMasterConnection connection, CS101_ASDU asdu, uint8_t qrp)
Handler for reset process command (C_RP_NA_1 - 105)
Definition: iec60870_slave.h:238
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_DelayAcquisitionHandler)(void *parameter, IMasterConnection connection, CS101_ASDU asdu, CP16Time2a delayTime)
Handler for delay acquisition command (C_CD_NA:1 - 106)
Definition: iec60870_slave.h:243
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
void(* CS101_ResetCUHandler)(void *parameter)
Handler will be called when a link layer reset CU (communication unit) message is received.
Definition: iec60870_slave.h:203
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
Abstraction layer for serial ports. Has to be implemented for the serial link layer of CS 101.
Common definitions for IEC 60870-5-101/104 These types are used by CS101/CS104 master and slaves.
Common slave side definitions for IEC 60870-5-101/104 These types are used by CS101/CS104 slaves.
Parameters for serial link layers.
Definition: iec60870_common.h:112
Definition: iec60870_slave.h:179
Definition: link_layer_parameters.h:42