Ignore:
File:
1 edited

Legend:

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

    r6b82009 rffa2c8ef  
    3939#include <net/modules.h>
    4040#include <packet_client.h>
     41
     42#include <async.h>
     43#include <errno.h>
    4144#include <ipc/services.h>
    4245#include <ipc/icmp.h>
    4346#include <sys/types.h>
    44 #include <async.h>
    45 #include <errno.h>
    4647
    47 /** Send the Destination Unreachable error notification packet.
     48/** Sends the Destination Unreachable error notification packet.
    4849 *
    4950 * Beginning of the packet is sent as the notification packet data.
     
    5152 * packet.
    5253 *
    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  *
     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.
    6261 */
    63 int icmp_destination_unreachable_msg(async_sess_t *sess, icmp_code_t code,
     62int
     63icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code,
    6464    icmp_param_t mtu, packet_t *packet)
    6565{
    66         async_exch_t *exch = async_exchange_begin(sess);
    67         async_msg_3(exch, NET_ICMP_DEST_UNREACH, (sysarg_t) code,
     66        async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (sysarg_t) code,
    6867            (sysarg_t) packet_get_id(packet), (sysarg_t) mtu);
    69         async_exchange_end(exch);
    70        
    7168        return EOK;
    7269}
    7370
    74 /** Send the Source Quench error notification packet.
     71/** Sends the Source Quench error notification packet.
    7572 *
    7673 * Beginning of the packet is sent as the notification packet data.
     
    7875 * packet.
    7976 *
    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  *
     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.
    8782 */
    88 int icmp_source_quench_msg(async_sess_t *sess, packet_t *packet)
     83int icmp_source_quench_msg(int icmp_phone, packet_t *packet)
    8984{
    90         async_exch_t *exch = async_exchange_begin(sess);
    91         async_msg_2(exch, NET_ICMP_SOURCE_QUENCH, 0,
     85        async_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0,
    9286            (sysarg_t) packet_get_id(packet));
    93         async_exchange_end(exch);
    94        
    9587        return EOK;
    9688}
    9789
    98 /** Send the Time Exceeded error notification packet.
     90/** Sends the Time Exceeded error notification packet.
    9991 *
    10092 * Beginning of the packet is sent as the notification packet data.
     
    10294 * packet.
    10395 *
    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  *
     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.
    112102 */
    113 int icmp_time_exceeded_msg(async_sess_t *sess, icmp_code_t code,
    114     packet_t *packet)
     103int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t *packet)
    115104{
    116         async_exch_t *exch = async_exchange_begin(sess);
    117         async_msg_2(exch, NET_ICMP_TIME_EXCEEDED, (sysarg_t) code,
     105        async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (sysarg_t) code,
    118106            (sysarg_t) packet_get_id(packet));
    119         async_exchange_end(exch);
    120        
    121107        return EOK;
    122108}
    123109
    124 /** Send the Parameter Problem error notification packet.
     110/** Sends the Parameter Problem error notification packet.
    125111 *
    126112 * Beginning of the packet is sent as the notification packet data.
     
    128114 * packet.
    129115 *
    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  *
     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.
    139123 */
    140 int icmp_parameter_problem_msg(async_sess_t *sess, icmp_code_t code,
     124int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code,
    141125    icmp_param_t pointer, packet_t *packet)
    142126{
    143         async_exch_t *exch = async_exchange_begin(sess);
    144         async_msg_3(exch, NET_ICMP_PARAMETERPROB, (sysarg_t) code,
     127        async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (sysarg_t) code,
    145128            (sysarg_t) packet_get_id(packet), (sysarg_t) pointer);
    146         async_exchange_end(exch);
    147        
    148129        return EOK;
    149130}
     
    151132/** @}
    152133 */
     134
Note: See TracChangeset for help on using the changeset viewer.