186d7f5d3SJohn Marino /*-
286d7f5d3SJohn Marino * Copyright (c) 2006 Olivier Houchard
386d7f5d3SJohn Marino * All rights reserved.
486d7f5d3SJohn Marino *
586d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without
686d7f5d3SJohn Marino * modification, are permitted provided that the following conditions
786d7f5d3SJohn Marino * are met:
886d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright
986d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer.
1086d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright
1186d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the
1286d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution.
1386d7f5d3SJohn Marino *
1486d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1586d7f5d3SJohn Marino * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1686d7f5d3SJohn Marino * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1786d7f5d3SJohn Marino * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1886d7f5d3SJohn Marino * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1986d7f5d3SJohn Marino * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2086d7f5d3SJohn Marino * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2186d7f5d3SJohn Marino * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2286d7f5d3SJohn Marino * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2386d7f5d3SJohn Marino * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2486d7f5d3SJohn Marino * POSSIBILITY OF SUCH DAMAGE.
2586d7f5d3SJohn Marino *
2686d7f5d3SJohn Marino * $FreeBSD: src/lib/libc/net/ntoh.c,v 1.1 2006/11/06 22:07:47 cognet Exp $
2786d7f5d3SJohn Marino */
2886d7f5d3SJohn Marino
2986d7f5d3SJohn Marino #include <sys/endian.h>
3086d7f5d3SJohn Marino
3186d7f5d3SJohn Marino uint32_t
htonl(uint32_t hl)3286d7f5d3SJohn Marino htonl(uint32_t hl)
3386d7f5d3SJohn Marino {
3486d7f5d3SJohn Marino return (__htonl(hl));
3586d7f5d3SJohn Marino }
3686d7f5d3SJohn Marino
3786d7f5d3SJohn Marino uint16_t
htons(uint16_t hs)3886d7f5d3SJohn Marino htons(uint16_t hs)
3986d7f5d3SJohn Marino {
4086d7f5d3SJohn Marino return (__htons(hs));
4186d7f5d3SJohn Marino }
4286d7f5d3SJohn Marino
4386d7f5d3SJohn Marino uint32_t
ntohl(uint32_t nl)4486d7f5d3SJohn Marino ntohl(uint32_t nl)
4586d7f5d3SJohn Marino {
4686d7f5d3SJohn Marino return (__ntohl(nl));
4786d7f5d3SJohn Marino }
4886d7f5d3SJohn Marino
4986d7f5d3SJohn Marino uint16_t
ntohs(uint16_t ns)5086d7f5d3SJohn Marino ntohs(uint16_t ns)
5186d7f5d3SJohn Marino {
5286d7f5d3SJohn Marino return (__ntohs(ns));
5386d7f5d3SJohn Marino }
54