OPTIGA Trust M  1.1.0
C++ library for Optiga Trust M Chip Security Controller
optiga_lib_logger.h File Reference

This file provides the prototypes for the OPTIGA library logger. More...

#include "optiga_lib_types.h"
Include dependency graph for optiga_lib_logger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

#define OPTIGA_UTIL_SERVICE   "[optiga util] : "
 
#define OPTIGA_CRYPT_SERVICE   "[optiga crypt] : "
 
#define OPTIGA_COMMAND_LAYER   "[optiga cmd] : "
 
#define OPTIGA_COMMUNICATION_LAYER   "[optiga comms] : "
 
#define OPTIGA_LIB_LOGGER_COLOR_RED   "\x1b[31m"
 
#define OPTIGA_LIB_LOGGER_COLOR_GREEN   "\x1b[32m"
 
#define OPTIGA_LIB_LOGGER_COLOR_YELLOW   "\x1b[33m"
 
#define OPTIGA_LIB_LOGGER_COLOR_BLUE   "\x1b[34m"
 
#define OPTIGA_LIB_LOGGER_COLOR_MAGENTA   "\x1b[35m"
 
#define OPTIGA_LIB_LOGGER_COLOR_CYAN   "\x1b[36m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREY   "\x1b[90m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_RED   "\x1b[91m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREEN   "\x1b[92m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_YELLOW   "\x1b[93m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_BLUE   "\x1b[94m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_MAGENTA   "\x1b[95m"
 
#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN   "\x1b[96m"
 
#define OPTIGA_LIB_LOGGER_COLOR_DEFAULT   "\x1b[0m"
 
#define OPTIGA_UTIL_SERVICE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define OPTIGA_CRYPT_SERVICE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define OPTIGA_COMMAND_LAYER_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define OPTIGA_COMMUNICATION_LAYER_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT
 
#define OPTIGA_ERROR_COLOR   OPTIGA_LIB_LOGGER_COLOR_RED
 
#define OPTIGA_UNPROTECTED_DATA_COLOR   OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN
 
#define OPTIGA_PROTECTED_DATA_COLOR   OPTIGA_LIB_LOGGER_COLOR_YELLOW
 
#define OPTIGA_HEX_BYTE_SEPERATOR   ""
 
#define OPTIGA_LIB_LOGGER_PRINT_ARRAY(p_output_buffer, p_temp_buffer, p_color)
 Converts the input array buffer to encode the color specified. More...
 
#define OPTIGA_LIB_LOGGER_PRINT_INFO(p_output_buffer, p_temp_buffer, p_layer, p_color)
 Converts the input string to encode the color specified. More...
 
void optiga_lib_print_string (const char_t *input_string)
 To log a string. More...
 
void optiga_lib_print_string_with_newline (const char_t *p_log_string)
 To log a string with a new line. More...
 
void optiga_lib_print_message (const char_t *p_log_string, const char_t *p_log_layer, const char_t *p_log_color)
 To log a string with a new line and layer information. More...
 
void optiga_lib_print_status (const char_t *p_log_layer, const char_t *p_log_color, uint16_t return_value)
 To log a return value with a new line and layer information. More...
 
void optiga_lib_print_array_hex_format (const uint8_t *p_log_string, uint16_t length, const char_t *p_log_color)
 To log the byte array in hex format. More...
 

Detailed Description

This file provides the prototypes for the OPTIGA library logger.

Copyright (c) 2019 Infineon Technologies AG

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

\endcopyright

Author
Infineon Technologies AG

Macro Definition Documentation

◆ OPTIGA_COMMAND_LAYER

#define OPTIGA_COMMAND_LAYER   "[optiga cmd] : "

◆ OPTIGA_COMMAND_LAYER_COLOR

#define OPTIGA_COMMAND_LAYER_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

◆ OPTIGA_COMMUNICATION_LAYER

#define OPTIGA_COMMUNICATION_LAYER   "[optiga comms] : "

◆ OPTIGA_COMMUNICATION_LAYER_COLOR

#define OPTIGA_COMMUNICATION_LAYER_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

◆ OPTIGA_CRYPT_SERVICE

#define OPTIGA_CRYPT_SERVICE   "[optiga crypt] : "

◆ OPTIGA_CRYPT_SERVICE_COLOR

#define OPTIGA_CRYPT_SERVICE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

◆ OPTIGA_ERROR_COLOR

#define OPTIGA_ERROR_COLOR   OPTIGA_LIB_LOGGER_COLOR_RED

◆ OPTIGA_HEX_BYTE_SEPERATOR

#define OPTIGA_HEX_BYTE_SEPERATOR   ""

◆ OPTIGA_LIB_LOGGER_COLOR_BLUE

#define OPTIGA_LIB_LOGGER_COLOR_BLUE   "\x1b[34m"

◆ OPTIGA_LIB_LOGGER_COLOR_CYAN

#define OPTIGA_LIB_LOGGER_COLOR_CYAN   "\x1b[36m"

◆ OPTIGA_LIB_LOGGER_COLOR_DEFAULT

#define OPTIGA_LIB_LOGGER_COLOR_DEFAULT   "\x1b[0m"

◆ OPTIGA_LIB_LOGGER_COLOR_GREEN

