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