asn1: Add --decorate=... for internal bookkeeping
This option, `--decorate=TYPE-NAME:FIELD-TYPE:field-name[?]` allows one to add a field to any struct generated by the ASN.1 compiler for any SET or SEQUENCE type such that: - the field will be freed by the `free_TYPE_NAME()` function - the field will be copied by the `copy_TYPE_NAME()` function - the field will not be printed by the `print_TYPE_NAME()` function - the field will NOT be encoded or decoded This is useful for internal bookkeeping. The first use of this may well be for adding an optional field to `Principal` where information about name attributes will be stored, which will then allow us to have GSS name attributes for the krb5 mechanism w/o having to refactor the mechanism to use a different structure for representing `gss_name_t` mechnames than the one currently used (`Principal`; `krb5_principal` happens to be a typedef alias of `Principal *`). So w/o massive rototilling of the GSS krb5 mechanism we can have name attributes, _and_ we'll also be able to have those in the krb5 API as well w/o any massive rototilling there either.
This commit is contained in:
@@ -1063,6 +1063,8 @@ template_members(struct templatehead *temp,
|
||||
Member *m;
|
||||
size_t i = 0, typeididx = 0, opentypeidx = 0;
|
||||
int is_array_of_open_type = 0;
|
||||
int deco_opt;
|
||||
char *ft, *fn;
|
||||
|
||||
if (isstruct && t->actual_parameter)
|
||||
get_open_type_defn_fields(t, &typeidmember, &opentypemember,
|
||||
@@ -1102,6 +1104,17 @@ template_members(struct templatehead *temp,
|
||||
typeidfield, opentypefield, opentypemember,
|
||||
is_array_of_open_type);
|
||||
|
||||
if (decorate_type(basetype, &ft, &fn, &deco_opt)) {
|
||||
char *poffset2;
|
||||
|
||||
poffset2 = partial_offset(basetype, fn, 1, isstruct);
|
||||
add_line_pointer(temp, ft, poffset2, "A1_OP_TYPE_DECORATE %s",
|
||||
deco_opt ? "|A1_FLAG_OPTIONAL" : "");
|
||||
free(poffset2);
|
||||
free(ft);
|
||||
free(fn);
|
||||
}
|
||||
|
||||
if (isstruct)
|
||||
template_names(temp, basetype, t);
|
||||
break;
|
||||
@@ -1114,6 +1127,8 @@ template_members(struct templatehead *temp,
|
||||
Member *m;
|
||||
size_t i = 0, typeididx = 0, opentypeidx = 0;
|
||||
int is_array_of_open_type = 0;
|
||||
int deco_opt;
|
||||
char *ft, *fn;
|
||||
|
||||
if (isstruct && t->actual_parameter)
|
||||
get_open_type_defn_fields(t, &typeidmember, &opentypemember,
|
||||
@@ -1153,6 +1168,17 @@ template_members(struct templatehead *temp,
|
||||
typeidfield, opentypefield, opentypemember,
|
||||
is_array_of_open_type);
|
||||
|
||||
if (decorate_type(basetype, &ft, &fn, &deco_opt)) {
|
||||
char *poffset2;
|
||||
|
||||
poffset2 = partial_offset(basetype, fn, 1, isstruct);
|
||||
add_line_pointer(temp, ft, poffset2, "A1_OP_TYPE_DECORATE %s",
|
||||
deco_opt ? "|A1_FLAG_OPTIONAL" : "");
|
||||
free(poffset2);
|
||||
free(ft);
|
||||
free(fn);
|
||||
}
|
||||
|
||||
if (isstruct)
|
||||
template_names(temp, basetype, t);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user