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 23 #define htons ntohs 24 #define htonl ntohl 25 26 #define htonets nettohs 27 #define htonetl nettohl 28 29 #if BIG_ENDIAN == TRUE 30 #define ntohs(n) (n) 31 #define ntohl(n) (n) 32 #define ntoh6(n) (n) 33 34 #define nettohs(n) (n) 35 #define nettohl(n) (n) 36 #else 37 extern UINT16 ntohs(UINT16 n); 38 extern UINT32 ntohl(UINT32 n); 39 extern UINT8 *ntoh6(UINT8 *p); 40 41 #define nettohs(n) ((UINT16)((((n) << 8) & 0xff00) | (((n) >> 8) & 0x00ff))) 42 #define nettohl(n) ((((n) & 0x000000ff) << 24) | (((n) << 8) & 0x00ff0000) | \ 43 (((n) >> 8) & 0x0000ff00) | (((n) >> 24) & 0x000000ff)) 44 #endif 45 46 #endif /* GKI_INET_H */ 47 48