1 1.7 christos /* $NetBSD: ns_netint.c,v 1.7 2012/03/13 21:13:39 christos Exp $ */ 2 1.1 christos 3 1.1 christos /* 4 1.1 christos * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 5 1.1 christos * Copyright (c) 1996,1999 by Internet Software Consortium. 6 1.1 christos * 7 1.1 christos * Permission to use, copy, modify, and distribute this software for any 8 1.1 christos * purpose with or without fee is hereby granted, provided that the above 9 1.1 christos * copyright notice and this permission notice appear in all copies. 10 1.1 christos * 11 1.1 christos * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 12 1.1 christos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 1.1 christos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 14 1.1 christos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 1.1 christos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 1.1 christos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 17 1.1 christos * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 1.1 christos */ 19 1.1 christos 20 1.2 christos #include <sys/cdefs.h> 21 1.1 christos #ifndef lint 22 1.2 christos #ifdef notdef 23 1.5 christos static const char rcsid[] = "Id: ns_netint.c,v 1.3 2005/04/27 04:56:40 sra Exp"; 24 1.2 christos #else 25 1.7 christos __RCSID("$NetBSD: ns_netint.c,v 1.7 2012/03/13 21:13:39 christos Exp $"); 26 1.2 christos #endif 27 1.1 christos #endif 28 1.1 christos 29 1.1 christos /* Import. */ 30 1.1 christos 31 1.1 christos #include "port_before.h" 32 1.1 christos 33 1.1 christos #include <arpa/nameser.h> 34 1.1 christos 35 1.1 christos #include "port_after.h" 36 1.1 christos 37 1.1 christos /* Public. */ 38 1.1 christos 39 1.7 christos uint16_t 40 1.1 christos ns_get16(const u_char *src) { 41 1.7 christos uint16_t dst; 42 1.1 christos 43 1.1 christos NS_GET16(dst, src); 44 1.7 christos return dst; 45 1.1 christos } 46 1.1 christos 47 1.7 christos uint32_t 48 1.1 christos ns_get32(const u_char *src) { 49 1.7 christos u_int32_t dst; 50 1.1 christos 51 1.1 christos NS_GET32(dst, src); 52 1.7 christos return dst; 53 1.1 christos } 54 1.1 christos 55 1.1 christos void 56 1.7 christos ns_put16(uint16_t src, u_char *dst) { 57 1.1 christos NS_PUT16(src, dst); 58 1.1 christos } 59 1.1 christos 60 1.1 christos void 61 1.7 christos ns_put32(uint32_t src, u_char *dst) { 62 1.1 christos NS_PUT32(src, dst); 63 1.1 christos } 64 1.3 christos 65 1.3 christos /*! \file */ 66