40 #define MAX_HOSTNAME_LEN 253
54 if (strnlen(param, size) >= size) {
55 DOCA_LOG_ERR(
"System memory regions map argument too long, must be <=%zu long", size - 1);
79 if (strnlen(param, size) >= size) {
80 DOCA_LOG_ERR(
"System VUID argument too long, must be <=%zu long", size - 1);
99 if (strnlen(param, size) >= size) {
100 DOCA_LOG_ERR(
"DMA device name argument too long, must be <=%zu long", size - 1);
119 if (strnlen(param, size) >= size) {
120 DOCA_LOG_ERR(
"System os symbols map argument too long, must be <=%zu long", size - 1);
150 struct doca_argp_param *memr_param, *vuid_param, *dma_param, *os_syms_param;
151 struct doca_argp_param *time_param;
432 struct doca_telemetry_exporter_type *
type;
433 struct doca_telemetry_exporter_field *field;
434 const int nb_fields = 5;
439 const char *type_name;
453 for (idx = 0; idx < nb_fields; idx++) {
484 struct doca_telemetry_exporter_source **telemetry_source,
488 struct doca_telemetry_exporter_schema *schema =
NULL;
489 struct doca_telemetry_exporter_source *source =
NULL;
495 DOCA_LOG_ERR(
"Failed to init the doca telemetry schema");
502 DOCA_LOG_ERR(
"Failed to register attestation event in the telemetry schema");
517 DOCA_LOG_ERR(
"Failed to start the doca telemetry schema");
524 DOCA_LOG_ERR(
"Failed to create a source end point to the telemetry");
529 if (gethostname(source_id_buf,
sizeof(source_id_buf)) < 0) {
530 DOCA_LOG_ERR(
"Gethostname failed, can't create a unique source tag and id");
535 strlcpy(source_tag_buf, source_id_buf,
sizeof(source_tag_buf));
536 strlcat(source_tag_buf,
"_tag",
sizeof(source_tag_buf));
543 DOCA_LOG_ERR(
"Failed to establish a source connection to the telemetry");
548 *telemetry_schema = schema;
549 *telemetry_source = source;
560 struct doca_telemetry_exporter_source *telemetry_source)
doca_error_t open_doca_device_rep_with_vuid(struct doca_dev *local, enum doca_devinfo_rep_filter filter, const uint8_t *value, size_t val_size, struct doca_dev_rep **retval)
doca_error_t open_doca_device_with_ibdev_name(const uint8_t *value, size_t val_size, tasks_check func, struct doca_dev **retval)
struct rdma_resources resources
@ DOCA_APSH_SYSTEM_WINDOWS
DOCA_EXPERIMENTAL doca_error_t doca_apsh_sys_mem_region_set(struct doca_apsh_system *system, const char *system_mem_region_path)
Set system allowed memory regions.
DOCA_EXPERIMENTAL doca_error_t doca_apsh_sys_dev_set(struct doca_apsh_system *system, struct doca_dev_rep *dev)
Set system device.
DOCA_EXPERIMENTAL doca_error_t doca_apsh_start(struct doca_apsh_ctx *ctx)
Start apsh handler.
DOCA_EXPERIMENTAL doca_error_t doca_apsh_sys_os_type_set(struct doca_apsh_system *system, enum doca_apsh_system_os os_type)
Set system os type.
DOCA_EXPERIMENTAL struct doca_apsh_ctx * doca_apsh_create(void)
Create a new apsh handler.
DOCA_EXPERIMENTAL doca_error_t doca_apsh_dma_dev_set(struct doca_apsh_ctx *ctx, struct doca_dev *dma_dev)
Set apsh dma device.
DOCA_EXPERIMENTAL struct doca_apsh_system * doca_apsh_system_create(struct doca_apsh_ctx *ctx)
Create a new system handler.
DOCA_EXPERIMENTAL doca_error_t doca_apsh_sys_os_symbol_map_set(struct doca_apsh_system *system, const char *system_os_symbol_map_path)
Set system os symbol map.
DOCA_EXPERIMENTAL void doca_apsh_destroy(struct doca_apsh_ctx *ctx)
Free the APSH memory and close connections.
DOCA_EXPERIMENTAL void doca_apsh_system_destroy(struct doca_apsh_system *system)
Destroy system handler.
DOCA_EXPERIMENTAL doca_error_t doca_apsh_system_start(struct doca_apsh_system *system)
Start system handler.
DOCA_EXPERIMENTAL void doca_argp_param_set_description(struct doca_argp_param *param, const char *description)
Set the description of the program param, used during program usage.
DOCA_EXPERIMENTAL void doca_argp_param_set_long_name(struct doca_argp_param *param, const char *name)
Set the long name of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_arguments(struct doca_argp_param *param, const char *arguments)
Set the description of the expected arguments of the program param, used during program usage.
DOCA_EXPERIMENTAL void doca_argp_param_set_callback(struct doca_argp_param *param, doca_argp_param_cb_t callback)
Set the callback function of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_mandatory(struct doca_argp_param *param)
Mark the program param as mandatory.
DOCA_EXPERIMENTAL doca_error_t doca_argp_param_create(struct doca_argp_param **param)
Create new program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_type(struct doca_argp_param *param, enum doca_argp_type type)
Set the type of the param arguments.
DOCA_EXPERIMENTAL doca_error_t doca_argp_register_version_callback(doca_argp_param_cb_t callback)
Register an alternative version callback.
DOCA_EXPERIMENTAL void doca_argp_param_set_short_name(struct doca_argp_param *param, const char *name)
Set the short name of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_register_param(struct doca_argp_param *input_param)
Register a program flag.
DOCA_STABLE doca_error_t doca_dev_rep_close(struct doca_dev_rep *dev)
Destroy allocated representor device instance.
DOCA_STABLE doca_error_t doca_dev_close(struct doca_dev *dev)
Destroy allocated local device instance.
@ DOCA_DEVINFO_REP_FILTER_NET
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_INVALID_VALUE
@ DOCA_ERROR_INITIALIZATION
@ DOCA_ERROR_OPERATING_SYSTEM
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_TELEMETRY_EXPORTER_FIELD_TYPE_TIMESTAMP
DOCA telemetry timestamp type.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_schema_init(const char *schema_name, struct doca_telemetry_exporter_schema **doca_schema)
Initialize DOCA schema to prepare it for setting attributes and adding types. DOCA schema is used to ...
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_type_destroy(struct doca_telemetry_exporter_type *type)
Destroy doca telemetry type previously created by doca_telemetry_exporter_type_create()
DOCA_EXPERIMENTAL void doca_telemetry_exporter_field_set_type_name(struct doca_telemetry_exporter_field *field_info, const char *type)
Set doca telemetry field type.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_source_destroy(struct doca_telemetry_exporter_source *doca_source)
Destructor for DOCA source.
DOCA_EXPERIMENTAL void doca_telemetry_exporter_field_set_description(struct doca_telemetry_exporter_field *field_info, const char *desc)
Set doca telemetry field description.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_field_destroy(struct doca_telemetry_exporter_field *field)
Destroy field previously created by doca_telemetry_exporter_field_create()
#define DOCA_TELEMETRY_EXPORTER_FIELD_TYPE_INT32
DOCA telemetry int32 type.
DOCA_EXPERIMENTAL void doca_telemetry_exporter_source_set_id(struct doca_telemetry_exporter_source *doca_source, const char *source_id)
Set source id.
uint8_t doca_telemetry_exporter_type_index_t
DOCA schema field type index.
DOCA_EXPERIMENTAL void doca_telemetry_exporter_field_set_array_len(struct doca_telemetry_exporter_field *field_info, uint16_t len)
Set doca telemetry field length.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_schema_add_type(struct doca_telemetry_exporter_schema *doca_schema, const char *new_type_name, struct doca_telemetry_exporter_type *type, doca_telemetry_exporter_type_index_t *type_index)
Add user-defined fields to create new type in DOCA schema. The users loses the ownership of the type ...
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_source_create(struct doca_telemetry_exporter_schema *doca_schema, struct doca_telemetry_exporter_source **doca_source)
Creates a single DOCA source from schema.
DOCA_EXPERIMENTAL void doca_telemetry_exporter_field_set_name(struct doca_telemetry_exporter_field *field_info, const char *name)
Set doca telemetry field name.
#define DOCA_TELEMETRY_EXPORTER_FIELD_TYPE_INT64
DOCA telemetry int64 type.
#define DOCA_TELEMETRY_EXPORTER_FIELD_TYPE_CHAR
DOCA telemetry char type.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_type_create(struct doca_telemetry_exporter_type **type)
Create new telemetry type.
DOCA_EXPERIMENTAL void doca_telemetry_exporter_source_set_tag(struct doca_telemetry_exporter_source *doca_source, const char *source_tag)
Set source tag.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_field_create(struct doca_telemetry_exporter_field **field)
Create new telemetry field.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_schema_destroy(struct doca_telemetry_exporter_schema *doca_schema)
Destructor for DOCA schema.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_schema_start(struct doca_telemetry_exporter_schema *doca_schema)
Finalizes schema setup to start creating Doca Sources from the schema.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_type_add_field(struct doca_telemetry_exporter_type *type, struct doca_telemetry_exporter_field *field)
Add DOCA telemetry field to type. The users loses the ownership of the field after a successful invoc...
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_exporter_source_start(struct doca_telemetry_exporter_source *doca_source)
Applies source attribute and starts DOCA source.
char dma_dev_name[DOCA_DEVINFO_IBDEV_NAME_SIZE+1]
char system_os_symbol_map_path[MAX_PATH_LEN]
char system_mem_region_path[MAX_PATH_LEN]
char system_vuid[DOCA_DEVINFO_VUID_SIZE+1]
size_t strlcat(char *dst, const char *src, size_t size)
size_t strlcpy(char *dst, const char *src, size_t size)
noreturn doca_error_t sdk_version_callback(void *param, void *doca_config)
static doca_error_t time_callback(void *param, void *config)
static doca_error_t os_syms_callback(void *param, void *config)
DOCA_LOG_REGISTER(YARA_APP::Core)
static doca_error_t yara_system_init(struct yara_config *conf, struct yara_resources *resources)
static doca_error_t memr_callback(void *param, void *config)
static doca_error_t dma_callback(void *param, void *config)
doca_error_t register_yara_params(void)
void yara_inspection_cleanup(struct yara_resources *resources)
doca_error_t yara_inspection_init(struct yara_config *conf, struct yara_resources *resources)
static doca_error_t telemetry_register_yara_event(struct doca_telemetry_exporter_schema *schema, doca_telemetry_exporter_type_index_t *type_index)
static doca_error_t yara_ctx_init(struct yara_config *conf, struct yara_resources *resources)
static doca_error_t vuid_callback(void *param, void *config)
doca_error_t telemetry_start(struct doca_telemetry_exporter_schema **telemetry_schema, struct doca_telemetry_exporter_source **telemetry_source, doca_telemetry_exporter_type_index_t *index)
void telemetry_destroy(struct doca_telemetry_exporter_schema *telemetry_schema, struct doca_telemetry_exporter_source *telemetry_source)
#define MAX_PROCESS_NAME_LEN