00001 /*############################################################################## 00002 00003 nIP - nano IP stack 00004 00005 File : ip.h 00006 00007 Description : Internet Protocol 00008 00009 Copyright notice: 00010 00011 Copyright (C) 2005 - 00012 Andreas Dittrich, dittrich@informatik.hu-berlin.de 00013 Jon Kowal, kowal@informatik.hu-berlin.de 00014 00015 This program is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU General Public License 00017 as published by the Free Software Foundation; either version 2 00018 of the License, or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00028 00029 ##############################################################################*/ 00030 00031 #ifndef _NIP_INET_H 00032 #define _NIP_INET_H 00033 00034 // include definition of ENDIANNESS 00035 #include NIP_ARCH_FILE(endianness.h) 00036 00037 #if ( ENDIANNESS == BIG_ENDIAN ) 00038 00039 #define htons( ui16 ) ui16 00040 #define ntohs( ui16 ) ui16 00041 #define htonl( ui32 ) ui32 00042 #define ntohl( ui32 ) ui32 00043 00044 #else // ENDIANNESS 00045 00046 // conigure this for your platform 00047 #define htons( ui16 ) nip_bswap16( ui16 ) 00048 #define ntohs( ui16 ) nip_bswap16( ui16 ) 00049 #define htonl( ui32 ) nip_bswap32( ui32 ) 00050 #define ntohl( ui32 ) nip_bswap32( ui32 ) 00051 00052 uint16_t nip_bswap16( uint16_t in ); 00053 uint32_t nip_bswap32( uint32_t in ); 00054 00055 #endif // ENDIANNESS 00056 00057 00058 #endif // _NIP_INET_H