libIEC61850
0.8.4
Open-source IEC 61850 MMS/GOOSE server and client library
Main Page
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
mms
inc
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! */
49
DATA_ACCESS_ERROR_SUCCESS
= -1,
50
DATA_ACCESS_ERROR_OBJECT_INVALIDATED
= 0,
51
DATA_ACCESS_ERROR_HARDWARE_FAULT
= 1,
52
DATA_ACCESS_ERROR_TEMPORARILY_UNAVAILABLE
= 2,
53
DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED
= 3,
54
DATA_ACCESS_ERROR_OBJECT_UNDEFINED
= 4,
55
DATA_ACCESS_ERROR_INVALID_ADDRESS
= 5,
56
DATA_ACCESS_ERROR_TYPE_UNSUPPORTED
= 6,
57
DATA_ACCESS_ERROR_TYPE_INCONSISTENT
= 7,
58
DATA_ACCESS_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT
= 8,
59
DATA_ACCESS_ERROR_OBJECT_ACCESS_UNSUPPORTED
= 9,
60
DATA_ACCESS_ERROR_OBJECT_NONE_EXISTENT
= 10,
61
DATA_ACCESS_ERROR_OBJECT_VALUE_INVALID
= 11,
62
DATA_ACCESS_ERROR_UNKNOWN
= 12
63
}
MmsDataAccessError
;
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
93
MmsValue_getArraySize
(
MmsValue
*
self
);
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
134
MmsDataAccessError
135
MmsValue_getDataAccessError
(
const
MmsValue
*
self
);
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
195
MmsValue_toUnixTimestamp
(
const
MmsValue
*
self
);
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
*
296
MmsValue_toString
(
MmsValue
*
self
);
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
330
MmsValue_deleteAllBitStringBits
(
MmsValue
*
self
);
331
332
338
int
339
MmsValue_getBitStringSize
(
const
MmsValue
*
self
);
340
346
int
347
MmsValue_getBitStringByteSize
(
const
MmsValue
*
self
);
348
354
int
355
MmsValue_getNumberOfSetBits
(
const
MmsValue
*
self
);
356
362
void
363
MmsValue_setAllBitStringBits
(
MmsValue
*
self
);
364
373
uint32_t
374
MmsValue_getBitStringAsInteger
(
const
MmsValue
*
self
);
375
385
void
386
MmsValue_setBitStringFromInteger
(
MmsValue
*
self
, uint32_t intValue);
387
396
uint32_t
397
MmsValue_getBitStringAsIntegerBigEndian
(
const
MmsValue
*
self
);
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*
450
MmsValue_getUtcTimeBuffer
(
MmsValue
*
self
);
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
494
MmsValue_getUtcTimeQuality
(
const
MmsValue
*
self
);
495
502
void
503
MmsValue_setBinaryTime
(
MmsValue
*
self
, uint64_t timestamp);
504
512
uint64_t
513
MmsValue_getBinaryTimeAsUtcMs
(
const
MmsValue
*
self
);
514
526
void
527
MmsValue_setOctetString
(
MmsValue
*
self
, uint8_t* buf,
int
size);
528
536
uint16_t
537
MmsValue_getOctetStringSize
(
const
MmsValue
*
self
);
538
549
uint16_t
550
MmsValue_getOctetStringMaxSize
(
MmsValue
*
self
);
551
559
uint8_t*
560
MmsValue_getOctetStringBuffer
(
MmsValue
*
self
);
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
*
611
MmsValue_newDataAccessError
(
MmsDataAccessError
accessError);
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
*
645
MmsValue_createEmptyStructure
(
int
size);
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
708
MmsValue_getSizeInMemory
(
MmsValue
*
self
);
709
719
void
720
MmsValue_delete
(
MmsValue
*
self
);
721
734
void
735
MmsValue_deleteConditional
(
MmsValue
* value);
736
746
void
747
MmsValue_deleteIfNotNull
(
MmsValue
* value);
748
759
MmsValue
*
760
MmsValue_newVisibleString
(
const
char
*
string
);
761
773
MmsValue
*
774
MmsValue_newVisibleStringWithSize
(
int
size);
775
787
MmsValue
*
788
MmsValue_newMmsStringWithSize
(
int
size);
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
861
MmsValue_setDeletable
(
MmsValue
*
self
);
862
863
void
864
MmsValue_setDeletableRecursive
(
MmsValue
* value);
865
877
int
878
MmsValue_isDeletable
(
MmsValue
*
self
);
879
885
MmsType
886
MmsValue_getType
(
MmsValue
*
self
);
887
897
MmsValue
*
898
MmsValue_getSubElement
(
MmsValue
*
self
, MmsVariableSpecification* varSpec,
char
* mmsPath);
899
907
char
*
908
MmsValue_getTypeString
(
MmsValue
*
self
);
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_ */
Generated on Mon Feb 9 2015 11:48:53 for libIEC61850 by
1.8.4