static struct binary_data ipseckey_wirerdata(struct rr *rrv) { RRCAST(ipseckey); struct binary_data helper; switch (rr->gateway_type) { case 0: if (rr->algorithm != 0) return compose_binary_data("111d", 1, rr->precedence, rr->gateway_type, rr->algorithm, rr->public_key); else return compose_binary_data("111", 1, rr->precedence, rr->gateway_type, rr->algorithm); break; case 1: helper.length = sizeof(rr->gateway.gateway_ipv4); helper.data = (void *)&rr->gateway.gateway_ipv4; if (rr->algorithm != 0) return compose_binary_data("111dd", 1, rr->precedence, rr->gateway_type, rr->algorithm, helper, rr->public_key); else return compose_binary_data("111d", 1, rr->precedence, rr->gateway_type, rr->algorithm, helper); break; case 2: helper.length = sizeof(rr->gateway.gateway_ipv6); helper.data = (void *)&rr->gateway.gateway_ipv6; if (rr->algorithm != 0) return compose_binary_data("111dd", 1, rr->precedence, rr->gateway_type, rr->algorithm, helper, rr->public_key); else return compose_binary_data("111d", 1, rr->precedence, rr->gateway_type, rr->algorithm, helper); break; case 3: if (rr->algorithm != 0) return compose_binary_data("111dd", 1, rr->precedence, rr->gateway_type, rr->algorithm, name2wire_name(rr->gateway.gateway_name), rr->public_key); else return compose_binary_data("111d", 1, rr->precedence, rr->gateway_type, rr->algorithm, name2wire_name(rr->gateway.gateway_name)); break; } return bad_binary_data(); }
static struct binary_data txt_wirerdata(struct rr *rrv) { RRCAST(txt); struct binary_data r, t; struct rr_txt_segment *seg = rr->txt; r = bad_binary_data(); t.length = 0; t.data = NULL; while (seg) { r = compose_binary_data("db", 1, t, seg->txt); t = r; seg = seg->next; } return r; }