ec_record_t *ec_record_create(uint16_t flags, char *key, unsigned char *data, uint16_t data_len);
key
must be a NULL-terminated string.ec_record_create()
must be freed using ec_record_destroy()
once they are no longer required, unless they are attached to a certificate. All records attached to a certificate are automatically freed when the certificate is destroyed.flags
is used to set additional metadata on the record, according to the following table:key
is ignored.data
is ignored.ec_record_t *ec_record_bin(uint16_t flags, unsigned char *key, uint8_t key_len, unsigned char *data, uint16_t data_len);
ec_record_create()
, except using a binary key.ec_record_t *ec_record_str(uint16_t flags, char *key, char *data);
ec_record_create()
, except data is a NULL-terminated string.void ec_record_destroy(ec_record_t *r);
ec_record_t *ec_record_add(ec_cert_t *c, char *section, ec_record_t *r);
r
on success, NULL otherwise.section
, and the section will be created if it does not already exist. If EC_RECORD_SECTION
is set, then section
will be ignored and the record will be treated as a section header.ec_record_t *ec_record_remove(ec_cert_t *c, ec_record_t *r);
r
.void ec_record_remove_section(ec_cert_t *c, char *section, ec_freefn_t freefn);
freefn
is provided, it will be run once for each removed record, after that record is removed. If freefn
is NULL, then nothing will be run on the removed records, and you should destroy them manually if they are no longer required.ec_record_t *ec_record_match(ec_record_t *start, char *section, uint16_t flags, char *key,
unsigned char *data, uint16_t data_len);
key
must be a NULL-terminated string. All provided flags must be present in a record for it to match. section
must be defined unless searching for a section header, in which case it should be NULL.ec_record_t *ec_record_match_bin(ec_record_t *start, char *section, uint16_t flags,
unsigned char *key, uint8_t key_len, unsigned char *data, uint16_t data_len);
ec_record_match()
, except using a binary key.ec_record_t *ec_record_match_str(ec_record_t *start, char *section, uint16_t flags,
char *key, char *data);
ec_record_match()
, except data is a NULL-terminated string.ec_record_t *ec_record_next(ec_record_t *start, int filter);
start
is returned, or NULL if no matching record is found.filter
specifies which aspects of a record must match, according to the following table:ec_record_t *ec_record_set(ec_cert_t *c, char *section, uint16_t flags, char *key, char *data);
ec_record_add(c, section, ec_record_str(flags, key, data));
char *ec_record_get(ec_record_t *start, char *section, uint16_t flags, char *key);
char *ec_record_section(ec_record_t *r);
void ec_record_section_flags(ec_cert_t *c, char *section, uint16_t flags);
unsigned char *ec_record_data(ec_record_t *r);
r
is NULL.unsigned char *ec_record_buf(ec_cert_t *c, char *section, char *key, size_t length,
uint16_t flags);
length
bytes. Returns NULL on error.length
, or some of the flags
are unset, this is considered an error. Otherwise, the existing record is used as-is without alteration, and the data buffer is returned.flags
will be added to the default.