Subversion Repositories HelenOS

Rev

Rev 3912 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3912 Rev 4261
Line 37... Line 37...
37
#ifndef __NET_BYTEORDER_H__
37
#ifndef __NET_BYTEORDER_H__
38
#define __NET_BYTEORDER_H__
38
#define __NET_BYTEORDER_H__
39
 
39
 
40
#include <byteorder.h>
40
#include <byteorder.h>
41
 
41
 
-
 
42
#include <sys/types.h>
-
 
43
 
42
#ifdef ARCH_IS_BIG_ENDIAN
44
#ifdef ARCH_IS_BIG_ENDIAN
43
 
45
 
44
// Already in the network byte order.
46
// Already in the network byte order.
45
 
47
 
46
    /** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ).
48
    /** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ).
Line 73... Line 75...
73
 
75
 
74
    /** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ).
76
    /** Converts the given short number ( 16 bit ) from the host byte order to the network byte order ( big endian ).
75
     *  @param number The number in the host byte order to be converted.
77
     *  @param number The number in the host byte order to be converted.
76
     *  @returns The number in the network byte order.
78
     *  @returns The number in the network byte order.
77
     */
79
     */
78
    #define htons( number )     uint16_t_byteorder_swap( number )
80
    #define htons( number )     uint16_t_byteorder_swap(( uint16_t )( number ))
79
 
81
 
80
    /** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ).
82
    /** Converts the given long number ( 32 bit ) from the host byte order to the network byte order ( big endian ).
81
     *  @param number The number in the host byte order to be converted.
83
     *  @param number The number in the host byte order to be converted.
82
     *  @returns The number in the network byte order.
84
     *  @returns The number in the network byte order.
83
     */
85
     */
Line 85... Line 87...
85
 
87
 
86
    /** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order.
88
    /** Converts the given short number ( 16 bit ) from the network byte order ( big endian ) to the host byte order.
87
     *  @param number The number in the network byte order to be converted.
89
     *  @param number The number in the network byte order to be converted.
88
     *  @returns The number in the host byte order.
90
     *  @returns The number in the host byte order.
89
     */
91
     */
90
    #define ntohs( number )     uint16_t_byteorder_swap( number )
92
    #define ntohs( number )     uint16_t_byteorder_swap(( uint16_t )( number ))
91
 
93
 
92
    /** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order.
94
    /** Converts the given long number ( 32 bit ) from the network byte order ( big endian ) to the host byte order.
93
     *  @param number The number in the network byte order to be converted.
95
     *  @param number The number in the network byte order to be converted.
94
     *  @returns The number in the host byte order.
96
     *  @returns The number in the host byte order.
95
     */
97
     */