X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/adns/blobdiff_plain/e8e5aeacbdaf5654974626d548f30a4c86e5ced6..b0a32b1750b230df79eb2d515519197c133d7a16:/src/internal.h diff --git a/src/internal.h b/src/internal.h index 5f8892e..7ad6daa 100644 --- a/src/internal.h +++ b/src/internal.h @@ -125,7 +125,7 @@ typedef struct { } parseinfo; union checklabel_state { - int dummy; + struct { byte ipv[4]; } ptr; }; typedef struct { @@ -133,7 +133,9 @@ typedef struct { void (*callback)(adns_query parent, adns_query child); union { - adns_rr_addr ptr_addr; + struct { + struct in_addr addr; + } ptr; } tinfo; /* type-specific state for the query itself: zero-init if you * don't know better. */ @@ -146,7 +148,7 @@ typedef struct typeinfo { adns_rrtype typekey; const char *rrtname; const char *fmtname; - int rrsz; + int fixed_rrsz; void (*makefinal)(adns_query qu, void *data); /* Change memory management of *data. @@ -164,7 +166,7 @@ typedef struct typeinfo { /* Parse one RR, in dgram of length dglen, starting at cbyte and * extending until at most max. * - * The RR should be stored at *store_r, of length qu->typei->rrsz. + * The RR should be stored at *store_r, of length qu->typei->getrrsz(). * * If there is an overrun which might indicate truncation, it should set * *rdstart to -1; otherwise it may set it to anything else positive. @@ -189,12 +191,17 @@ typedef struct typeinfo { * because lablen is zero. */ - void (*postsort)(adns_state ads, void *array, int nrrs, + void (*postsort)(adns_state ads, void *array, int nrrs,int rrsz, const struct typeinfo *typei); /* Called immediately after the RRs have been sorted, and may rearrange * them. (This is really for the benefit of SRV's bizarre weighting * stuff.) May be 0 to mean nothing needs to be done. */ + + int (*getrrsz)(const struct typeinfo *typei, adns_rrtype type); + /* Return the output resource-record element size; if this is null, then + * the rrsz member can be used. + */ } typeinfo; adns_status adns__ckl_hostname(adns_state ads, adns_queryflags flags, @@ -403,6 +410,11 @@ const char *adns__diag_domain(adns_state ads, int serv, adns_query qu, * vb before using the return value. */ +int adns__getrrsz_default(const typeinfo *typei, adns_rrtype type); +/* Default function for the `getrrsz' type hook; returns the `fixed_rrsz' + * value from the typeinfo entry. + */ + void adns__isort(void *array, int nobjs, int sz, void *tempbuf, int (*needswap)(void *context, const void *a, const void *b), void *context); @@ -457,8 +469,8 @@ void adns__query_send(adns_query qu, struct timeval now); /* From query.c: */ adns_status adns__internal_submit(adns_state ads, adns_query *query_r, - const typeinfo *typei, vbuf *qumsg_vb, - int id, + const typeinfo *typei, adns_rrtype type, + vbuf *qumsg_vb, int id, adns_queryflags flags, struct timeval now, qcontext *ctx); /* Submits a query (for internal use, called during external submits).