open62541 1.3.12
Open source implementation of OPC UA
Loading...
Searching...
No Matches
ua_types_encoding_json.h File Reference

Go to the source code of this file.

Data Structures

struct  CtxJson
 
struct  ParseCtx
 
struct  DecodeEntry
 

Macros

#define UA_JSON_MAXTOKENCOUNT   2048
 
#define UA_JSON_ENCODING_MAX_RECURSION   100
 

Typedefs

typedef UA_StatusCode(* encodeJsonSignature) (const void *src, const UA_DataType *type, CtxJson *ctx)
 
typedef UA_StatusCode(* decodeJsonSignature) (void *dst, const UA_DataType *type, CtxJson *ctx, ParseCtx *parseCtx)
 

Functions

size_t UA_calcSizeJsonInternal (const void *src, const UA_DataType *type, const UA_String *namespaces, size_t namespaceSize, const UA_String *serverUris, size_t serverUriSize, UA_Boolean useReversible)
 
UA_StatusCode UA_encodeJsonInternal (const void *src, const UA_DataType *type, uint8_t **bufPos, const uint8_t **bufEnd, const UA_String *namespaces, size_t namespaceSize, const UA_String *serverUris, size_t serverUriSize, UA_Boolean useReversible)
 
UA_StatusCode writeJsonObjStart (CtxJson *ctx)
 
UA_StatusCode writeJsonObjElm (CtxJson *ctx, const char *key, const void *value, const UA_DataType *type)
 
UA_StatusCode writeJsonObjEnd (CtxJson *ctx)
 
UA_StatusCode writeJsonArrStart (CtxJson *ctx)
 
UA_StatusCode writeJsonArrElm (CtxJson *ctx, const void *value, const UA_DataType *type)
 
UA_StatusCode writeJsonArrEnd (CtxJson *ctx)
 
UA_StatusCode writeJsonKey (CtxJson *ctx, const char *key)
 
UA_StatusCode writeJsonCommaIfNeeded (CtxJson *ctx)
 
UA_StatusCode writeJsonNull (CtxJson *ctx)
 
status encodeJsonInternal (const void *src, const UA_DataType *type, CtxJson *ctx)
 
UA_StatusCode decodeFields (CtxJson *ctx, ParseCtx *parseCtx, DecodeEntry *entries, size_t entryCount)
 
UA_StatusCode lookAheadForKey (const char *search, CtxJson *ctx, ParseCtx *parseCtx, size_t *resultIndex)
 
UA_StatusCode tokenize (ParseCtx *parseCtx, CtxJson *ctx, const UA_ByteString *src, size_t tokensSize)
 
UA_Boolean isJsonNull (const CtxJson *ctx, const ParseCtx *parseCtx)
 

Variables

const encodeJsonSignature encodeJsonJumpTable [UA_DATATYPEKINDS]
 
const decodeJsonSignature decodeJsonJumpTable [UA_DATATYPEKINDS]
 

Macro Definition Documentation

◆ UA_JSON_MAXTOKENCOUNT

#define UA_JSON_MAXTOKENCOUNT   2048

This Source Code Form is subject to the terms of the Mozilla Public License, v.

2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright 2014-2017 (c) Fraunhofer IOSB (Author: Julius Pfrommer) Copyright 2018 (c) Fraunhofer IOSB (Author: Lukas Meling)

Definition at line 22 of file ua_types_encoding_json.h.

◆ UA_JSON_ENCODING_MAX_RECURSION

#define UA_JSON_ENCODING_MAX_RECURSION   100

Interal Definitions.

For future by the PubSub encoding

Definition at line 57 of file ua_types_encoding_json.h.

Typedef Documentation

◆ encodeJsonSignature

typedef UA_StatusCode(* encodeJsonSignature) (const void *src, const UA_DataType *type, CtxJson *ctx)

Definition at line 144 of file ua_types_encoding_json.h.

