S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_helper_encode.h File Reference
#include <stddef.h>
#include "sopc_enums.h"

Go to the source code of this file.

Functions

SOPC_ReturnStatus SOPC_HelperDecode_Base64 (const char *pInput, unsigned char **ppOut, size_t *pOutLen)
 This function decodes a null-terminated base64 C string.
 
SOPC_ReturnStatus SOPC_HelperDecode_Hex (const char *pInput, unsigned char *pOut, size_t outputLen)
 Decodes a hexadecimal ByteString.
 
SOPC_ReturnStatus SOPC_HelperEncode_Hex (const unsigned char *pInput, char *pOut, size_t inputLen)
 Encodes a ByteString to a hexadecimal ByteString.
 

Function Documentation

◆ SOPC_HelperDecode_Base64()

SOPC_ReturnStatus SOPC_HelperDecode_Base64 ( const char * pInput,
unsigned char ** ppOut,
size_t * pOutLen )

This function decodes a null-terminated base64 C string.

Parameters
pInputA valid pointer to the null-terminated base64 C string.
[out]ppOutA valid pointer poiting to NULL. It will be set to the buffer containing the newly decoded data. The allocated buffer must be freed by the caller.
pOutLenThe size of the ppOut comptuted during the function execution.
Returns
SOPC_STATUS_OK when successful otherwise SOPC_STATUS_NOK.

◆ SOPC_HelperDecode_Hex()

SOPC_ReturnStatus SOPC_HelperDecode_Hex ( const char * pInput,
unsigned char * pOut,
size_t outputLen )

Decodes a hexadecimal ByteString.

Parameters
pInputA valid pointer to the hexadecimal ByteString.
[out]pOutA valid pointer to the output (you should allocate strlen( pInput )/2 in pOut .
outputLenThe size of the pInput divided by two.
Returns
SOPC_STATUS_OK when successful otherwise SOPC_STATUS_NOK.

◆ SOPC_HelperEncode_Hex()

SOPC_ReturnStatus SOPC_HelperEncode_Hex ( const unsigned char * pInput,
char * pOut,
size_t inputLen )

Encodes a ByteString to a hexadecimal ByteString.

Parameters
pInputA valid pointer to a ByteString.
[out]pOutA valid pointer to the output (you should allocate strlen( pInput )*2 in pOut .
inputLenThe size of the pInput .
Returns
SOPC_STATUS_OK when successful otherwise SOPC_STATUS_NOK.