1199767f8SToomas Soome /*-
2199767f8SToomas Soome * Copyright (c) 2006 Olivier Houchard
3199767f8SToomas Soome * All rights reserved.
4199767f8SToomas Soome *
5199767f8SToomas Soome * Redistribution and use in source and binary forms, with or without
6199767f8SToomas Soome * modification, are permitted provided that the following conditions
7199767f8SToomas Soome * are met:
8199767f8SToomas Soome * 1. Redistributions of source code must retain the above copyright
9199767f8SToomas Soome * notice, this list of conditions and the following disclaimer.
10199767f8SToomas Soome * 2. Redistributions in binary form must reproduce the above copyright
11199767f8SToomas Soome * notice, this list of conditions and the following disclaimer in the
12199767f8SToomas Soome * documentation and/or other materials provided with the distribution.
13199767f8SToomas Soome *
14199767f8SToomas Soome * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
15199767f8SToomas Soome * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16199767f8SToomas Soome * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17199767f8SToomas Soome * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
18199767f8SToomas Soome * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19199767f8SToomas Soome * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20199767f8SToomas Soome * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21199767f8SToomas Soome * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22199767f8SToomas Soome * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23199767f8SToomas Soome * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24199767f8SToomas Soome * POSSIBILITY OF SUCH DAMAGE.
25199767f8SToomas Soome */
26199767f8SToomas Soome
27199767f8SToomas Soome #include <sys/cdefs.h>
28199767f8SToomas Soome __FBSDID("$FreeBSD$");
29199767f8SToomas Soome
30199767f8SToomas Soome #include <sys/endian.h>
31199767f8SToomas Soome #define _BYTEORDER_FUNC_DEFINED
32199767f8SToomas Soome #include <arpa/inet.h>
33199767f8SToomas Soome
34199767f8SToomas Soome uint32_t
htonl(uint32_t hl)35199767f8SToomas Soome htonl(uint32_t hl)
36199767f8SToomas Soome {
37199767f8SToomas Soome
38199767f8SToomas Soome return (__htonl(hl));
39199767f8SToomas Soome }
40199767f8SToomas Soome
41199767f8SToomas Soome uint16_t
htons(uint16_t hs)42199767f8SToomas Soome htons(uint16_t hs)
43199767f8SToomas Soome {
44*55fea89dSDan Cross
45199767f8SToomas Soome return (__htons(hs));
46199767f8SToomas Soome }
47199767f8SToomas Soome
48199767f8SToomas Soome uint32_t
ntohl(uint32_t nl)49199767f8SToomas Soome ntohl(uint32_t nl)
50199767f8SToomas Soome {
51199767f8SToomas Soome
52199767f8SToomas Soome return (__ntohl(nl));
53199767f8SToomas Soome }
54199767f8SToomas Soome
55199767f8SToomas Soome uint16_t
ntohs(uint16_t ns)56199767f8SToomas Soome ntohs(uint16_t ns)
57199767f8SToomas Soome {
58*55fea89dSDan Cross
59199767f8SToomas Soome return (__ntohs(ns));
60199767f8SToomas Soome }
61