libIEC61850
0.8.2
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
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_createEmtpyArray
(
int
size);
115
116
void
117
MmsValue_setElement
(
MmsValue
* complexValue,
int
index,
MmsValue
* elementValue);
118
119
120
/*************************************************************************************
121
* Basic type functions
122
*************************************************************************************/
123
124
MmsDataAccessError
125
MmsValue_getDataAccessError
(
MmsValue
*
self
);
126
134
int64_t
135
MmsValue_toInt64
(
MmsValue
*
self
);
136
144
int32_t
145
MmsValue_toInt32
(
MmsValue
* value);
146
154
uint32_t
155
MmsValue_toUint32
(
MmsValue
* value);
156
164
double
165
MmsValue_toDouble
(
MmsValue
*
self
);
166
174
float
175
MmsValue_toFloat
(
MmsValue
*
self
);
176
184
uint32_t
185
MmsValue_toUnixTimestamp
(
MmsValue
*
self
);
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
283
MmsValue_getBoolean
(
MmsValue
* value);
284
285
char
*
286
MmsValue_toString
(
MmsValue
*
self
);
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
320
MmsValue_deleteAllBitStringBits
(
MmsValue
*
self
);
321
322
328
int
329
MmsValue_getBitStringSize
(
MmsValue
*
self
);
330
336
int
337
MmsValue_getBitStringByteSize
(
MmsValue
*
self
);
338
344
int
345
MmsValue_getNumberOfSetBits
(
MmsValue
*
self
);
346
352
void
353
MmsValue_setAllBitStringBits
(
MmsValue
*
self
);
354
363
uint32_t
364
MmsValue_getBitStringAsInteger
(
MmsValue
*
self
);
365
375
void
376
MmsValue_setBitStringFromInteger
(
MmsValue
*
self
, uint32_t intValue);
377
386
uint32_t
387
MmsValue_getBitStringAsIntegerBigEndian
(
MmsValue
*
self
);
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
438
MmsValue_getUtcTimeInMs
(
MmsValue
* value);
439
454
void
455
MmsValue_setUtcTimeQuality
(
MmsValue
*
self
, uint8_t timeQuality);
456
471
uint8_t
472
MmsValue_getUtcTimeQuality
(
MmsValue
*
self
);
473
480
void
481
MmsValue_setBinaryTime
(
MmsValue
*
self
, uint64_t timestamp);
482
490
uint64_t
491
MmsValue_getBinaryTimeAsUtcMs
(
MmsValue
*
self
);
492
504
void
505
MmsValue_setOctetString
(
MmsValue
*
self
, uint8_t* buf,
int
size);
506
514
uint16_t
515
MmsValue_getOctetStringSize
(
MmsValue
*
self
);
516
527
uint16_t
528
MmsValue_getOctetStringMaxSize
(
MmsValue
*
self
);
529
537
uint8_t*
538
MmsValue_getOctetStringBuffer
(
MmsValue
*
self
);
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
*
589
MmsValue_newDataAccessError
(
MmsDataAccessError
accessError);
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
*
623
MmsValue_createEmptyStructure
(
int
size);
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
686
MmsValue_getSizeInMemory
(
MmsValue
*
self
);
687
697
void
698
MmsValue_delete
(
MmsValue
*
self
);
699
712
void
713
MmsValue_deleteConditional
(
MmsValue
* value);
714
724
void
725
MmsValue_deleteIfNotNull
(
MmsValue
* value);
726
737
MmsValue
*
738
MmsValue_newVisibleString
(
char
*
string
);
739
751
MmsValue
*
752
MmsValue_newVisibleStringWithSize
(
int
size);
753
765
MmsValue
*
766
MmsValue_newMmsStringWithSize
(
int
size);
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
839
MmsValue_setDeletable
(
MmsValue
*
self
);
840
841
void
842
MmsValue_setDeletableRecursive
(
MmsValue
* value);
843
855
int
856
MmsValue_isDeletable
(
MmsValue
*
self
);
857
863
MmsType
864
MmsValue_getType
(
MmsValue
*
self
);
865
875
MmsValue
*
876
MmsValue_getSubElement
(
MmsValue
*
self
, MmsVariableSpecification* varSpec,
char
* mmsPath);
877
885
char
*
886
MmsValue_getTypeString
(
MmsValue
*
self
);
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_ */
Generated on Tue Nov 25 2014 15:20:11 for libIEC61850 by
1.8.4