X-Git-Url: http://git.openwrt.org/?p=project%2Fmdnsd.git;a=blobdiff_plain;f=dns.h;h=f1f021203697a56689e9553e6684c8757ac0edba;hp=4425d4cb8a36ae338b077c78bd19721f63ea25e1;hb=HEAD;hpb=9cbbb141068c12ed032736e20f982e2a0fb43edc diff --git a/dns.h b/dns.h index 4425d4c..39a1a51 100644 --- a/dns.h +++ b/dns.h @@ -40,7 +40,7 @@ #define MAX_NAME_LEN 8096 #define MAX_DATA_LEN 8096 -#define C_DNS_SD "_services._dns-sd._udp.local" +#define C_DNS_SD "_services._dns-sd._udp.local" struct dns_header { uint16_t id; @@ -49,7 +49,7 @@ struct dns_header { uint16_t answers; uint16_t authority; uint16_t additional; -}; +} __attribute__((packed)); struct dns_srv_data { uint16_t priority; @@ -73,10 +73,13 @@ struct interface; extern int cfg_proto; extern int cfg_no_subnet; -void dns_send_question(struct interface *iface, const char *question, int type, int unicast); +void dns_send_question(struct interface *iface, struct sockaddr *to, + const char *question, int type, int multicast); void dns_init_answer(void); void dns_add_answer(int type, const uint8_t *rdata, uint16_t rdlength, int ttl); -void dns_send_answer(struct interface *iface, const char *answer); +void dns_send_answer(struct interface *iface, struct sockaddr *to, const char *answer); +void dns_reply_a(struct interface *iface, struct sockaddr *to, int ttl, const char *hostname); +void dns_reply_a_additional(struct interface *iface, struct sockaddr *to, int ttl); const char* dns_type_string(uint16_t type); void dns_handle_packet(struct interface *iface, struct sockaddr *s, uint16_t port, uint8_t *buf, int len);