SDK Configuration#
Common configuration for the attestation SDK.
Macros#
Enumerations#
- nvat_log_level_t
Enum indicating possible log levels.
Functions#
- nvat_rc_t nvat_http_options_create_default(nvat_http_options_t *http_options)
Create a new set of HTTP options with default values.
- void nvat_http_options_free(nvat_http_options_t *http_options)
- void nvat_http_options_set_base_backoff_ms(nvat_http_options_t http_options, long base_backoff_ms)
Sets the base backoff time, in milliseconds.
- void nvat_http_options_set_connection_timeout_ms(nvat_http_options_t http_options, long connection_timeout_ms)
Sets the connection timeout for each HTTP request.
- void nvat_http_options_set_max_backoff_ms(nvat_http_options_t http_options, long max_backoff_ms)
Sets the maximum backoff time, in milliseconds.
- void nvat_http_options_set_max_retry_count(nvat_http_options_t http_options, long max_retries)
Sets the maximum number of retries on a failed HTTP request.
- void nvat_http_options_set_request_timeout_ms(nvat_http_options_t http_options, long request_timeout_ms)
Sets the overall request timeout of an HTTP request.
- nvat_rc_t nvat_logger_callback_create(nvat_logger_t *out_logger, nvat_log_callback_t log_callback, nvat_should_log_callback_t should_log_callback, nvat_flush_callback_t flush_callback, void *user_data)
Create a custom logging implementation through callbacks.
- void nvat_logger_free(nvat_logger_t *logger)
- nvat_rc_t nvat_logger_spdlog_create(nvat_logger_t *out_logger, const char *name, nvat_log_level_t level)
Create a new SPDLog Logger backend with the given name and log level.
- nvat_rc_t nvat_sdk_init(nvat_sdk_opts_t opts)
Initialize the NVIDIA Attestation SDK with the given options.
- nvat_rc_t nvat_sdk_opts_create(nvat_sdk_opts_t *out_opts)
Allocate a new nvat_sdk_opts_t on the heap.
- void nvat_sdk_opts_free(nvat_sdk_opts_t *sdk_opts)
- void nvat_sdk_opts_set_enabled_device_drivers(nvat_sdk_opts_t opts, const nvat_devices_t enabled_device_drivers)
Selects a set of device drivers to enable.
- void nvat_sdk_opts_set_logger(nvat_sdk_opts_t opts, nvat_logger_t logger)
Sets the logger in the given options.
- void nvat_sdk_shutdown()
Shutdown the NVIDIA Attestation SDK.
Typedefs#
- nvat_devices_t
Bitmap indicating the set of NVIDIA devices to attest on a system.
- nvat_flush_callback_t
Flush callback to force immediate writing of any buffered log messages.
- nvat_http_options_t
Common configuration for HTTP clients.
- nvat_log_callback_t
Logging callback to write messages to a custom log system.
- nvat_logger_t
Pluggable logger for the attestation SDK.
- nvat_sdk_opts_t
Options used to initialize the NVIDIA Attestation SDK.
- nvat_should_log_callback_t
Logging callback to determine whether logging is enabled for the given level.
Enumerations#
-
enum nvat_log_level_t#
Enum indicating possible log levels.
A log message is emitted if its log level is greater than or equal to the logger’s configured minimum level.
Values:
-
enumerator NVAT_LOG_LEVEL_OFF#
-
enumerator NVAT_LOG_LEVEL_TRACE#
-
enumerator NVAT_LOG_LEVEL_DEBUG#
-
enumerator NVAT_LOG_LEVEL_INFO#
-
enumerator NVAT_LOG_LEVEL_WARN#
-
enumerator NVAT_LOG_LEVEL_ERROR#
-
enumerator NVAT_LOG_LEVEL_OFF#
Functions#
- nvat_rc_t nvat_http_options_create_default(
- nvat_http_options_t *http_options,
Create a new set of HTTP options with default values.
-
void nvat_http_options_free(nvat_http_options_t *http_options)#
- void nvat_http_options_set_base_backoff_ms(
- nvat_http_options_t http_options,
- long base_backoff_ms,
Sets the base backoff time, in milliseconds.
A base backoff of 0 disables backoff between retries (not recommended).
- void nvat_http_options_set_connection_timeout_ms(
- nvat_http_options_t http_options,
- long connection_timeout_ms,
Sets the connection timeout for each HTTP request.
- void nvat_http_options_set_max_backoff_ms(
- nvat_http_options_t http_options,
- long max_backoff_ms,
Sets the maximum backoff time, in milliseconds.
- void nvat_http_options_set_max_retry_count(
- nvat_http_options_t http_options,
- long max_retries,
Sets the maximum number of retries on a failed HTTP request.
At most
max(max_retries, 0) + 1
attempts will be made.
- void nvat_http_options_set_request_timeout_ms(
- nvat_http_options_t http_options,
- long request_timeout_ms,
Sets the overall request timeout of an HTTP request.
- nvat_rc_t nvat_logger_callback_create(
- nvat_logger_t *out_logger,
- nvat_log_callback_t log_callback,
- nvat_should_log_callback_t should_log_callback,
- nvat_flush_callback_t flush_callback,
- void *user_data,
Create a custom logging implementation through callbacks.
See nvat_should_log_callback_t and nvat_log_callback_t for details on the required callbacks.
user_data
is a nullable pointer to user-defined data that should be passed to each invocation of both theshould_log_callback
andlog_callback
.user_data
should be a pointer to any user defined data structures required to support the custom logging implementation. The caller is responsible for safe interaction withuser_data
, including thread safety if the SDK is used from multiple threads.- Parameters:
log_callback – Nullable callback to write log messages. If NULL, all messages are dropped.
should_log_callback – Nullable callback to filter log messages. If NULL, no filtering is applied.
flush_callback – Nullable callback to signal a request to flush buffered messages. If NULL, the callback is not invoked.
user_data – Nullable pointer to user-defined data
-
void nvat_logger_free(nvat_logger_t *logger)#
- nvat_rc_t nvat_logger_spdlog_create(
- nvat_logger_t *out_logger,
- const char *name,
- nvat_log_level_t level,
Create a new SPDLog Logger backend with the given name and log level.
Logger will write to stdout.
-
nvat_rc_t nvat_sdk_init(nvat_sdk_opts_t opts)#
Initialize the NVIDIA Attestation SDK with the given options.
Safety: Callers should ensure the following:
Initialization should only be attempted once, from the main application thread.
Callers should not attempt to recover in case initialization fails. Behavior of the SDK and the state of the underlying dependencies after a failure is currently not defined.
-
nvat_rc_t nvat_sdk_opts_create(nvat_sdk_opts_t *out_opts)#
Allocate a new nvat_sdk_opts_t on the heap.
-
void nvat_sdk_opts_free(nvat_sdk_opts_t *sdk_opts)#
- void nvat_sdk_opts_set_enabled_device_drivers(
- nvat_sdk_opts_t opts,
- const nvat_devices_t enabled_device_drivers,
Selects a set of device drivers to enable.
Valid bits:
NVAT_DEVICE_GPU
will initialize NVML on SDK init.NVAT_DEVICE_NVSWITCH
will initialize NSCQ on SDK init.
Callers must enable the associated device drivers for local evidence collection.
- void nvat_sdk_opts_set_logger(
- nvat_sdk_opts_t opts,
- nvat_logger_t logger,
Sets the logger in the given options.
Note that the logger is not installed until nvat_sdk_init is called.
-
void nvat_sdk_shutdown()#
Shutdown the NVIDIA Attestation SDK.
This operation will shutdown any dependencies initialized as part of nvat_sdk_init and free any resources owned by the active nvat_sdk_opts_t.
Typedefs#
-
typedef uint32_t nvat_devices_t#
Bitmap indicating the set of NVIDIA devices to attest on a system.
Valid bits include:
NVAT_DEVICE_GPU
NVAT_DEVICE_NVSWITCH Multiple device types can be enabled.
-
typedef void (*nvat_flush_callback_t)(void *user_data)#
Flush callback to force immediate writing of any buffered log messages.
This is called by the SDK at critical points to ensure log persistence. Implementations should handle errors internally and continue operating.
- Param user_data:
Pointer to user-defined data
-
typedef struct nvat_http_options_st *nvat_http_options_t#
Common configuration for HTTP clients.
-
typedef void (*nvat_log_callback_t)(nvat_log_level_t level, const char *message, const char *filename, const char *function, int line, void *user_data)#
Logging callback to write messages to a custom log system.
If the SDK is used across multiple threads, the implementation of this callback must be thread safe.
- Param level:
The level of the incoming log message
- Param message:
The formatted log message
- Param filename:
The name of the file in the source from which the log was emitted
- Param function:
The name of the function in the source from which the log was emitted
- Param line_number:
The line_number in the source from which the log was emitted
- Param user_data:
Pointer to user-defined data
-
typedef struct nvat_logger_st *nvat_logger_t#
Pluggable logger for the attestation SDK.
-
typedef struct nvat_sdk_opts_st *nvat_sdk_opts_t#
Options used to initialize the NVIDIA Attestation SDK.
-
typedef bool (*nvat_should_log_callback_t)(nvat_log_level_t level, const char *filename, const char *function, int line, void *user_data)#
Logging callback to determine whether logging is enabled for the given level.
This called prior to each logging statement to avoid string formatting when it is not necessary. If the SDK is used across multiple threads, the implementation of this callback must be thread safe.
- Param level:
The level of the pending log message
- Param filename:
The name of the file in the source from which the log was emitted
- Param function:
The name of the function in the source from which the log was emitted
- Param line_number:
The line_number in the source from which the log was emitted
- Param user_data:
Pointer to user-defined data