1164053Scognet/*-
2164053Scognet * Copyright (c) 2006 Olivier Houchard
3164053Scognet * All rights reserved.
4164053Scognet *
5164053Scognet * Redistribution and use in source and binary forms, with or without
6164053Scognet * modification, are permitted provided that the following conditions
7164053Scognet * are met:
8164053Scognet * 1. Redistributions of source code must retain the above copyright
9164053Scognet *    notice, this list of conditions and the following disclaimer.
10164053Scognet * 2. Redistributions in binary form must reproduce the above copyright
11164053Scognet *    notice, this list of conditions and the following disclaimer in the
12164053Scognet *    documentation and/or other materials provided with the distribution.
13164053Scognet *
14164053Scognet * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
15164053Scognet * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16164053Scognet * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17164053Scognet * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
18164053Scognet * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19164053Scognet * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20164053Scognet * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21164053Scognet * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22164053Scognet * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23164053Scognet * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24164053Scognet * POSSIBILITY OF SUCH DAMAGE.
25164053Scognet */
26164053Scognet
27164053Scognet#include <sys/cdefs.h>
28164053Scognet__FBSDID("$FreeBSD: releng/10.2/lib/libc/net/ntoh.c 164053 2006-11-06 22:07:47Z cognet $");
29164053Scognet
30164053Scognet#include <sys/endian.h>
31164053Scognet
32164053Scognetuint32_t
33164053Scognethtonl(uint32_t hl)
34164053Scognet{
35164053Scognet
36164053Scognet	return (__htonl(hl));
37164053Scognet}
38164053Scognet
39164053Scognetuint16_t
40164053Scognethtons(uint16_t hs)
41164053Scognet{
42164053Scognet
43164053Scognet	return (__htons(hs));
44164053Scognet}
45164053Scognet
46164053Scognetuint32_t
47164053Scognetntohl(uint32_t nl)
48164053Scognet{
49164053Scognet
50164053Scognet	return (__ntohl(nl));
51164053Scognet}
52164053Scognet
53164053Scognetuint16_t
54164053Scognetntohs(uint16_t ns)
55164053Scognet{
56164053Scognet
57164053Scognet	return (__ntohs(ns));
58164053Scognet}
59