blob: 720f17f18f40cd1cc6f301f5c0443ee524a571b3 [file] [log] [blame]
nxpandroidc7611652015-09-23 16:42:05 +05301/******************************************************************************
2 *
3 * Copyright (C) 1999-2012 Broadcom Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18#ifndef GKI_INET_H
19#define GKI_INET_H
20
21#include "data_types.h"
22
nxf24591c1cbeab2018-02-21 17:32:26 +053023#if (BIG_ENDIAN == TRUE)
nxpandroidc7611652015-09-23 16:42:05 +053024#define ntohs(n) (n)
25#define ntohl(n) (n)
26#define ntoh6(n) (n)
27
28#define nettohs(n) (n)
29#define nettohl(n) (n)
30#else
nxpandroid8f6d0532017-07-12 18:25:30 +053031extern uint16_t ntohs(uint16_t n);
32extern uint32_t ntohl(uint32_t n);
33extern uint8_t* ntoh6(uint8_t* p);
nxpandroidc7611652015-09-23 16:42:05 +053034
nxpandroid8f6d0532017-07-12 18:25:30 +053035#define nettohs(n) ((uint16_t)((((n) << 8) & 0xff00) | (((n) >> 8) & 0x00ff)))
36#define nettohl(n) \
37 ((((n)&0x000000ff) << 24) | (((n) << 8) & 0x00ff0000) | \
38 (((n) >> 8) & 0x0000ff00) | (((n) >> 24) & 0x000000ff))
nxpandroidc7611652015-09-23 16:42:05 +053039#endif
40
41#endif /* GKI_INET_H */