libIEC61850  0.8.3
Open-source IEC 61850 MMS/GOOSE server and client library
 All Classes Files Functions Variables Typedefs Enumerations Enumerator 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_createEmtpyArray(int size);
115 
116 void
117 MmsValue_setElement(MmsValue* complexValue, int index, MmsValue* elementValue);
118 
119 
120 /*************************************************************************************
121  * Basic type functions
122  *************************************************************************************/
123 
126 
134 int64_t
136 
144 int32_t
145 MmsValue_toInt32(MmsValue* value);
146 
154 uint32_t
156 
164 double
166 
174 float
176 
184 uint32_t
186 
192 void
193 MmsValue_setFloat(MmsValue* self, float newFloatValue);
194 
200 void
201 MmsValue_setDouble(MmsValue* self, double newFloatValue);
202 
209 void
210 MmsValue_setInt8(MmsValue* value, int8_t integer);
211 
218 void
219 MmsValue_setInt16(MmsValue* value, int16_t integer);
220 
227 void
228 MmsValue_setInt32(MmsValue* self, int32_t integer);
229 
236 void
237 MmsValue_setInt64(MmsValue* value, int64_t integer);
238 
245 void
246 MmsValue_setUint8(MmsValue* value, uint8_t integer);
247 
254 void
255 MmsValue_setUint16(MmsValue* value, uint16_t integer);
256 
263 void
264 MmsValue_setUint32(MmsValue* value, uint32_t integer);
265 
266 
273 void
274 MmsValue_setBoolean(MmsValue* value, bool boolValue);
275 
282 bool
284 
285 char*
287 
288 void
289 MmsValue_setVisibleString(MmsValue* self, char* string);
290 
291 
300 void
301 MmsValue_setBitStringBit(MmsValue* self, int bitPos, bool value);
302 
311 bool
312 MmsValue_getBitStringBit(MmsValue* self, int bitPos);
313 
319 void
321 
322 
328 int
330 
336 int
338 
344 int
346 
352 void
354 
363 uint32_t
365 
375 void
376 MmsValue_setBitStringFromInteger(MmsValue* self, uint32_t intValue);
377 
386 uint32_t
388 
398 void
399 MmsValue_setBitStringFromIntegerBigEndian(MmsValue* self, uint32_t intValue);
400 
407 MmsValue*
408 MmsValue_setUtcTime(MmsValue* self, uint32_t timeval);
409 
416 MmsValue*
417 MmsValue_setUtcTimeMs(MmsValue* self, uint64_t timeval);
418 
427 void
428 MmsValue_setUtcTimeByBuffer(MmsValue* self, uint8_t* buffer);
429 
437 uint64_t
439 
454 void
455 MmsValue_setUtcTimeQuality(MmsValue* self, uint8_t timeQuality);
456 
471 uint8_t
473 
480 void
481 MmsValue_setBinaryTime(MmsValue* self, uint64_t timestamp);
482 
490 uint64_t
492 
504 void
505 MmsValue_setOctetString(MmsValue* self, uint8_t* buf, int size);
506 
514 uint16_t
516 
527 uint16_t
529 
537 uint8_t*
539 
551 bool
552 MmsValue_update(MmsValue* self, MmsValue* source);
553 
565 bool
566 MmsValue_equals(MmsValue* self, MmsValue* otherValue);
567 
580 bool
581 MmsValue_equalTypes(MmsValue* self, MmsValue* otherValue);
582 
583 /*************************************************************************************
584  * Constructors and destructors
585  *************************************************************************************/
586 
587 
588 MmsValue*
590 
591 MmsValue*
592 MmsValue_newIntegerFromBerInteger(Asn1PrimitiveValue* berInteger);
593 
594 MmsValue*
595 MmsValue_newUnsignedFromBerInteger(Asn1PrimitiveValue* berInteger);
596 
597 MmsValue*
598 MmsValue_newInteger(int size);
599 
600 MmsValue*
601 MmsValue_newUnsigned(int size);
602 
603 MmsValue*
604 MmsValue_newBoolean(bool boolean);
605 
613 MmsValue*
614 MmsValue_newBitString(int bitSize);
615 
616 MmsValue*
617 MmsValue_newOctetString(int size, int maxSize);
618 
619 MmsValue*
620 MmsValue_newStructure(MmsVariableSpecification* typeSpec);
621 
622 MmsValue*
624 
625 MmsValue*
626 MmsValue_newDefaultValue(MmsVariableSpecification* typeSpec);
627 
628 MmsValue*
629 MmsValue_newIntegerFromInt8(int8_t integer);
630 
631 MmsValue*
632 MmsValue_newIntegerFromInt16(int16_t integer);
633 
634 MmsValue*
635 MmsValue_newIntegerFromInt32(int32_t integer);
636 
637 MmsValue*
638 MmsValue_newIntegerFromInt64(int64_t integer);
639 
640 MmsValue*
641 MmsValue_newUnsignedFromUint32(uint32_t integer);
642 
643 MmsValue*
644 MmsValue_newFloat(float variable);
645 
646 MmsValue*
647 MmsValue_newDouble(double variable);
648 
659 MmsValue*
660 MmsValue_clone(MmsValue* self);
661 
672 uint8_t*
673 MmsValue_cloneToBuffer(MmsValue* self, uint8_t* destinationAddress);
674 
685 int
687 
697 void
699 
712 void
714 
724 void
726 
737 MmsValue*
738 MmsValue_newVisibleString(char* string);
739 
751 MmsValue*
753 
765 MmsValue*
767 
779 MmsValue*
780 MmsValue_newBinaryTime(bool timeOfDay);
781 
790 MmsValue*
791 MmsValue_newVisibleStringFromByteArray(uint8_t* byteArray, int size);
792 
801 MmsValue*
802 MmsValue_newMmsStringFromByteArray(uint8_t* byteArray, int size);
803 
811 MmsValue*
812 MmsValue_newMmsString(char* string);
813 
814 void
815 MmsValue_setMmsString(MmsValue* value, char* string);
816 
824 MmsValue*
825 MmsValue_newUtcTime(uint32_t timeval);
826 
834 MmsValue*
835 MmsValue_newUtcTimeByMsTime(uint64_t timeval);
836 
837 
838 void
840 
841 void
843 
855 int
857 
863 MmsType
865 
875 MmsValue*
876 MmsValue_getSubElement(MmsValue* self, MmsVariableSpecification* varSpec, char* mmsPath);
877 
885 char*
887 
888 char*
889 MmsValue_printToBuffer(MmsValue* self, char* buffer, int bufferSize);
890 
895 #ifdef __cplusplus
896 }
897 #endif
898 
899 #endif /* MMS_VALUE_H_ */