62 lines
1.8 KiB
C
62 lines
1.8 KiB
C
#ifndef AMDUAT_ASL_CORE_H
|
|
#define AMDUAT_ASL_CORE_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Octet views are borrowed; callers own the backing memory. */
|
|
typedef struct {
|
|
const uint8_t *data;
|
|
size_t len;
|
|
} amduat_octets_t;
|
|
|
|
typedef uint16_t amduat_hash_id_t;
|
|
typedef uint16_t amduat_asl_encoding_profile_id_t;
|
|
|
|
typedef struct {
|
|
uint32_t tag_id;
|
|
} amduat_type_tag_t;
|
|
|
|
typedef struct {
|
|
amduat_hash_id_t hash_id;
|
|
amduat_octets_t digest;
|
|
} amduat_reference_t;
|
|
|
|
typedef struct {
|
|
amduat_octets_t bytes;
|
|
bool has_type_tag;
|
|
amduat_type_tag_t type_tag;
|
|
} amduat_artifact_t;
|
|
|
|
amduat_octets_t amduat_octets(const void *data, size_t len);
|
|
bool amduat_octets_eq(amduat_octets_t a, amduat_octets_t b);
|
|
bool amduat_octets_is_empty(amduat_octets_t v);
|
|
/* Clone helpers allocate fresh buffers; free with the matching *_free call. */
|
|
bool amduat_octets_clone(amduat_octets_t src, amduat_octets_t *out);
|
|
void amduat_octets_free(amduat_octets_t *v);
|
|
|
|
amduat_type_tag_t amduat_type_tag(uint32_t tag_id);
|
|
bool amduat_type_tag_eq(amduat_type_tag_t a, amduat_type_tag_t b);
|
|
|
|
amduat_reference_t amduat_reference(amduat_hash_id_t hash_id, amduat_octets_t digest);
|
|
bool amduat_reference_eq(amduat_reference_t a, amduat_reference_t b);
|
|
bool amduat_reference_clone(amduat_reference_t src, amduat_reference_t *out);
|
|
void amduat_reference_free(amduat_reference_t *ref);
|
|
|
|
amduat_artifact_t amduat_artifact(amduat_octets_t bytes);
|
|
amduat_artifact_t amduat_artifact_with_type(amduat_octets_t bytes, amduat_type_tag_t type_tag);
|
|
bool amduat_artifact_eq(amduat_artifact_t a, amduat_artifact_t b);
|
|
bool amduat_artifact_clone(amduat_artifact_t src, amduat_artifact_t *out);
|
|
void amduat_artifact_free(amduat_artifact_t *artifact);
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
#endif /* AMDUAT_ASL_CORE_H */
|