nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 1 | /****************************************************************************** |
| 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 | |
nxf24591 | c1cbeab | 2018-02-21 17:32:26 +0530 | [diff] [blame] | 23 | #if (BIG_ENDIAN == TRUE) |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 24 | #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 |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 31 | extern uint16_t ntohs(uint16_t n); |
| 32 | extern uint32_t ntohl(uint32_t n); |
| 33 | extern uint8_t* ntoh6(uint8_t* p); |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 34 | |
nxpandroid | 8f6d053 | 2017-07-12 18:25:30 +0530 | [diff] [blame] | 35 | #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)) |
nxpandroid | c761165 | 2015-09-23 16:42:05 +0530 | [diff] [blame] | 39 | #endif |
| 40 | |
| 41 | #endif /* GKI_INET_H */ |