mms_common.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * mms_common.h
  3. *
  4. * Copyright 2013-2018 Michael Zillgith
  5. *
  6. * This file is part of libIEC61850.
  7. *
  8. * libIEC61850 is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * libIEC61850 is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with libIEC61850. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. * See COPYING file for the complete license text.
  22. */
  23. #include "libiec61850_common_api.h"
  24. #ifndef MMS_COMMON_H_
  25. #define MMS_COMMON_H_
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /**
  30. * \addtogroup common_api_group
  31. */
  32. /**@{*/
  33. typedef enum
  34. {
  35. /* generic error codes */
  36. MMS_ERROR_NONE = 0,
  37. MMS_ERROR_CONNECTION_REJECTED = 1,
  38. MMS_ERROR_CONNECTION_LOST = 2,
  39. MMS_ERROR_SERVICE_TIMEOUT = 3,
  40. MMS_ERROR_PARSING_RESPONSE = 4,
  41. MMS_ERROR_HARDWARE_FAULT = 5,
  42. MMS_ERROR_CONCLUDE_REJECTED = 6,
  43. MMS_ERROR_INVALID_ARGUMENTS = 7,
  44. MMS_ERROR_OUTSTANDING_CALL_LIMIT = 8,
  45. MMS_ERROR_OTHER = 9,
  46. /* confirmed error PDU codes */
  47. MMS_ERROR_VMDSTATE_OTHER = 10,
  48. MMS_ERROR_APPLICATION_REFERENCE_OTHER = 20,
  49. MMS_ERROR_DEFINITION_OTHER = 30,
  50. MMS_ERROR_DEFINITION_INVALID_ADDRESS = 31,
  51. MMS_ERROR_DEFINITION_TYPE_UNSUPPORTED = 32,
  52. MMS_ERROR_DEFINITION_TYPE_INCONSISTENT = 33,
  53. MMS_ERROR_DEFINITION_OBJECT_UNDEFINED = 34,
  54. MMS_ERROR_DEFINITION_OBJECT_EXISTS = 35,
  55. MMS_ERROR_DEFINITION_OBJECT_ATTRIBUTE_INCONSISTENT = 36,
  56. MMS_ERROR_RESOURCE_OTHER = 40,
  57. MMS_ERROR_RESOURCE_CAPABILITY_UNAVAILABLE = 41,
  58. MMS_ERROR_SERVICE_OTHER = 50,
  59. MMS_ERROR_SERVICE_OBJECT_CONSTRAINT_CONFLICT = 55,
  60. MMS_ERROR_SERVICE_PREEMPT_OTHER = 60,
  61. MMS_ERROR_TIME_RESOLUTION_OTHER = 70,
  62. MMS_ERROR_ACCESS_OTHER = 80,
  63. MMS_ERROR_ACCESS_OBJECT_NON_EXISTENT = 81,
  64. MMS_ERROR_ACCESS_OBJECT_ACCESS_UNSUPPORTED = 82,
  65. MMS_ERROR_ACCESS_OBJECT_ACCESS_DENIED = 83,
  66. MMS_ERROR_ACCESS_OBJECT_INVALIDATED = 84,
  67. MMS_ERROR_ACCESS_OBJECT_VALUE_INVALID = 85, /* for DataAccessError 11 */
  68. MMS_ERROR_ACCESS_TEMPORARILY_UNAVAILABLE = 86, /* for DataAccessError 2 */
  69. MMS_ERROR_FILE_OTHER = 90,
  70. MMS_ERROR_FILE_FILENAME_AMBIGUOUS = 91,
  71. MMS_ERROR_FILE_FILE_BUSY = 92,
  72. MMS_ERROR_FILE_FILENAME_SYNTAX_ERROR = 93,
  73. MMS_ERROR_FILE_CONTENT_TYPE_INVALID = 94,
  74. MMS_ERROR_FILE_POSITION_INVALID = 95,
  75. MMS_ERROR_FILE_FILE_ACCESS_DENIED = 96,
  76. MMS_ERROR_FILE_FILE_NON_EXISTENT = 97,
  77. MMS_ERROR_FILE_DUPLICATE_FILENAME = 98,
  78. MMS_ERROR_FILE_INSUFFICIENT_SPACE_IN_FILESTORE = 99,
  79. /* reject codes */
  80. MMS_ERROR_REJECT_OTHER = 100,
  81. MMS_ERROR_REJECT_UNKNOWN_PDU_TYPE = 101,
  82. MMS_ERROR_REJECT_INVALID_PDU = 102,
  83. MMS_ERROR_REJECT_UNRECOGNIZED_SERVICE = 103,
  84. MMS_ERROR_REJECT_UNRECOGNIZED_MODIFIER = 104,
  85. MMS_ERROR_REJECT_REQUEST_INVALID_ARGUMENT = 105
  86. } MmsError;
  87. typedef enum
  88. {
  89. /*! this represents all MMS array types (arrays contain uniform elements) */
  90. MMS_ARRAY = 0,
  91. /*! this represents all complex MMS types (structures) */
  92. MMS_STRUCTURE = 1,
  93. /*! boolean value */
  94. MMS_BOOLEAN = 2,
  95. /*! bit string */
  96. MMS_BIT_STRING = 3,
  97. /*! represents all signed integer types */
  98. MMS_INTEGER = 4,
  99. /*! represents all unsigned integer types */
  100. MMS_UNSIGNED = 5,
  101. /*! represents all float type (32 and 64 bit) */
  102. MMS_FLOAT = 6,
  103. /*! octet string (unstructured bytes) */
  104. MMS_OCTET_STRING = 7,
  105. /*! MMS visible string */
  106. MMS_VISIBLE_STRING = 8,
  107. MMS_GENERALIZED_TIME = 9,
  108. MMS_BINARY_TIME = 10,
  109. MMS_BCD = 11,
  110. MMS_OBJ_ID = 12,
  111. /*! MMS unicode string */
  112. MMS_STRING = 13,
  113. /*! MMS UTC time type */
  114. MMS_UTC_TIME = 14,
  115. /*! This represents an error code as returned by MMS read services */
  116. MMS_DATA_ACCESS_ERROR = 15
  117. } MmsType;
  118. typedef struct sMmsDomain MmsDomain;
  119. typedef struct sMmsAccessSpecifier
  120. {
  121. MmsDomain* domain;
  122. char* variableName;
  123. int arrayIndex; /* -1 --> no index present / ignore index */
  124. char* componentName;
  125. } MmsAccessSpecifier;
  126. typedef struct
  127. {
  128. char* domainId;
  129. char* itemId;
  130. int32_t arrayIndex; /* -1 --> no index present / ignore index */
  131. char* componentName;
  132. } MmsVariableAccessSpecification;
  133. typedef struct sMmsNamedVariableList* MmsNamedVariableList;
  134. typedef struct sMmsAccessSpecifier* MmsNamedVariableListEntry;
  135. /**
  136. * \brief ITU (International Telecommunication Union) object identifier (OID)
  137. */
  138. typedef struct {
  139. uint16_t arc[10];
  140. int arcCount;
  141. } ItuObjectIdentifier;
  142. /**
  143. * \brief ISO application reference (specifies an ISO application endpoint)
  144. */
  145. typedef struct {
  146. ItuObjectIdentifier apTitle;
  147. int aeQualifier;
  148. } IsoApplicationReference;
  149. /**@}*/
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. #endif /* MMS_COMMON_H_ */