27 static NMSG_MSGMOD_FIELD_PRINTER(dns_name_print);
28 static NMSG_MSGMOD_FIELD_PRINTER(dns_type_print);
29 static NMSG_MSGMOD_FIELD_PRINTER(dns_class_print);
30 static NMSG_MSGMOD_FIELD_PRINTER(dns_rdata_print);
38 .print = dns_name_print
43 .print = dns_class_print
48 .print = dns_type_print
57 .print = dns_name_print
62 .print = dns_class_print
67 .print = dns_type_print
77 .print = dns_rdata_print
85 NMSG_MSGMOD_REQUIRED_INIT,
86 .vendor = NMSG_VENDOR_BASE,
87 .msgtype = { NMSG_VENDOR_BASE_DNS_ID, NMSG_VENDOR_BASE_DNS_NAME },
89 .pbdescr = &nmsg__base__dns__descriptor,
96 dns_name_print(nmsg_message_t msg,
102 ProtobufCBinaryData *rrname = ptr;
103 char name[WDNS_PRESLEN_NAME];
106 if (rrname->data != NULL &&
108 rrname->len <= WDNS_MAXLEN_NAME)
110 wdns_domain_to_str(rrname->data, rrname->len, name);
118 dns_type_print(nmsg_message_t msg,
124 uint16_t *rrtype = ptr;
128 s = wdns_rrtype_to_str(*rrtype);
137 dns_class_print(nmsg_message_t msg,
143 uint16_t *rrclass = ptr;
147 s = wdns_rrclass_to_str(*rrclass);
156 dns_rdata_print(nmsg_message_t msg,
163 ProtobufCBinaryData *rdata = ptr;
170 if (dns->has_rrtype ==
false || dns->has_rrclass ==
false)
173 buf = wdns_rdata_to_str(rdata->data, rdata->len, dns->rrtype, dns->rrclass);
Structure exported by message modules to implement a new message type.
Structure mapping protocol buffer schema fields to nmsg_msgmod_field_type values for "transparent" mo...
nmsg_msgmod_field_type type
Intended (nmsg) type of this protobuf field.
const char * name
Name of the field.
void * nmsg_message_get_payload(nmsg_message_t msg)
WARNING: experts only.
#define NMSG_MSGMOD_FIELD_REPEATED
field is repeated
nmsg_res nmsg_strbuf_append(struct nmsg_strbuf *sb, const char *fmt,...)
Append to a string buffer.