26
26
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
* ICMP module messages.
35
* @see icmp_interface.h
34
* ICMP module messages.
35
* @see icmp_interface.h
38
#ifndef __NET_ICMP_MESSAGES__
39
#define __NET_ICMP_MESSAGES__
38
#ifndef LIBC_ICMP_MESSAGES_
39
#define LIBC_ICMP_MESSAGES_
41
41
#include <ipc/ipc.h>
42
43
#include <sys/types.h>
44
#include <icmp_codes.h>
45
#include <net_messages.h>
47
/** ICMP module messages.
50
/** Sends echo request.
46
#include <net/icmp_codes.h>
48
/** ICMP module messages. */
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()
54
* Sends destination unreachable error message.
55
* @see icmp_destination_unreachable_msg()
57
57
NET_ICMP_DEST_UNREACH,
58
/** Sends source quench error message.
59
* @see icmp_source_quench_msg()
60
* Sends source quench error message.
61
* @see icmp_source_quench_msg()
61
63
NET_ICMP_SOURCE_QUENCH,
62
/** Sends time exceeded error message.
63
* @see icmp_time_exceeded_msg()
66
* Sends time exceeded error message.
67
* @see icmp_time_exceeded_msg()
65
69
NET_ICMP_TIME_EXCEEDED,
66
/** Sends parameter problem error message.
67
* @see icmp_parameter_problem_msg()
72
* Sends parameter problem error message.
73
* @see icmp_parameter_problem_msg()
69
75
NET_ICMP_PARAMETERPROB,
70
/** Initializes new connection.
77
/** Initializes new connection. */
75
/** @name ICMP specific message parameters definitions
81
/** @name ICMP specific message parameters definitions */
79
84
/** Returns the ICMP code message parameter.
80
* @param[in] call The message call structure.
86
* @param[in] call The message call structure.
82
88
#define ICMP_GET_CODE(call) \
83
({icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); code;})
90
icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); \
85
94
/** Returns the ICMP link MTU message parameter.
86
* @param[in] call The message call structure.
96
* @param[in] call The message call structure.
88
98
#define ICMP_GET_MTU(call) \
89
({icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); mtu;})
100
icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); \
91
104
/** Returns the pointer message parameter.
92
* @param[in] call The message call structure.
106
* @param[in] call The message call structure.
94
108
#define ICMP_GET_POINTER(call) \
95
({icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); pointer;})
110
icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); \
97
114
/** Returns the size message parameter.
98
* @param[in] call The message call structure.
116
* @param[in] call The message call structure.
100
118
#define ICMP_GET_SIZE(call) \
101
({size_t size = (size_t) IPC_GET_ARG1(call); size;})
120
size_t size = (size_t) IPC_GET_ARG1(call); \
103
124
/** Returns the timeout message parameter.
104
* @param[in] call The message call structure.
126
* @param[in] call The message call structure.
106
128
#define ICMP_GET_TIMEOUT(call) \
107
(({suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); timeout;}))
130
suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); \
109
134
/** Returns the time to live message parameter.
110
* @param[in] call The message call structure.
136
* @param[in] call The message call structure.
112
138
#define ICMP_GET_TTL(call) \
113
({ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); ttl;})
140
ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); \
115
144
/** Returns the type of service message parameter.
116
* @param[in] call The message call structure.
146
* @param[in] call The message call structure.
118
148
#define ICMP_GET_TOS(call) \
119
({ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); tos;})
150
ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); \
121
154
/** Returns the dont fragment message parameter.
122
* @param[in] call The message call structure.
156
* @param[in] call The message call structure.
124
158
#define ICMP_GET_DONT_FRAGMENT(call) \
125
({int dont_fragment = (int) IPC_GET_ARG5(call); dont_fragment;})
160
int dont_fragment = (int) IPC_GET_ARG5(call); \