123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- /*
- * opcua_basictypes.h
- *
- * Created on: 13.03.2014
- * Author: mrt
- */
- #ifndef OPCUA_BASICTYPES_H_
- #define OPCUA_BASICTYPES_H_
- #include <stdint.h>
- typedef uint8_t Byte;
- typedef int8_t SByte;
- typedef int16_t Int16;
- typedef int32_t Int32;
- typedef uint16_t UInt16;
- typedef uint32_t UInt32;
- typedef _Bool UA_Boolean;
- typedef int8_t UA_SByte;
- typedef uint8_t UA_Byte;
- typedef int16_t UA_Int16;
- typedef uint16_t UA_UInt16;
- typedef int32_t UA_Int32;
- typedef uint32_t UA_UInt32;
- typedef int64_t UA_Int64;
- typedef uint64_t UA_UInt64;
- typedef float UA_Float;
- typedef double UA_Double;
- #define UA_SUCCESS 0
- #define UA_TRUE (42==42)
- #define UA_FALSE (!UA_TRUE)
- Int32 UA_Boolean_calcSize(UA_Boolean const * ptr);
- Int32 UA_Boolean_encode(UA_Boolean const * src, Int32* pos, char * dst);
- Int32 UA_Boolean_decode(char const * src, Int32* pos, UA_Boolean * dst);
- /**
- * StatusCodeBinaryEncoding
- * Part: 6
- * Chapter: 5.2.2.11
- * Page: 20
- */
- typedef UA_Int32 UA_StatusCode;
- enum UA_StatusCode_enum
- {
- // Some Values are called the same as previous Enumerations so we need
- //names that are unique
- SC_Good = 0x00
- };
- UInt32 UA_StatusCode_calcSize(UA_StatusCode const * ptr);
- /**
- * VariantBinaryEncoding
- * Part: 6
- * Chapter: 5.2.2.16
- * Page: 22
- */
- typedef struct _UA_Variant {
- Byte EncodingMask; //Type of Enum UA_VariantTypeEncodingMaskType
- UA_Int32 size;
- void** data;
- } UA_Variant;
- UInt32 UA_Variant_calcSize(UA_Variant const * ptr);
- /**
- * String
- * Part: 6
- * Chapter: 5.2.2.4
- * Page: 16
- */
- typedef struct UA_String
- {
- UA_Int32 length;
- UA_Byte* data;
- }
- UA_String;
- Int32 UA_String_calcSize(UA_String const * ptr);
- /*
- * ByteString
- * Part: 6
- * Chapter: 5.2.2.7
- * Page: 17
- */
- typedef struct UA_ByteString
- {
- UA_Int32 length;
- UA_Byte* data;
- }
- UA_ByteString;
- Int32 UA_ByteString_calcSize(UA_ByteString const * ptr);
- /**
- * LocalizedTextBinaryEncoding
- * Part: 6
- * Chapter: 5.2.2.14
- * Page: 21
- */
- typedef struct UA_LocalizedText
- {
- UA_Byte EncodingMask;
- UA_String Locale;
- UA_String Text;
- }
- UA_LocalizedText;
- Int32 UA_LocalizedText_calcSize(UA_LocalizedText const * ptr);
- /* GuidType
- * Part: 6
- * Chapter: 5.2.2.6
- * Page: 17
- */
- typedef struct UA_Guid
- {
- UA_UInt32 Data1;
- UA_UInt16 Data2;
- UA_UInt16 Data3;
- UA_ByteString Data4;
- }
- UA_Guid;
- Int32 UA_Guid_calcSize(UA_Guid const * ptr);
- /**
- * DateTime
- * Part: 6
- * Chapter: 5.2.2.5
- * Page: 16
- */
- typedef UA_Int64 UA_DateTime; //100 nanosecond resolution
- Int32 UA_DataTime_calcSize(UA_DateTime const * ptr);
- /**
- * XmlElement
- * Part: 6
- * Chapter: 5.2.2.8
- * Page: 17
- */
- //Überlegung ob man es direkt als ByteString speichert oder als String
- typedef struct UA_XmlElement
- {
- UA_ByteString Data;
- }
- UA_XmlElement;
- typedef struct UA_XmlElementEncoded
- {
- UA_UInt32 Length;
- UA_Byte StartTag[3];
- UA_Byte *Message;
- UA_UInt32 EndTag[4];
- }
- UA_XmlElementEncoded;
- typedef struct _UA_NodeId
- {
- UA_Byte EncodingByte; //enum BID_NodeIdEncodingValuesType
- UA_UInt16 Namespace;
- union
- {
- UA_UInt32 Numeric;
- UA_String String;
- UA_Guid Guid;
- UA_ByteString ByteString;
- }
- Identifier;
- } UA_NodeId;
- /**
- * NodeIds
- * Part: 6
- * Chapter: 5.2.2.9
- * Table 5
- */
- enum UA_NodeIdEncodingValuesType_enum
- {
- // Some Values are called the same as previous Enumerations so we need
- // names that are unique
- NIEVT_TWO_BYTE = 0x00,
- NIEVT_FOUR_BYTE = 0x01,
- NIEVT_NUMERIC = 0x02,
- NIEVT_STRING = 0x03,
- NIEVT_GUID = 0x04,
- NIEVT_BYTESTRING = 0x05,
- NIEVT_NAMESPACE_URI_FLAG = 0x80, //Is only for ExpandedNodeId required
- NIEVT_SERVERINDEX_FLAG = 0x40 //Is only for ExpandedNodeId required
- };
- /**
- * ExpandedNodeId
- * Part: 6
- * Chapter: 5.2.2.10
- * Page: 19
- */
- typedef struct UA_ExpandedNodeId
- {
- UA_NodeId NodeId;
- UA_Int32 EncodingByte; //enum BID_NodeIdEncodingValuesType
- UA_String NamespaceUri;
- UA_UInt32 ServerIndex;
- }
- UA_ExpandedNodeId;
- /**
- * NodeIds
- * Part: 6
- * Chapter: 5.2.2.9
- * Page: 17
- */
- typedef enum UA_IdentifierType
- {
- // Some Values are called the same as previouse Enumerations so we need
- //names that are unique
- IT_NUMERIC = 0,
- IT_STRING = 1,
- IT_GUID = 2,
- IT_OPAQUE = 3
- }
- UA_IdentifierType;
- /**
- * ExtensionObjectBinaryEncoding
- * Part: 6
- * Chapter: 5.2.2.15
- * Page: 21
- */
- typedef struct _UA_ExtensionObject {
- UA_NodeId TypeId;
- UA_Byte Encoding; //Type of the enum UA_ExtensionObjectEncodingMaskType
- UA_ByteString Body;
- } UA_ExtensionObject;
- /**
- * QualifiedNameBinaryEncoding
- * Part: 6
- * Chapter: 5.2.2.13
- * Page: 20
- */
- typedef struct _UA_QualifiedName {
- UInt16 NamespaceIndex;
- UInt16 Reserved;
- UA_String Name;
- } UA_QualifiedName;
- /**
- * DataValueBinaryEncoding
- * Part: 6
- * Chapter: 5.2.2.17
- * Page: 23
- */
- typedef struct UA_DataValue {
- UA_Byte EncodingMask;
- UA_Variant Value;
- UA_StatusCode Status;
- UA_DateTime SourceTimestamp;
- UA_Int16 SourcePicoseconds;
- UA_DateTime ServerTimestamp;
- UA_Int16 ServerPicoseconds;
- } UA_DataValue;
- /**
- * DiagnoticInfoBinaryEncoding
- * Part: 6
- * Chapter: 5.2.2.12
- * Page: 20
- */
- typedef struct _UA_DiagnosticInfo {
- Byte EncodingMask; //Type of the Enum UA_DiagnosticInfoEncodingMaskType
- UA_Int32 SymbolicId;
- UA_Int32 NamespaceUri;
- UA_Int32 LocalizedText;
- UA_Int32 Locale;
- UA_String AdditionalInfo;
- UA_StatusCode InnerStatusCode;
- struct _UA_DiagnosticInfo* InnerDiagnosticInfo;
- } UA_DiagnosticInfo;
- enum UA_DiagnosticInfoEncodingMaskType_enum
- {
- // Some Values are called the same as previous Enumerations so we need
- //names that are unique
- DIEMT_SYMBOLIC_ID = 0x01,
- DIEMT_NAMESPACE = 0x02,
- DIEMT_LOCALIZED_TEXT = 0x04,
- DIEMT_LOCALE = 0x08,
- DIEMT_ADDITIONAL_INFO = 0x10,
- DIEMT_INNER_STATUS_CODE = 0x20,
- DIEMT_INNER_DIAGNOSTIC_INFO = 0x40
- };
- Int32 UA_Array_calcSize(Int32 noElements, Int32 type, void const ** ptr);
- #endif /* OPCUA_BASICTYPES_H_ */
|