~rimskyp/helenos/gui

« back to all changes in this revision

Viewing changes to uspace/lib/c/include/ipc/icmp.h

  • Committer: Pavel Rimsky
  • Date: 2010-10-16 19:27:47 UTC
  • mfrom: (355.1.291 HelenOS.mainline)
  • Revision ID: pavel@pavel-laptop-20101016192747-ymgf1isyijywbsxm
Merging changes from mainline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
27
 */
28
28
 
29
 
/** @addtogroup icmp
30
 
 *  @{
 
29
/** @addtogroup libc
 
30
 * @{
31
31
 */
32
32
 
33
33
/** @file
34
 
 *  ICMP module messages.
35
 
 *  @see icmp_interface.h
 
34
 * ICMP module messages.
 
35
 * @see icmp_interface.h
36
36
 */
37
37
 
38
 
#ifndef __NET_ICMP_MESSAGES__
39
 
#define __NET_ICMP_MESSAGES__
 
38
#ifndef LIBC_ICMP_MESSAGES_
 
39
#define LIBC_ICMP_MESSAGES_
40
40
 
41
41
#include <ipc/ipc.h>
 
42
#include <ipc/net.h>
42
43
#include <sys/types.h>
43
 
 
44
 
#include <icmp_codes.h>
45
 
#include <net_messages.h>
46
 
 
47
 
/** ICMP module messages.
48
 
 */
49
 
typedef enum{
50
 
        /** Sends echo request.
51
 
         *  @see icmp_echo()
52
 
         */
 
44
#include <sys/time.h>
 
45
 
 
46
#include <net/icmp_codes.h>
 
47
 
 
48
/** ICMP module messages. */
 
49
typedef enum {
 
50
        /** Sends echo request. @see icmp_echo() */
53
51
        NET_ICMP_ECHO = NET_ICMP_FIRST,
54
 
        /** Sends destination unreachable error message.
55
 
         *  @see icmp_destination_unreachable_msg()
 
52
        
 
53
        /**
 
54
         * Sends destination unreachable error message.
 
55
         * @see icmp_destination_unreachable_msg()
56
56
         */
57
57
        NET_ICMP_DEST_UNREACH,
58
 
        /** Sends source quench error message.
59
 
         *  @see icmp_source_quench_msg()
 
58
        
 
59
        /**
 
60
         * Sends source quench error message.
 
61
         * @see icmp_source_quench_msg()
60
62
         */
61
63
        NET_ICMP_SOURCE_QUENCH,
62
 
        /** Sends time exceeded error message.
63
 
         *  @see icmp_time_exceeded_msg()
 
64
        
 
65
        /**
 
66
         * Sends time exceeded error message.
 
67
         * @see icmp_time_exceeded_msg()
64
68
         */
65
69
        NET_ICMP_TIME_EXCEEDED,
66
 
        /** Sends parameter problem error message.
67
 
         *  @see icmp_parameter_problem_msg()
 
70
        
 
71
        /**
 
72
         * Sends parameter problem error message.
 
73
         * @see icmp_parameter_problem_msg()
68
74
         */
69
75
        NET_ICMP_PARAMETERPROB,
70
 
        /** Initializes new connection.
71
 
         */
 
76
        
 
77
        /** Initializes new connection. */
72
78
        NET_ICMP_INIT
73
79
} icmp_messages;
74
80
 
75
 
/** @name ICMP specific message parameters definitions
76
 
 */
 
81
/** @name ICMP specific message parameters definitions */
77
82
/*@{*/
78
83
 
79
84
/** Returns the ICMP code message parameter.
80
 
 *  @param[in] call The message call structure.
 
85
 *
 
86
 * @param[in] call      The message call structure.
81
87
 */
82
88
#define ICMP_GET_CODE(call) \
83
 
        ({icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); code;})
 
89
        ({ \
 
90
                icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); \
 
91
                code; \
 
92
        })
84
93
 
85
94
/** Returns the ICMP link MTU message parameter.
86
 
 *  @param[in] call The message call structure.
 
95
 *
 
96
 * @param[in] call      The message call structure.
87
97
 */
88
98
#define ICMP_GET_MTU(call) \
89
 
        ({icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); mtu;})
 
99
        ({ \
 
100
                icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); \
 
101
                mtu; \
 
102
        })
90
103
 
91
104
/** Returns the pointer message parameter.
92
 
 *  @param[in] call The message call structure.
 
105
 *
 
106
 * @param[in] call      The message call structure.
93
107
 */
94
108
#define ICMP_GET_POINTER(call) \
95
 
        ({icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); pointer;})
 
109
        ({ \
 
110
                icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); \
 
111
                pointer; \
 
112
        })
96
113
 
97
114
/** Returns the size message parameter.
98
 
 *  @param[in] call The message call structure.
 
115
 *
 
116
 * @param[in] call      The message call structure.
99
117
 */
100
118
#define ICMP_GET_SIZE(call) \
101
 
        ({size_t size = (size_t) IPC_GET_ARG1(call); size;})
 
119
        ({ \
 
120
                size_t size = (size_t) IPC_GET_ARG1(call); \
 
121
                size; \
 
122
        })
102
123
 
103
124
/** Returns the timeout message parameter.
104
 
 *  @param[in] call The message call structure.
 
125
 *
 
126
 * @param[in] call      The message call structure.
105
127
 */
106
128
#define ICMP_GET_TIMEOUT(call) \
107
 
        (({suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); timeout;}))
 
129
        ({ \
 
130
                suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); \
 
131
                timeout; \
 
132
        })
108
133
 
109
134
/** Returns the time to live message parameter.
110
 
 *  @param[in] call The message call structure.
 
135
 *
 
136
 * @param[in] call      The message call structure.
111
137
 */
112
138
#define ICMP_GET_TTL(call) \
113
 
        ({ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); ttl;})
 
139
        ({ \
 
140
                ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); \
 
141
                ttl; \
 
142
        })
114
143
 
115
144
/** Returns the type of service message parameter.
116
 
 *  @param[in] call The message call structure.
 
145
 *
 
146
 * @param[in] call      The message call structure.
117
147
 */
118
148
#define ICMP_GET_TOS(call) \
119
 
        ({ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); tos;})
 
149
        ({ \
 
150
                ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); \
 
151
                tos; \
 
152
        })
120
153
 
121
154
/** Returns the dont fragment message parameter.
122
 
 *  @param[in] call The message call structure.
 
155
 *
 
156
 * @param[in] call      The message call structure.
123
157
 */
124
158
#define ICMP_GET_DONT_FRAGMENT(call) \
125
 
        ({int dont_fragment = (int) IPC_GET_ARG5(call); dont_fragment;})
 
159
        ({ \
 
160
                int dont_fragment = (int) IPC_GET_ARG5(call); \
 
161
                dont_fragment; \
 
162
        })
126
163
 
127
164
/*@}*/
128
165