open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
ua_types_encoding_binary.h
Go to the documentation of this file.
1/** This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 *
5 * Copyright 2014-2017 (c) Fraunhofer IOSB (Author: Julius Pfrommer)
6 * Copyright 2015 (c) Sten GrĂ¼ner
7 * Copyright 2014, 2017 (c) Florian Palm
8 * Copyright 2017 (c) Stefan Profanter, fortiss GmbH
9 * Copyright 2017 (c) Mark Giraud, Fraunhofer IOSB
10 */
11
12#ifndef UA_TYPES_ENCODING_BINARY_H_
13#define UA_TYPES_ENCODING_BINARY_H_
14
15#include <open62541/types.h>
16
18
19typedef UA_StatusCode (*UA_exchangeEncodeBuffer)(void *handle, UA_Byte **bufPos,
20 const UA_Byte **bufEnd);
21
22/** Encodes the scalar value described by type in the binary encoding. Encoding
23 * is thread-safe if thread-local variables are enabled. Encoding is also
24 * reentrant and can be safely called from signal handlers or interrupts.
25 *
26 * @param src The value. Must not be NULL.
27 * @param type The value type. Must not be NULL.
28 * @param bufPos Points to a pointer to the current position in the encoding
29 * buffer. Must not be NULL. The pointer is advanced by the number of
30 * encoded bytes, or, if the buffer is exchanged, to the position in the
31 * new buffer.
32 * @param bufEnd Points to a pointer to the end of the encoding buffer (encoding
33 * always stops before *buf_end). Must not be NULL. The pointer is
34 * changed when the buffer is exchanged.
35 * @param exchangeCallback Called when the end of the buffer is reached. This is
36 used to send out a message chunk before continuing with the encoding.
37 Is ignored if NULL.
38 * @param exchangeHandle Custom data passed into the exchangeCallback.
39 * @return Returns a statuscode whether encoding succeeded. */
41UA_encodeBinaryInternal(const void *src, const UA_DataType *type,
42 UA_Byte **bufPos, const UA_Byte **bufEnd,
43 UA_exchangeEncodeBuffer exchangeCallback,
44 void *exchangeHandle)
45 ;
46
47/** Decodes a scalar value described by type from binary encoding. Decoding
48 * is thread-safe if thread-local variables are enabled. Decoding is also
49 * reentrant and can be safely called from signal handlers or interrupts.
50 *
51 * @param src The buffer with the binary encoded value. Must not be NULL.
52 * @param offset The current position in the buffer. Must not be NULL. The value
53 * is advanced as decoding progresses.
54 * @param dst The target value. Must not be NULL. The target is assumed to have
55 * size type->memSize. The value is reset to zero before decoding. If
56 * decoding fails, members are deleted and the value is reset (zeroed)
57 * again.
58 * @param type The value type. Must not be NULL.
59 * @param customTypesSize The number of non-standard datatypes contained in the
60 * customTypes array.
61 * @param customTypes An array of non-standard datatypes (not included in
62 * UA_TYPES). Can be NULL if customTypesSize is zero.
63 * @return Returns a statuscode whether decoding succeeded. */
65UA_decodeBinaryInternal(const UA_ByteString *src, size_t *offset,
66 void *dst, const UA_DataType *type,
67 const UA_DataTypeArray *customTypes)
68 ;
69
70const UA_DataType *
72
74
75#endif /* UA_TYPES_ENCODING_BINARY_H_ */
#define _UA_BEGIN_DECLS
#undef UA_DEBUG_DUMP_PKGS
Definition config.h:89
#define _UA_END_DECLS
Definition config.h:96
Datatype arrays with custom type definitions can be added in a linked list to the client or server co...
Definition types.h:859
uint32_t UA_StatusCode
Definition types.h:77
uint8_t UA_Byte
Definition types.h:36
const UA_DataType * UA_findDataTypeByBinary(const UA_NodeId *typeId)
UA_StatusCode UA_encodeBinaryInternal(const void *src, const UA_DataType *type, UA_Byte **bufPos, const UA_Byte **bufEnd, UA_exchangeEncodeBuffer exchangeCallback, void *exchangeHandle)
Encodes the scalar value described by type in the binary encoding.
_UA_BEGIN_DECLS typedef UA_StatusCode(* UA_exchangeEncodeBuffer)(void *handle, UA_Byte **bufPos, const UA_Byte **bufEnd)
This Source Code Form is subject to the terms of the Mozilla Public License, v.
UA_StatusCode UA_decodeBinaryInternal(const UA_ByteString *src, size_t *offset, void *dst, const UA_DataType *type, const UA_DataTypeArray *customTypes)
Decodes a scalar value described by type from binary encoding.