diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2013-07-12 14:36:23 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2013-07-12 14:36:23 +0000 |
commit | 600f3ed678d1067d08c2a0507cf8951f926257c5 (patch) | |
tree | a6227a3dfbe918a556e72ee1446a13f5b3e06bce /lib/libc/asr/res_send_async.c | |
parent | b1dcdf2b461385a41c2862d6ef1e2a7e77c15e59 (diff) |
Make some symbols static and prefix all visible symbols with asr_
to prevent collisions with third-party programs.
suggested by sthen@, ok theo@
Diffstat (limited to 'lib/libc/asr/res_send_async.c')
-rw-r--r-- | lib/libc/asr/res_send_async.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/libc/asr/res_send_async.c b/lib/libc/asr/res_send_async.c index 4a3e1665df7..07518170104 100644 --- a/lib/libc/asr/res_send_async.c +++ b/lib/libc/asr/res_send_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_send_async.c,v 1.18 2013/06/01 09:21:10 eric Exp $ */ +/* $OpenBSD: res_send_async.c,v 1.19 2013/07/12 14:36:22 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -43,7 +43,7 @@ static int tcp_read(struct async *); static int validate_packet(struct async *); static int setup_query(struct async *, const char *, const char *, int, int); static int ensure_ibuf(struct async *, size_t); -int asr_iter_ns(struct async *); +static int iter_ns(struct async *); #define AS_NS_SA(p) ((p)->as_ctx->ac_ns[(p)->as.dns.nsidx - 1]) @@ -60,7 +60,7 @@ res_send_async(const unsigned char *buf, int buflen, struct asr *asr) DPRINT_PACKET("asr: res_send_async()", buf, buflen); ac = asr_use_resolver(asr); - if ((as = async_new(ac, ASR_SEND)) == NULL) { + if ((as = asr_async_new(ac, ASR_SEND)) == NULL) { asr_ctx_unref(ac); return (NULL); /* errno set */ } @@ -71,9 +71,9 @@ res_send_async(const unsigned char *buf, int buflen, struct asr *asr) as->as.dns.obuflen = buflen; as->as.dns.obufsize = buflen; - unpack_init(&p, buf, buflen); - unpack_header(&p, &h); - unpack_query(&p, &q); + asr_unpack_init(&p, buf, buflen); + asr_unpack_header(&p, &h); + asr_unpack_query(&p, &q); if (p.err) { errno = EINVAL; goto err; @@ -89,7 +89,7 @@ res_send_async(const unsigned char *buf, int buflen, struct asr *asr) return (as); err: if (as) - async_free(as); + asr_async_free(as); asr_ctx_unref(ac); return (NULL); } @@ -122,7 +122,7 @@ res_query_async_ctx(const char *name, int class, int type, struct asr_ctx *a_ctx DPRINT("asr: res_query_async_ctx(\"%s\", %i, %i)\n", name, class, type); - if ((as = async_new(a_ctx, ASR_SEND)) == NULL) + if ((as = asr_async_new(a_ctx, ASR_SEND)) == NULL) return (NULL); /* errno set */ as->as_run = res_send_async_run; @@ -136,7 +136,7 @@ res_query_async_ctx(const char *name, int class, int type, struct asr_ctx *a_ctx err: if (as) - async_free(as); + asr_async_free(as); return (NULL); } @@ -160,7 +160,7 @@ res_send_async_run(struct async *as, struct async_res *ar) case ASR_STATE_NEXT_NS: - if (asr_iter_ns(as) == -1) { + if (iter_ns(as) == -1) { ar->ar_errno = ETIMEDOUT; async_set_state(as, ASR_STATE_HALT); break; @@ -363,9 +363,9 @@ setup_query(struct async *as, const char *name, const char *dom, return (-1); } - if (dname_from_fqdn(fqdn, dname, sizeof(dname)) == -1) { + if (asr_dname_from_fqdn(fqdn, dname, sizeof(dname)) == -1) { errno = EINVAL; - DPRINT("dname_from_fqdn: invalid\n"); + DPRINT("asr_dname_from_fqdn: invalid\n"); return (-1); } @@ -383,9 +383,9 @@ setup_query(struct async *as, const char *name, const char *dom, h.flags |= RD_MASK; h.qdcount = 1; - pack_init(&p, as->as.dns.obuf, as->as.dns.obufsize); - pack_header(&p, &h); - pack_query(&p, type, class, dname); + asr_pack_init(&p, as->as.dns.obuf, as->as.dns.obufsize); + asr_pack_header(&p, &h); + asr_pack_query(&p, type, class, dname); if (p.err) { DPRINT("error packing query"); errno = EINVAL; @@ -678,9 +678,9 @@ validate_packet(struct async *as) struct rr rr; int r; - unpack_init(&p, as->as.dns.ibuf, as->as.dns.ibuflen); + asr_unpack_init(&p, as->as.dns.ibuf, as->as.dns.ibuflen); - unpack_header(&p, &h); + asr_unpack_header(&p, &h); if (p.err) goto inval; @@ -703,7 +703,7 @@ validate_packet(struct async *as) as->as.dns.rcode = RCODE(h.flags); as->as.dns.ancount = h.ancount; - unpack_query(&p, &q); + asr_unpack_query(&p, &q); if (p.err) goto inval; @@ -723,7 +723,7 @@ validate_packet(struct async *as) /* Validate the rest of the packet */ for (r = h.ancount + h.nscount + h.arcount; r; r--) - unpack_rr(&p, &rr); + asr_unpack_rr(&p, &rr); if (p.err || (p.offset != as->as.dns.ibuflen)) goto inval; @@ -740,8 +740,8 @@ validate_packet(struct async *as) * over the list until the maximum retry counter is reached. Return 0 on * success, or -1 if all nameservers were used. */ -int -asr_iter_ns(struct async *as) +static int +iter_ns(struct async *as) { for (;;) { if (as->as.dns.nsloop >= as->as_ctx->ac_nsretries) @@ -752,7 +752,7 @@ asr_iter_ns(struct async *as) break; as->as.dns.nsidx = 0; as->as.dns.nsloop++; - DPRINT("asr: asr_iter_ns(): cycle %i\n", as->as.dns.nsloop); + DPRINT("asr: iter_ns(): cycle %i\n", as->as.dns.nsloop); } as->as_timeout = 1000 * (as->as_ctx->ac_nstimeout << as->as.dns.nsloop); |