Changeset 32eceb4f in mainline for uspace/srv/net/tl/icmp/icmp.c
- Timestamp:
- 2010-11-20T22:30:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cb59f787
- Parents:
- 1b22bd4 (diff), 7e1f9b7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/icmp/icmp.c
r1b22bd4 r32eceb4f 100 100 * @param[in,out] header The ICMP datagram header. 101 101 * @param[in] length The total datagram length. 102 * @return sThe computed checksum.102 * @return The computed checksum. 103 103 */ 104 104 #define ICMP_CHECKSUM(header, length) \ … … 112 112 * @param[in] id The message identifier. 113 113 * @param[in] sequence The message sequence number. 114 * @return sThe computed ICMP reply data key.114 * @return The computed ICMP reply data key. 115 115 */ 116 116 #define ICMP_GET_REPLY_KEY(id, sequence) \ … … 128 128 * @param[in] packet The packet queue to be released. 129 129 * @param[in] result The result to be returned. 130 * @return sThe result parameter.131 */ 132 static int icmp_release_and_return(packet_t packet, int result)130 * @return The result parameter. 131 */ 132 static int icmp_release_and_return(packet_t *packet, int result) 133 133 { 134 134 pq_release_remote(icmp_globals.net_phone, packet_get_id(packet)); … … 152 152 * @param[in] dont_fragment The value indicating whether the datagram must not 153 153 * be fragmented. Is used as a MTU discovery. 154 * @return sEOK on success.155 * @return sEPERM if the error message is not allowed.156 */ 157 static int icmp_send_packet(icmp_type_t type, icmp_code_t code, packet_t packet,158 icmp_header_ refheader, services_t error, ip_ttl_t ttl, ip_tos_t tos,154 * @return EOK on success. 155 * @return EPERM if the error message is not allowed. 156 */ 157 static int icmp_send_packet(icmp_type_t type, icmp_code_t code, packet_t *packet, 158 icmp_header_t *header, services_t error, ip_ttl_t ttl, ip_tos_t tos, 159 159 int dont_fragment) 160 160 { … … 186 186 * 187 187 * @param[in,out] packet The original packet. 188 * @return sThe prefixed ICMP header.189 * @return sNULL on errors.190 */ 191 static icmp_header_ ref icmp_prepare_packet(packet_tpacket)192 { 193 icmp_header_ refheader;188 * @return The prefixed ICMP header. 189 * @return NULL on errors. 190 */ 191 static icmp_header_t *icmp_prepare_packet(packet_t *packet) 192 { 193 icmp_header_t *header; 194 194 size_t header_length; 195 195 size_t total_length; … … 234 234 * @param[in] addr The target host address. 235 235 * @param[in] addrlen The torget host address length. 236 * @return sICMP_ECHO on success.237 * @return sETIMEOUT if the reply has not arrived before the236 * @return ICMP_ECHO on success. 237 * @return ETIMEOUT if the reply has not arrived before the 238 238 * timeout. 239 * @return sICMP type of the received error notification.240 * @return sEINVAL if the addrlen parameter is less or equal to239 * @return ICMP type of the received error notification. 240 * @return EINVAL if the addrlen parameter is less or equal to 241 241 * zero. 242 * @return sENOMEM if there is not enough memory left.243 * @return sEPARTY if there was an internal error.242 * @return ENOMEM if there is not enough memory left. 243 * @return EPARTY if there was an internal error. 244 244 */ 245 245 static int icmp_echo(icmp_param_t id, icmp_param_t sequence, size_t size, … … 247 247 const struct sockaddr * addr, socklen_t addrlen) 248 248 { 249 icmp_header_ refheader;250 packet_t packet;249 icmp_header_t *header; 250 packet_t *packet; 251 251 size_t length; 252 252 uint8_t *data; 253 icmp_reply_ refreply;253 icmp_reply_t *reply; 254 254 int reply_key; 255 255 int index; … … 340 340 341 341 static int icmp_destination_unreachable_msg_local(int icmp_phone, 342 icmp_code_t code, icmp_param_t mtu, packet_t packet)343 { 344 icmp_header_ refheader;342 icmp_code_t code, icmp_param_t mtu, packet_t *packet) 343 { 344 icmp_header_t *header; 345 345 346 346 header = icmp_prepare_packet(packet); … … 355 355 } 356 356 357 static int icmp_source_quench_msg_local(int icmp_phone, packet_t packet)358 { 359 icmp_header_ refheader;357 static int icmp_source_quench_msg_local(int icmp_phone, packet_t *packet) 358 { 359 icmp_header_t *header; 360 360 361 361 header = icmp_prepare_packet(packet); … … 368 368 369 369 static int icmp_time_exceeded_msg_local(int icmp_phone, icmp_code_t code, 370 packet_t packet)371 { 372 icmp_header_ refheader;370 packet_t *packet) 371 { 372 icmp_header_t *header; 373 373 374 374 header = icmp_prepare_packet(packet); … … 381 381 382 382 static int icmp_parameter_problem_msg_local(int icmp_phone, icmp_code_t code, 383 icmp_param_t pointer, packet_t packet)384 { 385 icmp_header_ refheader;383 icmp_param_t pointer, packet_t *packet) 384 { 385 icmp_header_t *header; 386 386 387 387 header = icmp_prepare_packet(packet); … … 398 398 * @param[in] client_connection The client connection processing function. The 399 399 * module skeleton propagates its own one. 400 * @return sEOK on success.401 * @return sENOMEM if there is not enough memory left.400 * @return EOK on success. 401 * @return ENOMEM if there is not enough memory left. 402 402 */ 403 403 int icmp_initialize(async_client_conn_t client_connection) … … 413 413 } 414 414 }; 415 measured_string_ refconfiguration;415 measured_string_t *configuration; 416 416 size_t count = sizeof(names) / sizeof(measured_string_t); 417 417 char *data; … … 479 479 * @param[in] code The received reply message code. 480 480 */ 481 static void icmp_process_echo_reply(packet_t packet, icmp_header_refheader,481 static void icmp_process_echo_reply(packet_t *packet, icmp_header_t *header, 482 482 icmp_type_t type, icmp_code_t code) 483 483 { 484 484 int reply_key; 485 icmp_reply_ refreply;485 icmp_reply_t *reply; 486 486 487 487 /* Compute the reply key */ … … 507 507 * @param[in] error The packet error reporting service. Prefixes the 508 508 * received packet. 509 * @return sEOK on success.510 * @return sEINVAL if the packet is not valid.511 * @return sEINVAL if the stored packet address is not the an_addr_t.512 * @return sEINVAL if the packet does not contain any data.513 * @return sNO_DATA if the packet content is shorter than the user509 * @return EOK on success. 510 * @return EINVAL if the packet is not valid. 511 * @return EINVAL if the stored packet address is not the an_addr_t. 512 * @return EINVAL if the packet does not contain any data. 513 * @return NO_DATA if the packet content is shorter than the user 514 514 * datagram header. 515 * @return sENOMEM if there is not enough memory left.516 * @return sEADDRNOTAVAIL if the destination socket does not exist.517 * @return sOther error codes as defined for the515 * @return ENOMEM if there is not enough memory left. 516 * @return EADDRNOTAVAIL if the destination socket does not exist. 517 * @return Other error codes as defined for the 518 518 * ip_client_process_packet() function. 519 519 */ 520 static int icmp_process_packet(packet_t packet, services_t error)520 static int icmp_process_packet(packet_t *packet, services_t error) 521 521 { 522 522 size_t length; … … 525 525 int result; 526 526 void *data; 527 icmp_header_ refheader;527 icmp_header_t *header; 528 528 icmp_type_t type; 529 529 icmp_code_t code; … … 567 567 568 568 /* Get ICMP header */ 569 header = (icmp_header_ ref) data;569 header = (icmp_header_t *) data; 570 570 571 571 if (header->checksum) { … … 654 654 * @param[in] error The packet error reporting service. Prefixes the 655 655 * received packet. 656 * @return sEOK on success.657 * @return sOther error codes as defined for the656 * @return EOK on success. 657 * @return Other error codes as defined for the 658 658 * icmp_process_packet() function. 659 659 */ 660 static int icmp_received_msg_local(device_id_t device_id, packet_t packet,660 static int icmp_received_msg_local(device_id_t device_id, packet_t *packet, 661 661 services_t receiver, services_t error) 662 662 { … … 673 673 * 674 674 * @param[in] call The message parameters. 675 * @return sEOK on success.676 * @return sENOTSUP if the message is not known.677 * @return sOther error codes as defined for the packet_translate()675 * @return EOK on success. 676 * @return ENOTSUP if the message is not known. 677 * @return Other error codes as defined for the packet_translate() 678 678 * function. 679 * @return sOther error codes as defined for the679 * @return Other error codes as defined for the 680 680 * icmp_destination_unreachable_msg_local() function. 681 * @return sOther error codes as defined for the681 * @return Other error codes as defined for the 682 682 * icmp_source_quench_msg_local() function. 683 * @return sOther error codes as defined for the683 * @return Other error codes as defined for the 684 684 * icmp_time_exceeded_msg_local() function. 685 * @return sOther error codes as defined for the685 * @return Other error codes as defined for the 686 686 * icmp_parameter_problem_msg_local() function. 687 687 * … … 690 690 static int icmp_process_message(ipc_call_t *call) 691 691 { 692 packet_t packet;692 packet_t *packet; 693 693 int rc; 694 694 … … 731 731 * 732 732 * @param[in,out] echo_data The echo data to be bound. 733 * @return sIndex of the inserted echo data.734 * @return sEBADMEM if the echo_data parameter is NULL.735 * @return sENOTCONN if no free identifier have been found.736 */ 737 static int icmp_bind_free_id(icmp_echo_ refecho_data)733 * @return Index of the inserted echo data. 734 * @return EBADMEM if the echo_data parameter is NULL. 735 * @return ENOTCONN if no free identifier have been found. 736 */ 737 static int icmp_bind_free_id(icmp_echo_t *echo_data) 738 738 { 739 739 icmp_param_t index; … … 778 778 * @param[in] callid The message identifier. 779 779 * @param[in] call The message parameters. 780 * @return sEOK.780 * @return EOK. 781 781 * 782 782 * @see icmp_interface.h … … 791 791 struct sockaddr *addr; 792 792 ipc_callid_t data_callid; 793 icmp_echo_ refecho_data;793 icmp_echo_t *echo_data; 794 794 int rc = EOK; 795 795 … … 800 800 answer_count = 0; 801 801 802 echo_data = (icmp_echo_ ref) malloc(sizeof(*echo_data));802 echo_data = (icmp_echo_t *) malloc(sizeof(*echo_data)); 803 803 if (!echo_data) 804 804 return ENOMEM; … … 887 887 * @param[out] answer_count The last parameter for the actual answer in the 888 888 * answer parameter. 889 * @return sEOK on success.890 * @return sENOTSUP if the message is not known.889 * @return EOK on success. 890 * @return ENOTSUP if the message is not known. 891 891 * 892 892 * @see icmp_interface.h … … 896 896 ipc_call_t *answer, int *answer_count) 897 897 { 898 packet_t packet;898 packet_t *packet; 899 899 int rc; 900 900 … … 964 964 /** Starts the module. 965 965 * 966 * @return sEOK on success.967 * @return sOther error codes as defined for each specific module966 * @return EOK on success. 967 * @return Other error codes as defined for each specific module 968 968 * start function. 969 969 */
Note:
See TracChangeset
for help on using the changeset viewer.