Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/tl/icmp_remote.c

    rffa2c8ef r6b82009  
    3939#include <net/modules.h>
    4040#include <packet_client.h>
    41 
    42 #include <async.h>
    43 #include <errno.h>
    4441#include <ipc/services.h>
    4542#include <ipc/icmp.h>
    4643#include <sys/types.h>
     44#include <async.h>
     45#include <errno.h>
    4746
    48 /** Sends the Destination Unreachable error notification packet.
     47/** Send the Destination Unreachable error notification packet.
    4948 *
    5049 * Beginning of the packet is sent as the notification packet data.
     
    5251 * packet.
    5352 *
    54  * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls.
    55  * @param[in] code      The error specific code.
    56  * @param[in] mtu       The error MTU value.
    57  * @param[in] packet    The original packet.
    58  * @return              EOK on success.
    59  * @return              EPERM if the ICMP error notifications are disabled.
    60  * @return              ENOMEM if there is not enough memory left.
     53 * @param[in] sess   ICMP module session.
     54 * @param[in] code   Error specific code.
     55 * @param[in] mtu    Error MTU value.
     56 * @param[in] packet Original packet.
     57 *
     58 * @return EOK on success.
     59 * @return EPERM if the ICMP error notifications are disabled.
     60 * @return ENOMEM if there is not enough memory left.
     61 *
    6162 */
    62 int
    63 icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code,
     63int icmp_destination_unreachable_msg(async_sess_t *sess, icmp_code_t code,
    6464    icmp_param_t mtu, packet_t *packet)
    6565{
    66         async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (sysarg_t) code,
     66        async_exch_t *exch = async_exchange_begin(sess);
     67        async_msg_3(exch, NET_ICMP_DEST_UNREACH, (sysarg_t) code,
    6768            (sysarg_t) packet_get_id(packet), (sysarg_t) mtu);
     69        async_exchange_end(exch);
     70       
    6871        return EOK;
    6972}
    7073
    71 /** Sends the Source Quench error notification packet.
     74/** Send the Source Quench error notification packet.
    7275 *
    7376 * Beginning of the packet is sent as the notification packet data.
     
    7578 * packet.
    7679 *
    77  * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls.
    78  * @param[in] packet    The original packet.
    79  * @return              EOK on success.
    80  * @return              EPERM if the ICMP error notifications are disabled.
    81  * @return              ENOMEM if there is not enough memory left.
     80 * @param[in] sess   ICMP module session.
     81 * @param[in] packet Original packet.
     82 *
     83 * @return EOK on success.
     84 * @return EPERM if the ICMP error notifications are disabled.
     85 * @return ENOMEM if there is not enough memory left.
     86 *
    8287 */
    83 int icmp_source_quench_msg(int icmp_phone, packet_t *packet)
     88int icmp_source_quench_msg(async_sess_t *sess, packet_t *packet)
    8489{
    85         async_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0,
     90        async_exch_t *exch = async_exchange_begin(sess);
     91        async_msg_2(exch, NET_ICMP_SOURCE_QUENCH, 0,
    8692            (sysarg_t) packet_get_id(packet));
     93        async_exchange_end(exch);
     94       
    8795        return EOK;
    8896}
    8997
    90 /** Sends the Time Exceeded error notification packet.
     98/** Send the Time Exceeded error notification packet.
    9199 *
    92100 * Beginning of the packet is sent as the notification packet data.
     
    94102 * packet.
    95103 *
    96  * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls.
    97  * @param[in] code      The error specific code.
    98  * @param[in] packet    The original packet.
    99  * @return              EOK on success.
    100  * @return              EPERM if the ICMP error notifications are disabled.
    101  * @return              ENOMEM if there is not enough memory left.
     104 * @param[in] sess   ICMP module session.
     105 * @param[in] code   Error specific code.
     106 * @param[in] packet Original packet.
     107 *
     108 * @return EOK on success.
     109 * @return EPERM if the ICMP error notifications are disabled.
     110 * @return ENOMEM if there is not enough memory left.
     111 *
    102112 */
    103 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t *packet)
     113int icmp_time_exceeded_msg(async_sess_t *sess, icmp_code_t code,
     114    packet_t *packet)
    104115{
    105         async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (sysarg_t) code,
     116        async_exch_t *exch = async_exchange_begin(sess);
     117        async_msg_2(exch, NET_ICMP_TIME_EXCEEDED, (sysarg_t) code,
    106118            (sysarg_t) packet_get_id(packet));
     119        async_exchange_end(exch);
     120       
    107121        return EOK;
    108122}
    109123
    110 /** Sends the Parameter Problem error notification packet.
     124/** Send the Parameter Problem error notification packet.
    111125 *
    112126 * Beginning of the packet is sent as the notification packet data.
     
    114128 * packet.
    115129 *
    116  * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls.
    117  * @param[in] code      The error specific code.
    118  * @param[in] pointer   The problematic parameter offset.
    119  * @param[in] packet    The original packet.
    120  * @return              EOK on success.
    121  * @return              EPERM if the ICMP error notifications are disabled.
    122  * @return              ENOMEM if there is not enough memory left.
     130 * @param[in] sess    ICMP module session.
     131 * @param[in] code    Error specific code.
     132 * @param[in] pointer Problematic parameter offset.
     133 * @param[in] packet  Original packet.
     134 *
     135 * @return EOK on success.
     136 * @return EPERM if the ICMP error notifications are disabled.
     137 * @return ENOMEM if there is not enough memory left.
     138 *
    123139 */
    124 int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code,
     140int icmp_parameter_problem_msg(async_sess_t *sess, icmp_code_t code,
    125141    icmp_param_t pointer, packet_t *packet)
    126142{
    127         async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (sysarg_t) code,
     143        async_exch_t *exch = async_exchange_begin(sess);
     144        async_msg_3(exch, NET_ICMP_PARAMETERPROB, (sysarg_t) code,
    128145            (sysarg_t) packet_get_id(packet), (sysarg_t) pointer);
     146        async_exchange_end(exch);
     147       
    129148        return EOK;
    130149}
     
    132151/** @}
    133152 */
    134 
Note: See TracChangeset for help on using the changeset viewer.