ntoh.c revision 259065
184305Smarkm/*-
284305Smarkm * Copyright (c) 2006 Olivier Houchard
363248Speter * All rights reserved.
449887Snsayer *
549887Snsayer * Redistribution and use in source and binary forms, with or without
649887Snsayer * modification, are permitted provided that the following conditions
749887Snsayer * are met:
849887Snsayer * 1. Redistributions of source code must retain the above copyright
949887Snsayer *    notice, this list of conditions and the following disclaimer.
1049887Snsayer * 2. Redistributions in binary form must reproduce the above copyright
1149887Snsayer *    notice, this list of conditions and the following disclaimer in the
1249887Snsayer *    documentation and/or other materials provided with the distribution.
1349887Snsayer *
1449887Snsayer * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1549887Snsayer * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1649887Snsayer * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1776339Snsayer * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1876339Snsayer * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1981965Smarkm * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2081965Smarkm * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2176339Snsayer * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2276339Snsayer * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2381965Smarkm * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2481965Smarkm * POSSIBILITY OF SUCH DAMAGE.
2576610Snsayer */
2676610Snsayer
2749887Snsayer#include <sys/cdefs.h>
2849887Snsayer__FBSDID("$FreeBSD: releng/10.0/lib/libc/net/ntoh.c 164053 2006-11-06 22:07:47Z cognet $");
2949887Snsayer
3049887Snsayer#include <sys/endian.h>
3149887Snsayer
3249887Snsayeruint32_t
3349887Snsayerhtonl(uint32_t hl)
3449887Snsayer{
3549887Snsayer
3649887Snsayer	return (__htonl(hl));
3749887Snsayer}
3876610Snsayer
3976610Snsayeruint16_t
4081965Smarkmhtons(uint16_t hs)
4181965Smarkm{
4249887Snsayer
4349887Snsayer	return (__htons(hs));
4449887Snsayer}
4549887Snsayer
4649887Snsayeruint32_t
4749887Snsayerntohl(uint32_t nl)
4849887Snsayer{
4949887Snsayer
5049887Snsayer	return (__ntohl(nl));
5149887Snsayer}
5249887Snsayer
5381965Smarkmuint16_t
5481965Smarkmntohs(uint16_t ns)
5549887Snsayer{
5681965Smarkm
5781965Smarkm	return (__ntohs(ns));
5849887Snsayer}
5949887Snsayer