xref: /minix3/lib/libc/nameser/ns_netint.c (revision f14fb602092e015ff630df58e17c2a9cd57d29b3)
1*f14fb602SLionel Sambuc /*	$NetBSD: ns_netint.c,v 1.7 2012/03/13 21:13:39 christos Exp $	*/
22fe8fb19SBen Gras 
32fe8fb19SBen Gras /*
42fe8fb19SBen Gras  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
52fe8fb19SBen Gras  * Copyright (c) 1996,1999 by Internet Software Consortium.
62fe8fb19SBen Gras  *
72fe8fb19SBen Gras  * Permission to use, copy, modify, and distribute this software for any
82fe8fb19SBen Gras  * purpose with or without fee is hereby granted, provided that the above
92fe8fb19SBen Gras  * copyright notice and this permission notice appear in all copies.
102fe8fb19SBen Gras  *
112fe8fb19SBen Gras  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
122fe8fb19SBen Gras  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
132fe8fb19SBen Gras  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
142fe8fb19SBen Gras  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
152fe8fb19SBen Gras  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
162fe8fb19SBen Gras  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
172fe8fb19SBen Gras  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
182fe8fb19SBen Gras  */
192fe8fb19SBen Gras 
202fe8fb19SBen Gras #include <sys/cdefs.h>
212fe8fb19SBen Gras #ifndef lint
222fe8fb19SBen Gras #ifdef notdef
232fe8fb19SBen Gras static const char rcsid[] = "Id: ns_netint.c,v 1.3 2005/04/27 04:56:40 sra Exp";
242fe8fb19SBen Gras #else
25*f14fb602SLionel Sambuc __RCSID("$NetBSD: ns_netint.c,v 1.7 2012/03/13 21:13:39 christos Exp $");
262fe8fb19SBen Gras #endif
272fe8fb19SBen Gras #endif
282fe8fb19SBen Gras 
292fe8fb19SBen Gras /* Import. */
302fe8fb19SBen Gras 
312fe8fb19SBen Gras #include "port_before.h"
322fe8fb19SBen Gras 
332fe8fb19SBen Gras #include <arpa/nameser.h>
342fe8fb19SBen Gras 
352fe8fb19SBen Gras #include "port_after.h"
362fe8fb19SBen Gras 
372fe8fb19SBen Gras /* Public. */
382fe8fb19SBen Gras 
39*f14fb602SLionel Sambuc uint16_t
ns_get16(const u_char * src)402fe8fb19SBen Gras ns_get16(const u_char *src) {
41*f14fb602SLionel Sambuc 	uint16_t dst;
422fe8fb19SBen Gras 
432fe8fb19SBen Gras 	NS_GET16(dst, src);
44*f14fb602SLionel Sambuc 	return dst;
452fe8fb19SBen Gras }
462fe8fb19SBen Gras 
47*f14fb602SLionel Sambuc uint32_t
ns_get32(const u_char * src)482fe8fb19SBen Gras ns_get32(const u_char *src) {
49*f14fb602SLionel Sambuc 	u_int32_t dst;
502fe8fb19SBen Gras 
512fe8fb19SBen Gras 	NS_GET32(dst, src);
52*f14fb602SLionel Sambuc 	return dst;
532fe8fb19SBen Gras }
542fe8fb19SBen Gras 
552fe8fb19SBen Gras void
ns_put16(uint16_t src,u_char * dst)56*f14fb602SLionel Sambuc ns_put16(uint16_t src, u_char *dst) {
572fe8fb19SBen Gras 	NS_PUT16(src, dst);
582fe8fb19SBen Gras }
592fe8fb19SBen Gras 
602fe8fb19SBen Gras void
ns_put32(uint32_t src,u_char * dst)61*f14fb602SLionel Sambuc ns_put32(uint32_t src, u_char *dst) {
622fe8fb19SBen Gras 	NS_PUT32(src, dst);
632fe8fb19SBen Gras }
642fe8fb19SBen Gras 
652fe8fb19SBen Gras /*! \file */
66