Changes in uspace/srv/net/tl/icmp/icmp.c [8e3a65c:14f1db0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/icmp/icmp.c
r8e3a65c r14f1db0 44 44 #include <ipc/ipc.h> 45 45 #include <ipc/services.h> 46 #include <ipc/net.h>47 #include <ipc/tl.h>48 #include <ipc/icmp.h>49 46 #include <sys/time.h> 50 47 #include <sys/types.h> 51 #include <byteorder.h> 52 #include <errno.h> 53 #include <err.h> 54 55 #include <net/socket_codes.h> 56 #include <net/ip_protocols.h> 57 #include <net/inet.h> 58 59 #include <net/modules.h> 60 #include <packet_client.h> 48 49 #include <net_err.h> 50 #include <net_messages.h> 51 #include <net_modules.h> 52 #include <packet/packet_client.h> 61 53 #include <packet_remote.h> 54 #include <net_byteorder.h> 62 55 #include <net_checksum.h> 63 #include < net/icmp_api.h>56 #include <icmp_api.h> 64 57 #include <icmp_client.h> 65 #include < net/icmp_codes.h>66 #include < net/icmp_common.h>58 #include <icmp_codes.h> 59 #include <icmp_common.h> 67 60 #include <icmp_interface.h> 68 61 #include <il_interface.h> 62 #include <inet.h> 69 63 #include <ip_client.h> 70 64 #include <ip_interface.h> 65 #include <ip_protocols.h> 71 66 #include <net_interface.h> 67 #include <socket_codes.h> 68 #include <socket_errno.h> 69 #include <tl_messages.h> 72 70 #include <tl_interface.h> 73 71 #include <tl_local.h> 72 #include <icmp_messages.h> 74 73 #include <icmp_header.h> 75 74 … … 99 98 /** Free identifier numbers pool end. 100 99 */ 101 #define ICMP_FREE_IDS_END UINT16_MAX100 #define ICMP_FREE_IDS_END MAX_UINT16 102 101 103 102 /** Computes the ICMP datagram checksum. … … 264 263 }else{ 265 264 res = icmp_echo(echo_data->identifier, echo_data->sequence_number, size, timeout, ttl, tos, dont_fragment, addr, addrlen); 266 if(echo_data->sequence_number < UINT16_MAX){265 if(echo_data->sequence_number < MAX_UINT16){ 267 266 ++ echo_data->sequence_number; 268 267 }else{ … … 449 448 } 450 449 450 int icmp_connect_module(services_t service, suseconds_t timeout){ 451 icmp_echo_ref echo_data; 452 icmp_param_t id; 453 int index; 454 455 echo_data = (icmp_echo_ref) malloc(sizeof(*echo_data)); 456 if(! echo_data){ 457 return ENOMEM; 458 } 459 // assign a new identifier 460 fibril_rwlock_write_lock(&icmp_globals.lock); 461 index = icmp_bind_free_id(echo_data); 462 if(index < 0){ 463 free(echo_data); 464 fibril_rwlock_write_unlock(&icmp_globals.lock); 465 return index; 466 }else{ 467 id = echo_data->identifier; 468 fibril_rwlock_write_unlock(&icmp_globals.lock); 469 // return the echo data identifier as the ICMP phone 470 return id; 471 } 472 } 473 451 474 int icmp_initialize(async_client_conn_t client_connection){ 452 475 ERROR_DECLARE; … … 461 484 icmp_replies_initialize(&icmp_globals.replies); 462 485 icmp_echo_data_initialize(&icmp_globals.echo_data); 463 icmp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP, client_connection );486 icmp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP, client_connection, icmp_received_msg); 464 487 if(icmp_globals.ip_phone < 0){ 465 488 return icmp_globals.ip_phone; … … 708 731 fibril_rwlock_write_unlock(&icmp_globals.lock); 709 732 free(addr); 710 if(echo_data->sequence_number < UINT16_MAX){733 if(echo_data->sequence_number < MAX_UINT16){ 711 734 ++ echo_data->sequence_number; 712 735 }else{
Note:
See TracChangeset
for help on using the changeset viewer.