#define OPTIGA_LIB_LOGGER_COLOR_GREEN   "\x1b[32m"

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_BLUE

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_BLUE   "\x1b[94m"

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN   "\x1b[96m"

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREEN

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREEN   "\x1b[92m"

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREY

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_GREY   "\x1b[90m"

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_MAGENTA

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_MAGENTA   "\x1b[95m"

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_RED

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_RED   "\x1b[91m"

◆ OPTIGA_LIB_LOGGER_COLOR_LIGHT_YELLOW

#define OPTIGA_LIB_LOGGER_COLOR_LIGHT_YELLOW   "\x1b[93m"

◆ OPTIGA_LIB_LOGGER_COLOR_MAGENTA

#define OPTIGA_LIB_LOGGER_COLOR_MAGENTA   "\x1b[35m"

◆ OPTIGA_LIB_LOGGER_COLOR_RED

#define OPTIGA_LIB_LOGGER_COLOR_RED   "\x1b[31m"

◆ OPTIGA_LIB_LOGGER_COLOR_YELLOW

#define OPTIGA_LIB_LOGGER_COLOR_YELLOW   "\x1b[33m"

◆ OPTIGA_LIB_LOGGER_PRINT_ARRAY

#define OPTIGA_LIB_LOGGER_PRINT_ARRAY (   p_output_buffer,
  p_temp_buffer,
  p_color 
)
Value:
{ \
sprintf((char_t *)p_output_buffer, \
"%25s%s%s", \
p_color, \
p_temp_buffer, \
}
#define OPTIGA_LIB_LOGGER_COLOR_DEFAULT
Definition: optiga_lib_logger.h:68
char char_t
Typedef for one byte integer.
Definition: optiga_lib_types.h:82

Converts the input array buffer to encode the color specified.

Converts the input array buffer to encode the color specified

Precondition
  • None
Note
  • None
Parameters
[out]p_output_bufferPointer to output buffer
[in]p_temp_bufferPointer to the input array buffer
[in]p_colorPointer to the color of array string

◆ OPTIGA_LIB_LOGGER_PRINT_INFO

#define OPTIGA_LIB_LOGGER_PRINT_INFO (   p_output_buffer,
  p_temp_buffer,
  p_layer,
  p_color 
)
Value:
{ \
sprintf((char_t *)p_output_buffer, \
"%s%s%s%s", \
p_color, \
p_layer, \
p_temp_buffer, \
}
#define OPTIGA_LIB_LOGGER_COLOR_DEFAULT
Definition: optiga_lib_logger.h:68
char char_t
Typedef for one byte integer.
Definition: optiga_lib_types.h:82

Converts the input string to encode the color specified.

Converts the input string to encode the color specified

Precondition
  • None
Note
  • None
Parameters
[out]p_output_bufferPointer to output buffer
[in]p_temp_bufferPointer to the input array buffer
[in]p_layerPointer to the layer info buffer
[in]p_colorPointer to the color of array string

◆ OPTIGA_PROTECTED_DATA_COLOR

#define OPTIGA_PROTECTED_DATA_COLOR   OPTIGA_LIB_LOGGER_COLOR_YELLOW

◆ OPTIGA_UNPROTECTED_DATA_COLOR

#define OPTIGA_UNPROTECTED_DATA_COLOR   OPTIGA_LIB_LOGGER_COLOR_LIGHT_CYAN

◆ OPTIGA_UTIL_SERVICE

#define OPTIGA_UTIL_SERVICE   "[optiga util] : "

◆ OPTIGA_UTIL_SERVICE_COLOR

#define OPTIGA_UTIL_SERVICE_COLOR   OPTIGA_LIB_LOGGER_COLOR_DEFAULT

Function Documentation

◆ optiga_lib_print_array_hex_format()

void optiga_lib_print_array_hex_format ( const uint8_t *  p_log_string,
uint16_t  length,
const char_t p_log_color 
)

To log the byte array in hex format.

To log the byte array in hex format

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the array string
[in]lengthLength of the array buffer
[in]p_log_colorPointer to the color of array string
Here is the call graph for this function:

◆ optiga_lib_print_message()

void optiga_lib_print_message ( const char_t p_log_string,
const char_t p_log_layer,
const char_t p_log_color 
)

To log a string with a new line and layer information.

To log a string with information of the layer from which it is invoked and with a new line

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the log string
[in]p_log_layerPointer to the invoked layer information
[in]p_log_colorPointer to the color of log string
Here is the call graph for this function:

◆ optiga_lib_print_status()

void optiga_lib_print_status ( const char_t p_log_layer,
const char_t p_log_color,
uint16_t  return_value 
)

To log a return value with a new line and layer information.

To log a if the return value was successful or not along with layer information

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_layerPointer to the invoked layer information
[in]p_log_colorPointer to the color of log string
[in]return_valueReturn value from the invoked layer
Here is the call graph for this function:

◆ optiga_lib_print_string()

void optiga_lib_print_string ( const char_t input_string)

To log a string.

To log a string.

  • Precondition
  • None
Note
  • None
Parameters
[in]input_stringPointer to the log string
Here is the call graph for this function:

◆ optiga_lib_print_string_with_newline()

void optiga_lib_print_string_with_newline ( const char_t p_log_string)

To log a string with a new line.

To log a string with a new line

  • Precondition
  • None
Note
  • None
Parameters
[in]p_log_stringPointer to the log string
Here is the call graph for this function: