diff --git a/lib60870-C/examples/cs101_master_balanced/master_example.c b/lib60870-C/examples/cs101_master_balanced/master_example.c index 283b7655..c3045b54 100644 --- a/lib60870-C/examples/cs101_master_balanced/master_example.c +++ b/lib60870-C/examples/cs101_master_balanced/master_example.c @@ -2,9 +2,6 @@ * master_example.c */ - -#include "iec60870_master.h" -#include "iec60870_common.h" #include "hal_time.h" #include "hal_thread.h" #include "hal_serial.h" diff --git a/lib60870-C/examples/cs101_master_unbalanced/master_example.c b/lib60870-C/examples/cs101_master_unbalanced/master_example.c index d28e1d12..63b958fa 100644 --- a/lib60870-C/examples/cs101_master_unbalanced/master_example.c +++ b/lib60870-C/examples/cs101_master_unbalanced/master_example.c @@ -2,9 +2,6 @@ * master_example.c */ - -#include "iec60870_master.h" -#include "iec60870_common.h" #include "hal_time.h" #include "hal_thread.h" #include "hal_serial.h" diff --git a/lib60870-C/examples/multi_client_server/multi_client_server.c b/lib60870-C/examples/multi_client_server/multi_client_server.c index de59bf1b..18606bd2 100644 --- a/lib60870-C/examples/multi_client_server/multi_client_server.c +++ b/lib60870-C/examples/multi_client_server/multi_client_server.c @@ -4,7 +4,6 @@ #include #include -#include "iec60870_slave.h" #include "cs104_slave.h" #include "hal_thread.h" diff --git a/lib60870-C/examples/tls_server/tls_server.c b/lib60870-C/examples/tls_server/tls_server.c index 14481277..e156a927 100644 --- a/lib60870-C/examples/tls_server/tls_server.c +++ b/lib60870-C/examples/tls_server/tls_server.c @@ -4,7 +4,6 @@ #include #include -#include "iec60870_slave.h" #include "cs104_slave.h" #include "hal_thread.h" diff --git a/lib60870-C/src/inc/api/cs101_information_objects.h b/lib60870-C/src/inc/api/cs101_information_objects.h index cac9172c..19339a9c 100644 --- a/lib60870-C/src/inc/api/cs101_information_objects.h +++ b/lib60870-C/src/inc/api/cs101_information_objects.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -22,6 +22,8 @@ #ifndef SRC_INC_INFORMATION_OBJECTS_H_ #define SRC_INC_INFORMATION_OBJECTS_H_ +#include "iec60870_common.h" + #ifdef __cplusplus extern "C" { #endif @@ -38,95 +40,6 @@ extern "C" { * @{ */ -/** - * \brief Message type IDs - */ -typedef enum { - M_SP_NA_1 = 1, - M_SP_TA_1 = 2, - M_DP_NA_1 = 3, - M_DP_TA_1 = 4, - M_ST_NA_1 = 5, - M_ST_TA_1 = 6, - M_BO_NA_1 = 7, - M_BO_TA_1 = 8, - M_ME_NA_1 = 9, - M_ME_TA_1 = 10, - M_ME_NB_1 = 11, - M_ME_TB_1 = 12, - M_ME_NC_1 = 13, - M_ME_TC_1 = 14, - M_IT_NA_1 = 15, - M_IT_TA_1 = 16, - M_EP_TA_1 = 17, - M_EP_TB_1 = 18, - M_EP_TC_1 = 19, - M_PS_NA_1 = 20, - M_ME_ND_1 = 21, - M_SP_TB_1 = 30, - M_DP_TB_1 = 31, - M_ST_TB_1 = 32, - M_BO_TB_1 = 33, - M_ME_TD_1 = 34, - M_ME_TE_1 = 35, - M_ME_TF_1 = 36, - M_IT_TB_1 = 37, - M_EP_TD_1 = 38, - M_EP_TE_1 = 39, - M_EP_TF_1 = 40, - S_IT_TC_1 = 41, - C_SC_NA_1 = 45, - C_DC_NA_1 = 46, - C_RC_NA_1 = 47, - C_SE_NA_1 = 48, - C_SE_NB_1 = 49, - C_SE_NC_1 = 50, - C_BO_NA_1 = 51, - C_SC_TA_1 = 58, - C_DC_TA_1 = 59, - C_RC_TA_1 = 60, - C_SE_TA_1 = 61, - C_SE_TB_1 = 62, - C_SE_TC_1 = 63, - C_BO_TA_1 = 64, - M_EI_NA_1 = 70, - S_CH_NA_1 = 81, - S_RP_NA_1 = 82, - S_AR_NA_1 = 83, - S_KR_NA_1 = 84, - S_KS_NA_1 = 85, - S_KC_NA_1 = 86, - S_ER_NA_1 = 87, - S_US_NA_1 = 90, - S_UQ_NA_1 = 91, - S_UR_NA_1 = 92, - S_UK_NA_1 = 93, - S_UA_NA_1 = 94, - S_UC_NA_1 = 95, - C_IC_NA_1 = 100, - C_CI_NA_1 = 101, - C_RD_NA_1 = 102, - C_CS_NA_1 = 103, - C_TS_NA_1 = 104, - C_RP_NA_1 = 105, - C_CD_NA_1 = 106, - C_TS_TA_1 = 107, - P_ME_NA_1 = 110, - P_ME_NB_1 = 111, - P_ME_NC_1 = 112, - P_AC_NA_1 = 113, - F_FR_NA_1 = 120, - F_SR_NA_1 = 121, - F_SC_NA_1 = 122, - F_LS_NA_1 = 123, - F_AF_NA_1 = 124, - F_SG_NA_1 = 125, - F_DR_TA_1 = 126, - F_SC_NB_1 = 127 -} IEC60870_5_TypeID; - -typedef IEC60870_5_TypeID TypeID; - const char* TypeID_toString(TypeID self); @@ -374,8 +287,6 @@ StatusAndStatusChangeDetection_getCD(StatusAndStatusChangeDetection self, int in * InformationObject ************************************************/ -typedef struct sInformationObject* InformationObject; - /** * \brief return the size in memory of a generic InformationObject instance * diff --git a/lib60870-C/src/inc/api/iec60870_common.h b/lib60870-C/src/inc/api/iec60870_common.h index b9c0efc2..1f832d16 100644 --- a/lib60870-C/src/inc/api/iec60870_common.h +++ b/lib60870-C/src/inc/api/iec60870_common.h @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 MZ Automation GmbH + * Copyright 2016-2022 Michael Zillgith * * This file is part of lib60870-C * @@ -119,6 +119,97 @@ struct sCS101_AppLayerParameters { int maxSizeOfASDU; /* maximum size of the ASDU that is generated - the maximum maximum value is 249 for IEC 104 and 254 for IEC 101 */ }; +/** + * \brief Message type IDs + */ +typedef enum { + M_SP_NA_1 = 1, + M_SP_TA_1 = 2, + M_DP_NA_1 = 3, + M_DP_TA_1 = 4, + M_ST_NA_1 = 5, + M_ST_TA_1 = 6, + M_BO_NA_1 = 7, + M_BO_TA_1 = 8, + M_ME_NA_1 = 9, + M_ME_TA_1 = 10, + M_ME_NB_1 = 11, + M_ME_TB_1 = 12, + M_ME_NC_1 = 13, + M_ME_TC_1 = 14, + M_IT_NA_1 = 15, + M_IT_TA_1 = 16, + M_EP_TA_1 = 17, + M_EP_TB_1 = 18, + M_EP_TC_1 = 19, + M_PS_NA_1 = 20, + M_ME_ND_1 = 21, + M_SP_TB_1 = 30, + M_DP_TB_1 = 31, + M_ST_TB_1 = 32, + M_BO_TB_1 = 33, + M_ME_TD_1 = 34, + M_ME_TE_1 = 35, + M_ME_TF_1 = 36, + M_IT_TB_1 = 37, + M_EP_TD_1 = 38, + M_EP_TE_1 = 39, + M_EP_TF_1 = 40, + S_IT_TC_1 = 41, + C_SC_NA_1 = 45, + C_DC_NA_1 = 46, + C_RC_NA_1 = 47, + C_SE_NA_1 = 48, + C_SE_NB_1 = 49, + C_SE_NC_1 = 50, + C_BO_NA_1 = 51, + C_SC_TA_1 = 58, + C_DC_TA_1 = 59, + C_RC_TA_1 = 60, + C_SE_TA_1 = 61, + C_SE_TB_1 = 62, + C_SE_TC_1 = 63, + C_BO_TA_1 = 64, + M_EI_NA_1 = 70, + S_CH_NA_1 = 81, + S_RP_NA_1 = 82, + S_AR_NA_1 = 83, + S_KR_NA_1 = 84, + S_KS_NA_1 = 85, + S_KC_NA_1 = 86, + S_ER_NA_1 = 87, + S_US_NA_1 = 90, + S_UQ_NA_1 = 91, + S_UR_NA_1 = 92, + S_UK_NA_1 = 93, + S_UA_NA_1 = 94, + S_UC_NA_1 = 95, + C_IC_NA_1 = 100, + C_CI_NA_1 = 101, + C_RD_NA_1 = 102, + C_CS_NA_1 = 103, + C_TS_NA_1 = 104, + C_RP_NA_1 = 105, + C_CD_NA_1 = 106, + C_TS_TA_1 = 107, + P_ME_NA_1 = 110, + P_ME_NB_1 = 111, + P_ME_NC_1 = 112, + P_AC_NA_1 = 113, + F_FR_NA_1 = 120, + F_SR_NA_1 = 121, + F_SC_NA_1 = 122, + F_LS_NA_1 = 123, + F_AF_NA_1 = 124, + F_SG_NA_1 = 125, + F_DR_TA_1 = 126, + F_SC_NB_1 = 127 +} IEC60870_5_TypeID; + +typedef IEC60870_5_TypeID TypeID; + +typedef struct sInformationObject* InformationObject; + /** * \brief Application Service Data Unit (ASDU) for the CS101/CS104 application layer */