projects
/
project
/
mdnsd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cache: constify entry and host pointers in struct cache_entry
[project/mdnsd.git]
/
dns.c
diff --git
a/dns.c
b/dns.c
index 517825be9daba327c4f75c53d9dc8a841e55cf7d..5390fe6216097920b9ee08ad59b197950d1dcb8f 100644
(file)
--- a/
dns.c
+++ b/
dns.c
@@
-100,7
+100,7
@@
dns_send_packet(int fd, struct iovec *iov, int iov_len)
}
void
}
void
-dns_send_question(struct uloop_fd *u, char *question, int type)
+dns_send_question(struct uloop_fd *u, c
onst c
har *question, int type)
{
static struct dns_header h = {
.questions = cpu_to_be16(1),
{
static struct dns_header h = {
.questions = cpu_to_be16(1),
@@
-157,7
+157,7
@@
dns_init_answer(void)
}
void
}
void
-dns_add_answer(int type, uint8_t *rdata, uint16_t rdlength)
+dns_add_answer(int type,
const
uint8_t *rdata, uint16_t rdlength)
{
struct dns_reply *a = &dns_reply[dns_answer_cnt];
if (dns_answer_cnt == MAX_ANSWER)
{
struct dns_reply *a = &dns_reply[dns_answer_cnt];
if (dns_answer_cnt == MAX_ANSWER)
@@
-169,7
+169,7
@@
dns_add_answer(int type, uint8_t *rdata, uint16_t rdlength)
}
void
}
void
-dns_send_answer(struct uloop_fd *u, char *answer)
+dns_send_answer(struct uloop_fd *u, c
onst c
har *answer)
{
uint8_t buffer[256];
struct dns_header h = { 0 };
{
uint8_t buffer[256];
struct dns_header h = { 0 };
@@
-182,10
+182,7
@@
dns_send_answer(struct uloop_fd *u, char *answer)
h.answers = __cpu_to_be16(dns_answer_cnt);
h.flags = __cpu_to_be16(0x8400);
h.answers = __cpu_to_be16(dns_answer_cnt);
h.flags = __cpu_to_be16(0x8400);
- iov = malloc(sizeof(struct iovec) * ((dns_answer_cnt * 3) + 1));
- if (!iov)
- return;
-
+ iov = alloca(sizeof(struct iovec) * ((dns_answer_cnt * 3) + 1));
iov[0].iov_base = &h;
iov[0].iov_len = sizeof(struct dns_header);
iov[0].iov_base = &h;
iov[0].iov_len = sizeof(struct dns_header);
@@
-226,7
+223,7
@@
dns_send_answer(struct uloop_fd *u, char *answer)
}
static int
}
static int
-scan_name(uint8_t *buffer, int len)
+scan_name(
const
uint8_t *buffer, int len)
{
int offset = 0;
{
int offset = 0;
@@
-309,7
+306,7
@@
dns_consume_answer(uint8_t **data, int *len)
}
char*
}
char*
-dns_consume_name(uint8_t *base, int blen, uint8_t **data, int *len)
+dns_consume_name(
const
uint8_t *base, int blen, uint8_t **data, int *len)
{
int nlen = scan_name(*data, *len);
{
int nlen = scan_name(*data, *len);