◆ decodeJsonSignature

typedef UA_StatusCode(* decodeJsonSignature) (void *dst, const UA_DataType *type, CtxJson *ctx, ParseCtx *parseCtx)

Definition at line 147 of file ua_types_encoding_json.h.

Function Documentation

◆ UA_calcSizeJsonInternal()

size_t UA_calcSizeJsonInternal ( const void * src,
const UA_DataType * type,
const UA_String * namespaces,
size_t namespaceSize,
const UA_String * serverUris,
size_t serverUriSize,
UA_Boolean useReversible )

Returns the number of bytes the value src takes in json encoding.

Returns zero if an error occurs.

◆ UA_encodeJsonInternal()

UA_StatusCode UA_encodeJsonInternal ( const void * src,
const UA_DataType * type,
uint8_t ** bufPos,
const uint8_t ** bufEnd,
const UA_String * namespaces,
size_t namespaceSize,
const UA_String * serverUris,
size_t serverUriSize,
UA_Boolean useReversible )

Encodes the scalar value described by type to json encoding.

Parameters
srcThe value. Must not be NULL.
typeThe value type. Must not be NULL.
bufPosPoints to a pointer to the current position in the encoding buffer. Must not be NULL.
bufEndPoints to a pointer to the end of the encoding buffer (encoding always stops before *buf_end). Must not be NULL.
namespacesAn array of namespaces
namespaceSizeThe size of the namespaces array
serverUrisAn array of serverUris
serverUriSizeThe size of the serverUris array
useReversiblepreserve datatypes in json encoding
Returns
Returns a statuscode whether encoding succeeded.

◆ writeJsonObjStart()

UA_StatusCode writeJsonObjStart ( CtxJson * ctx)

◆ writeJsonObjElm()

UA_StatusCode writeJsonObjElm ( CtxJson * ctx,
const char * key,
const void * value,
const UA_DataType * type )

◆ writeJsonObjEnd()

UA_StatusCode writeJsonObjEnd ( CtxJson * ctx)

◆ writeJsonArrStart()

UA_StatusCode writeJsonArrStart ( CtxJson * ctx)

◆ writeJsonArrElm()

UA_StatusCode writeJsonArrElm ( CtxJson * ctx,
const void * value,
const UA_DataType * type )

◆ writeJsonArrEnd()

UA_StatusCode writeJsonArrEnd ( CtxJson * ctx)

◆ writeJsonKey()

UA_StatusCode writeJsonKey ( CtxJson * ctx,
const char * key )

◆ writeJsonCommaIfNeeded()

UA_StatusCode writeJsonCommaIfNeeded ( CtxJson * ctx)

◆ writeJsonNull()

UA_StatusCode writeJsonNull ( CtxJson * ctx)

◆ encodeJsonInternal()

status encodeJsonInternal ( const void * src,
const UA_DataType * type,
CtxJson * ctx )

◆ decodeFields()

UA_StatusCode decodeFields ( CtxJson * ctx,
ParseCtx * parseCtx,
DecodeEntry * entries,
size_t entryCount )

◆ lookAheadForKey()

UA_StatusCode lookAheadForKey ( const char * search,
CtxJson * ctx,
ParseCtx * parseCtx,
size_t * resultIndex )

◆ tokenize()

UA_StatusCode tokenize ( ParseCtx * parseCtx,
CtxJson * ctx,
const UA_ByteString * src,
size_t tokensSize )

◆ isJsonNull()

UA_Boolean isJsonNull ( const CtxJson * ctx,
const ParseCtx * parseCtx )

Variable Documentation

◆ encodeJsonJumpTable

const encodeJsonSignature encodeJsonJumpTable[UA_DATATYPEKINDS]
extern

Expose the jump tables and some methods for PubSub JSON decoding.

◆ decodeJsonJumpTable

const decodeJsonSignature decodeJsonJumpTable[UA_DATATYPEKINDS]
extern