Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

network.h

Go to the documentation of this file.
00001 /*!     \file include/net/network.h
00002  *      \brief Header for the network driver.
00003  *      \author Andrea Righi <drizzt@inwind.it>
00004  *      \date Last update: 2003-11-09
00005  *      \note Copyright (&copy;) 2003 Andrea Righi
00006  */
00007 
00008 #ifndef NETWORK_H
00009 #define NETWORK_H
00010 
00011 #if __BYTE_ORDER__==__LITTLE_ENDIAN__
00012         //! Network to host conversion for a word.
00013         #define ntohs(n) ( (((n) & 0xFF00) >> 8) | (((n) & 0x00FF) << 8) )
00014         //! Host to network conversion for a word.
00015         #define htons(n) ( (((n) & 0xFF00) >> 8) | (((n) & 0x00FF) << 8) )
00016         //! Network to host conversion for a double word.
00017         #define ntohl(n) ( (((n) & 0xFF000000) >> 24) | (((n) & 0x00FF0000) >> 8) \
00018                 | (((n) & 0x0000FF00) << 8) | (((n) & 0x000000FF) << 24) )
00019         //! Host to network conversion for a double word.
00020         #define htonl(n) ( (((n) & 0xFF000000) >> 24) | (((n) & 0x00FF0000) >> 8) \
00021                 | (((n) & 0x0000FF00) << 8) | (((n) & 0x000000FF) << 24) )
00022 #else
00023         //! Network to host conversion for a word.
00024         #define ntohs(n) (n)
00025         //! Host to network conversion for a word.
00026         #define htons(n) (n)
00027         //! Network to host conversion for a double word.
00028         #define ntohl(n) (n)
00029         //! Host to network conversion for a double word.
00030         #define htonl(n) (n)
00031 #endif
00032 
00033 #endif

Generated on Fri Feb 20 15:32:16 2004 for Minirighi by doxygen1.2.18