2022-05-02 15:30:26 +02:00
|
|
|
#ifndef PATH_H_
|
|
|
|
|
#define PATH_H_
|
|
|
|
|
|
2022-05-16 10:59:20 +02:00
|
|
|
#ifdef HAVE_EIP712_FULL_SUPPORT
|
|
|
|
|
|
2022-04-08 18:55:56 +02:00
|
|
|
#include <stdint.h>
|
2022-05-02 15:30:26 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
#define MAX_PATH_DEPTH 16
|
2022-09-01 10:19:03 +02:00
|
|
|
#define MAX_ARRAY_DEPTH 8
|
2022-05-02 15:30:26 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
typedef struct {
|
2022-04-08 18:55:56 +02:00
|
|
|
uint8_t path_index;
|
|
|
|
|
uint8_t size;
|
2024-03-25 18:16:23 +01:00
|
|
|
uint8_t index;
|
2022-07-19 11:49:18 +02:00
|
|
|
} s_array_depth;
|
2022-05-02 15:30:26 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
typedef enum { ROOT_DOMAIN, ROOT_MESSAGE } e_root_type;
|
2022-05-06 18:14:04 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
typedef struct {
|
2022-04-08 18:55:56 +02:00
|
|
|
uint8_t depth_count;
|
|
|
|
|
uint8_t depths[MAX_PATH_DEPTH];
|
|
|
|
|
uint8_t array_depth_count;
|
|
|
|
|
s_array_depth array_depths[MAX_ARRAY_DEPTH];
|
2022-04-14 15:25:38 +02:00
|
|
|
const void *root_struct;
|
2022-05-06 18:14:04 +02:00
|
|
|
e_root_type root_type;
|
2022-07-19 11:49:18 +02:00
|
|
|
} s_path;
|
|
|
|
|
|
|
|
|
|
bool path_set_root(const char *const struct_name, uint8_t length);
|
|
|
|
|
const void *path_get_field(void);
|
2024-03-27 17:29:22 +01:00
|
|
|
bool path_advance(bool array_check);
|
2022-07-19 11:49:18 +02:00
|
|
|
bool path_init(void);
|
|
|
|
|
void path_deinit(void);
|
|
|
|
|
bool path_new_array_depth(const uint8_t *const data, uint8_t length);
|
2022-05-16 15:15:00 +02:00
|
|
|
e_root_type path_get_root_type(void);
|
2022-07-19 11:49:18 +02:00
|
|
|
const void *path_get_root(void);
|
2022-07-01 18:23:35 +02:00
|
|
|
const void *path_get_nth_field(uint8_t n);
|
|
|
|
|
const void *path_get_nth_field_to_last(uint8_t n);
|
|
|
|
|
uint8_t path_get_depth_count(void);
|
2024-07-18 15:48:46 +02:00
|
|
|
uint32_t get_path_crc(void);
|
2022-05-02 15:30:26 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
#endif // HAVE_EIP712_FULL_SUPPORT
|
2022-05-16 10:59:20 +02:00
|
|
|
|
2022-07-19 11:49:18 +02:00
|
|
|
#endif // PATH_H_
|