X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fmdnsd.git;a=blobdiff_plain;f=dns.h;h=0f26f6043a551c14a741626e8070666b20e8c9eb;hp=47727ddb667e8142e1fac6507c0ab49144e6c449;hb=fd5a160a15c48a97f7fc755c1310f17c869f0233;hpb=cef603930a1b4ff932c9dcf1e5243c13279add14 diff --git a/dns.h b/dns.h index 47727dd..0f26f60 100644 --- a/dns.h +++ b/dns.h @@ -33,6 +33,7 @@ #define MCAST_ADDR6 "ff02::fb" #define MCAST_PORT 5353 +#define CLASS_FLUSH 0x8000 #define CLASS_UNICAST 0x8000 #define CLASS_IN 0x0001 @@ -54,28 +55,29 @@ struct dns_srv_data { uint16_t priority; uint16_t weight; uint16_t port; -} __attribute__((packed, aligned(2))); +} __attribute__((packed)); struct dns_answer { uint16_t type; uint16_t class; uint32_t ttl; uint16_t rdlength; -} __attribute__((packed, aligned(2))); +} __attribute__((packed)); struct dns_question { uint16_t type; uint16_t class; -} __attribute__((packed, aligned(2))); +} __attribute__((packed)); 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, 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* dns_type_string(uint16_t type); void dns_handle_packet(struct interface *iface, struct sockaddr *s, uint16_t port, uint8_t *buf, int len);