Rev 4719 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4719 | Rev 4720 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | #include "../../include/ip_codes.h" |
49 | #include "../../include/ip_codes.h" |
50 | #include "../../include/socket_codes.h" |
50 | #include "../../include/socket_codes.h" |
51 | 51 | ||
52 | #include "icmp_messages.h" |
52 | #include "icmp_messages.h" |
53 | 53 | ||
54 | int icmp_echo_msg( int icmp_phone, size_t size, suseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen ){ |
54 | int icmp_echo_msg( int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen ){ |
55 | aid_t message_id; |
55 | aid_t message_id; |
56 | ipcarg_t result; |
56 | ipcarg_t result; |
57 | 57 | ||
- | 58 | if( addrlen <= 0 ){ |
|
- | 59 | return EINVAL; |
|
- | 60 | } |
|
58 | message_id = async_send_5( icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, ( ipcarg_t ) dont_fragment, NULL ); |
61 | message_id = async_send_5( icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, ( ipcarg_t ) dont_fragment, NULL ); |
59 | // send the address |
62 | // send the address |
60 | ipc_data_write_start( icmp_phone, addr, addrlen ); |
63 | ipc_data_write_start( icmp_phone, addr, ( size_t ) addrlen ); |
61 | // timeout version may cause inconsistency - there is also an inner timer |
64 | // timeout version may cause inconsistency - there is also an inner timer |
62 | // return async_wait_timeout( message_id, & result, timeout ); |
65 | // return async_wait_timeout( message_id, & result, timeout ); |
63 | async_wait_for( message_id, & result ); |
66 | async_wait_for( message_id, & result ); |
64 | return ( int ) result; |
67 | return ( int ) result; |
65 | } |
68 | } |