libIEC61850  0.8.4
Open-source IEC 61850 MMS/GOOSE server and client library
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mms_value.h
Go to the documentation of this file.
1 /*
2  * mms_value.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_VALUE_H_
25 #define MMS_VALUE_H_
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include "libiec61850_common_api.h"
32 #include "mms_common.h"
33 #include "mms_types.h"
34 #include "ber_integer.h"
35 
47 typedef enum ATTRIBUTE_PACKED {
48  DATA_ACCESS_ERROR_NO_RESPONSE = -2, /* for server internal purposes only! */
64 
68 typedef struct sMmsValue MmsValue;
69 
70 /*************************************************************************************
71  * Array functions
72  *************************************************************************************/
73 
82 MmsValue*
83 MmsValue_createArray(MmsVariableSpecification* elementType, int size);
84 
92 uint32_t
94 
103 MmsValue*
104 MmsValue_getElement(MmsValue* array, int index);
105 
113 MmsValue*
114 MmsValue_createEmptyArray(int size);
115 
126 void
127 MmsValue_setElement(MmsValue* complexValue, int index, MmsValue* elementValue);
128 
129 
130 /*************************************************************************************
131  * Basic type functions
132  *************************************************************************************/
133 
136 
144 int64_t
145 MmsValue_toInt64(const MmsValue* self);
146 
154 int32_t
155 MmsValue_toInt32(const MmsValue* value);
156 
164 uint32_t
165 MmsValue_toUint32(const MmsValue* value);
166 
174 double
175 MmsValue_toDouble(const MmsValue* self);
176 
184 float
185 MmsValue_toFloat(const MmsValue* self);
186 
194 uint32_t
196 
202 void
203 MmsValue_setFloat(MmsValue* self, float newFloatValue);
204 
210 void
211 MmsValue_setDouble(MmsValue* self, double newFloatValue);
212 
219 void
220 MmsValue_setInt8(MmsValue* value, int8_t integer);
221 
228 void
229 MmsValue_setInt16(MmsValue* value, int16_t integer);
230 
237 void
238 MmsValue_setInt32(MmsValue* self, int32_t integer);
239 
246 void
247 MmsValue_setInt64(MmsValue* value, int64_t integer);
248 
255 void
256 MmsValue_setUint8(MmsValue* value, uint8_t integer);
257 
264 void
265 MmsValue_setUint16(MmsValue* value, uint16_t integer);
266 
273 void
274 MmsValue_setUint32(MmsValue* value, uint32_t integer);
275 
276 
283 void
284 MmsValue_setBoolean(MmsValue* value, bool boolValue);
285 
292 bool
293 MmsValue_getBoolean(const MmsValue* value);
294 
295 char*
297 
298 void
299 MmsValue_setVisibleString(MmsValue* self, const char* string);
300 
301 
310 void
311 MmsValue_setBitStringBit(MmsValue* self, int bitPos, bool value);
312 
321 bool
322 MmsValue_getBitStringBit(const MmsValue* self, int bitPos);
323 
329 void
331 
332 
338 int
340 
346 int
348 
354 int
356 
362 void
364 
373 uint32_t
375 
385 void
386 MmsValue_setBitStringFromInteger(MmsValue* self, uint32_t intValue);
387 
396 uint32_t
398 
408 void
409 MmsValue_setBitStringFromIntegerBigEndian(MmsValue* self, uint32_t intValue);
410 
417 MmsValue*
418 MmsValue_setUtcTime(MmsValue* self, uint32_t timeval);
419 
426 MmsValue*
427 MmsValue_setUtcTimeMs(MmsValue* self, uint64_t timeval);
428 
437 void
438 MmsValue_setUtcTimeByBuffer(MmsValue* self, const uint8_t* buffer);
439 
449 uint8_t*
451 
459 uint64_t
460 MmsValue_getUtcTimeInMs(const MmsValue* value);
461 
476 void
477 MmsValue_setUtcTimeQuality(MmsValue* self, uint8_t timeQuality);
478 
493 uint8_t
495 
502 void
503 MmsValue_setBinaryTime(MmsValue* self, uint64_t timestamp);
504 
512 uint64_t
514 
526 void
527 MmsValue_setOctetString(MmsValue* self, uint8_t* buf, int size);
528 
536 uint16_t
538 
549 uint16_t
551 
559 uint8_t*
561 
573 bool
574 MmsValue_update(MmsValue* self, const MmsValue* source);
575 
587 bool
588 MmsValue_equals(const MmsValue* self, const MmsValue* otherValue);
589 
602 bool
603 MmsValue_equalTypes(const MmsValue* self, const MmsValue* otherValue);
604 
605 /*************************************************************************************
606  * Constructors and destructors
607  *************************************************************************************/
608 
609 
610 MmsValue*
612 
613 MmsValue*
614 MmsValue_newIntegerFromBerInteger(Asn1PrimitiveValue* berInteger);
615 
616 MmsValue*
617 MmsValue_newUnsignedFromBerInteger(Asn1PrimitiveValue* berInteger);
618 
619 MmsValue*
620 MmsValue_newInteger(int size);
621 
622 MmsValue*
623 MmsValue_newUnsigned(int size);
624 
625 MmsValue*
626 MmsValue_newBoolean(bool boolean);
627 
635 MmsValue*
636 MmsValue_newBitString(int bitSize);
637 
638 MmsValue*
639 MmsValue_newOctetString(int size, int maxSize);
640 
641 MmsValue*
642 MmsValue_newStructure(MmsVariableSpecification* typeSpec);
643 
644 MmsValue*
646 
647 MmsValue*
648 MmsValue_newDefaultValue(MmsVariableSpecification* typeSpec);
649 
650 MmsValue*
651 MmsValue_newIntegerFromInt8(int8_t integer);
652 
653 MmsValue*
654 MmsValue_newIntegerFromInt16(int16_t integer);
655 
656 MmsValue*
657 MmsValue_newIntegerFromInt32(int32_t integer);
658 
659 MmsValue*
660 MmsValue_newIntegerFromInt64(int64_t integer);
661 
662 MmsValue*
663 MmsValue_newUnsignedFromUint32(uint32_t integer);
664 
665 MmsValue*
666 MmsValue_newFloat(float variable);
667 
668 MmsValue*
669 MmsValue_newDouble(double variable);
670 
681 MmsValue*
682 MmsValue_clone(MmsValue* self);
683 
694 uint8_t*
695 MmsValue_cloneToBuffer(MmsValue* self, uint8_t* destinationAddress);
696 
707 int
709 
719 void
721 
734 void
736 
746 void
748 
759 MmsValue*
760 MmsValue_newVisibleString(const char* string);
761 
773 MmsValue*
775 
787 MmsValue*
789 
801 MmsValue*
802 MmsValue_newBinaryTime(bool timeOfDay);
803 
812 MmsValue*
813 MmsValue_newVisibleStringFromByteArray(uint8_t* byteArray, int size);
814 
823 MmsValue*
824 MmsValue_newMmsStringFromByteArray(uint8_t* byteArray, int size);
825 
833 MmsValue*
834 MmsValue_newMmsString(char* string);
835 
836 void
837 MmsValue_setMmsString(MmsValue* value, const char* string);
838 
846 MmsValue*
847 MmsValue_newUtcTime(uint32_t timeval);
848 
856 MmsValue*
857 MmsValue_newUtcTimeByMsTime(uint64_t timeval);
858 
859 
860 void
862 
863 void
865 
877 int
879 
885 MmsType
887 
897 MmsValue*
898 MmsValue_getSubElement(MmsValue* self, MmsVariableSpecification* varSpec, char* mmsPath);
899 
907 char*
909 
910 char*
911 MmsValue_printToBuffer(MmsValue* self, char* buffer, int bufferSize);
912 
917 #ifdef __cplusplus
918 }
919 #endif
920 
921 #endif /* MMS_VALUE_H_ */