Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
NetConv.h
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Embedded Web-Server
10 *
11 ****************************************************************************
12 * HEADER
13 *
14 * $Id: NetConv.h 4915 2021-12-01 18:26:55Z wini $
15 *
16 * COPYRIGHT: Real Time Logic, 2004
17 *
18 * This software is copyrighted by and is the sole property of Real
19 * Time Logic LLC. All rights, title, ownership, or other interests in
20 * the software remain the property of Real Time Logic LLC. This
21 * software may only be used in accordance with the terms and
22 * conditions stipulated in the corresponding license agreement under
23 * which the software has been supplied. Any unauthorized use,
24 * duplication, transmission, distribution, or disclosure of this
25 * software is expressly forbidden.
26 *
27 * This Copyright notice may not be removed or modified without prior
28 * written consent of Real Time Logic LLC.
29 *
30 * Real Time Logic LLC. reserves the right to modify this software
31 * without notice.
32 *
33 * http://www.realtimelogic.com
34 ****************************************************************************
35 *
36 *
37 *
38 */
39#ifndef _NetConv_h
40#define _NetConv_h
41
42
43#ifdef B_LITTLE_ENDIAN
44#define baHtonl(x) ((U32)((((U32)(x) & 0x000000ffU) << 24) | \
45 (((U32)(x) & 0x0000ff00U) << 8) | \
46 (((U32)(x) & 0x00ff0000U) >> 8) | \
47 (((U32)(x) & 0xff000000U) >> 24)))
48#define baHtons(x) ((U16)((((U16)(x) & 0x00ff) << 8) | \
49 (((U16)(x) & 0xff00) >> 8)))
50#elif defined B_BIG_ENDIAN
51#define baHtonl(x) x
52#define baHtons(x) x
53#else
54#error endian needed
55#endif
56#define baNtohl(x) baHtonl(x)
57#define baNtohs(x) baHtons(x)
58
59/***********************************************************************
60 * Network conversion routines
61 ***********************************************************************/
62
63#endif
64