libIEC61850
Open-source IEC 61850 MMS server and client library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
mms_types.h
Go to the documentation of this file.
1 /*
2  * mms_types.h
3  *
4  * Copyright 2013 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 
24 #ifndef MMS_TYPES_H_
25 #define MMS_TYPES_H_
26 
27 #include <stdint.h>
28 #include "ber_integer.h"
29 
30 typedef enum {
35 
39 typedef struct sMmsValue MmsValue;
40 
41 struct sMmsValue {
42  MmsType type;
44  union uMmsValue {
45  struct {
46  uint32_t code;
48  struct {
49  int size;
50  MmsValue** components;
51  } array;
52  struct {
54  MmsValue** components;
55  } structure;
56  int boolean;
57  Asn1PrimitiveValue* integer;
58  Asn1PrimitiveValue* unsignedInteger;
59  struct {
60  uint8_t exponentWidth;
61  uint8_t formatWidth;
62  uint8_t* buf;
63  } floatingPoint;
64  struct {
65  uint16_t size;
66  uint16_t maxSize;
67  uint8_t* buf;
68  } octetString;
69  struct {
70  int size; /* Number of bits */
71  uint8_t* buf;
72  } bitString;
73  char* mmsString;
75  uint8_t utcTime[8];
76  struct {
77  uint8_t size;
78  uint8_t buf[6];
79  } binaryTime;
80  } value;
81 };
82 
86 typedef struct sMmsTypeSpecification MmsTypeSpecification;
87 
89  MmsType type;
90  char* name;
92  struct sMmsArray {
93  int elementCount; /* number of array elements */
94  MmsTypeSpecification* elementTypeSpec;
95  } array;
96  struct sMmsStructure {
98  MmsTypeSpecification** elements;
99  } structure;
100  int boolean; /* dummy - not required */
101  int integer; /* size of integer in bits */
102  int unsignedInteger; /* size of integer in bits */
103  struct sMmsFloat {
104  uint8_t exponentWidth;
105  uint8_t formatWidth;
106  } floatingpoint;
107  int bitString; /* Number of bits in bitstring */
108  int octetString; /* Number of octets in octet string */
109  int visibleString; /* Maximum size of string */
111  int utctime; /* dummy - not required */
112  int binaryTime; /* size: either 4 or 6 */
113  } typeSpec;
114 };
115 
116 
117 #endif /* MMS_TYPES_H_ */