projects
/
project
/
mdnsd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Keep source sockaddr for every cached DNS record
[project/mdnsd.git]
/
dns.h
diff --git
a/dns.h
b/dns.h
index 5937f26c278ae6cff96fc8664acacfb1637fe92a..38ab41f85b8df4e05fed15af21bde1226140d6c0 100644
(file)
--- a/
dns.h
+++ b/
dns.h
@@
-15,6
+15,7
@@
#define _DNS_H__
#include <stdint.h>
#define _DNS_H__
#include <stdint.h>
+#include <arpa/inet.h>
#define FLAG_RESPONSE 0x8000
#define FLAG_AUTHORATIVE 0x0400
#define FLAG_RESPONSE 0x8000
#define FLAG_AUTHORATIVE 0x0400
@@
-33,12
+34,13
@@
#define MCAST_PORT 5353
#define CLASS_FLUSH 0x8000
#define MCAST_PORT 5353
#define CLASS_FLUSH 0x8000
+#define CLASS_UNICAST 0x8000
#define CLASS_IN 0x0001
#define MAX_NAME_LEN 8096
#define MAX_DATA_LEN 8096
#define CLASS_IN 0x0001
#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;
struct dns_header {
uint16_t id;
@@
-53,28
+55,30
@@
struct dns_srv_data {
uint16_t priority;
uint16_t weight;
uint16_t port;
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;
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;
struct dns_question {
uint16_t type;
uint16_t class;
-} __attribute__((packed
, aligned(2)
));
+} __attribute__((packed));
struct interface;
extern int cfg_proto;
struct interface;
extern int cfg_proto;
+extern int cfg_no_subnet;
-void dns_send_question(struct interface *iface, const char *question, int type);
+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_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);
const char* dns_type_string(uint16_t type);
-void dns_handle_packet(struct interface *iface, uint8_t *buf, int len);
+void dns_handle_packet(struct interface *iface,
struct sockaddr *s, uint16_t port,
uint8_t *buf, int len);
#endif
#endif