1*86d7f5d3SJohn Marino /*-
2*86d7f5d3SJohn Marino * Copyright (c) 2006 Olivier Houchard
3*86d7f5d3SJohn Marino * All rights reserved.
4*86d7f5d3SJohn Marino *
5*86d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without
6*86d7f5d3SJohn Marino * modification, are permitted provided that the following conditions
7*86d7f5d3SJohn Marino * are met:
8*86d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright
9*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer.
10*86d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright
11*86d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the
12*86d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution.
13*86d7f5d3SJohn Marino *
14*86d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
15*86d7f5d3SJohn Marino * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16*86d7f5d3SJohn Marino * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17*86d7f5d3SJohn Marino * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
18*86d7f5d3SJohn Marino * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19*86d7f5d3SJohn Marino * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20*86d7f5d3SJohn Marino * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21*86d7f5d3SJohn Marino * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22*86d7f5d3SJohn Marino * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23*86d7f5d3SJohn Marino * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24*86d7f5d3SJohn Marino * POSSIBILITY OF SUCH DAMAGE.
25*86d7f5d3SJohn Marino *
26*86d7f5d3SJohn Marino * $FreeBSD: src/lib/libc/net/ntoh.c,v 1.1 2006/11/06 22:07:47 cognet Exp $
27*86d7f5d3SJohn Marino */
28*86d7f5d3SJohn Marino
29*86d7f5d3SJohn Marino #include <sys/endian.h>
30*86d7f5d3SJohn Marino
31*86d7f5d3SJohn Marino uint32_t
htonl(uint32_t hl)32*86d7f5d3SJohn Marino htonl(uint32_t hl)
33*86d7f5d3SJohn Marino {
34*86d7f5d3SJohn Marino return (__htonl(hl));
35*86d7f5d3SJohn Marino }
36*86d7f5d3SJohn Marino
37*86d7f5d3SJohn Marino uint16_t
htons(uint16_t hs)38*86d7f5d3SJohn Marino htons(uint16_t hs)
39*86d7f5d3SJohn Marino {
40*86d7f5d3SJohn Marino return (__htons(hs));
41*86d7f5d3SJohn Marino }
42*86d7f5d3SJohn Marino
43*86d7f5d3SJohn Marino uint32_t
ntohl(uint32_t nl)44*86d7f5d3SJohn Marino ntohl(uint32_t nl)
45*86d7f5d3SJohn Marino {
46*86d7f5d3SJohn Marino return (__ntohl(nl));
47*86d7f5d3SJohn Marino }
48*86d7f5d3SJohn Marino
49*86d7f5d3SJohn Marino uint16_t
ntohs(uint16_t ns)50*86d7f5d3SJohn Marino ntohs(uint16_t ns)
51*86d7f5d3SJohn Marino {
52*86d7f5d3SJohn Marino return (__ntohs(ns));
53*86d7f5d3SJohn Marino }
54