Changeset 6b82009 in mainline for uspace/lib/net/il


Ignore:
Timestamp:
2011-06-22T20:41:41Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef09a7a
Parents:
55091847
Message:

networking stack: convert to the new async framework

Location:
uspace/lib/net/il
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/il/arp_remote.c

    r55091847 r6b82009  
    3838#include <arp_interface.h>
    3939#include <generic.h>
    40 
    41 #include <async.h>
    42 #include <async_obsolete.h>
    43 #include <errno.h>
    4440#include <ipc/services.h>
    4541#include <ipc/arp.h>
    46 
    4742#include <net/modules.h>
    4843#include <net/device.h>
    4944#include <adt/measured_strings.h>
     45#include <async.h>
     46#include <errno.h>
    5047
    51 /** Connects to the ARP module.
     48/** Connect to the ARP module.
    5249 *
    53  * @param service       The ARP module service. Ignored parameter.
    54  * @return              The ARP module phone on success.
     50 * @return ARP module session on success.
     51 *
    5552 */
    56 int arp_connect_module(services_t service)
     53async_sess_t *arp_connect_module(services_t service)
    5754{
    58         if (service != SERVICE_ARP)
    59                 return EINVAL;
    60 
     55        // FIXME: Get rid of the useless argument
    6156        return connect_to_service(SERVICE_ARP);
    6257}
     
    6459/** Cleans the cache.
    6560 *
    66  * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    67  * @return              EOK on success.
     61 * @param[in] sess ARP module session.
     62 *
     63 * @return EOK on success.
     64 *
    6865 */
    69 int arp_clean_cache_req(int arp_phone)
     66int arp_clean_cache_req(async_sess_t *sess)
    7067{
    71         return (int) async_obsolete_req_0_0(arp_phone, NET_ARP_CLEAN_CACHE);
     68        async_exch_t *exch = async_exchange_begin(sess);
     69        int rc = async_req_0_0(exch, NET_ARP_CLEAN_CACHE);
     70        async_exchange_end(exch);
     71       
     72        return rc;
    7273}
    7374
    74 /** Clears the given protocol address from the cache.
     75/** Clear the given protocol address from the cache.
    7576 *
    76  * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    77  * @param[in] device_id The device identifier.
    78  * @param[in] protocol  The requesting protocol service.
    79  * @param[in] address   The protocol address to be cleared.
    80  * @return              EOK on success.
    81  * @return              ENOENT if the mapping is not found.
     77 * @param[in] sess      ARP module session.
     78 * @param[in] device_id Device identifier.
     79 * @param[in] protocol  Requesting protocol service.
     80 * @param[in] address   Protocol address to be cleared.
     81 *
     82 * @return EOK on success.
     83 * @return ENOENT if the mapping is not found.
     84 *
    8285 */
    83 int
    84 arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol,
    85     measured_string_t *address)
     86int arp_clear_address_req(async_sess_t *sess, device_id_t device_id,
     87    services_t protocol, measured_string_t *address)
    8688{
    87         aid_t message_id;
     89        async_exch_t *exch = async_exchange_begin(sess);
     90        aid_t message_id = async_send_2(exch, NET_ARP_CLEAR_ADDRESS,
     91            (sysarg_t) device_id, protocol, NULL);
     92        measured_strings_send(exch, address, 1);
     93        async_exchange_end(exch);
     94       
    8895        sysarg_t result;
     96        async_wait_for(message_id, &result);
     97       
     98        return (int) result;
     99}
    89100
    90         message_id = async_obsolete_send_2(arp_phone, NET_ARP_CLEAR_ADDRESS,
    91             (sysarg_t) device_id, protocol, NULL);
    92         measured_strings_send(arp_phone, address, 1);
     101/** Clear the device cache.
     102 *
     103 * @param[in] sess      ARP module session.
     104 * @param[in] device_id Device identifier.
     105 *
     106 * @return EOK on success.
     107 * @return ENOENT if the device is not found.
     108 *
     109 */
     110int arp_clear_device_req(async_sess_t *sess, device_id_t device_id)
     111{
     112        async_exch_t *exch = async_exchange_begin(sess);
     113        int rc = async_req_1_0(exch, NET_ARP_CLEAR_DEVICE,
     114            (sysarg_t) device_id);
     115        async_exchange_end(exch);
     116       
     117        return rc;
     118}
     119
     120/** Register new device and the requesting protocol service.
     121 *
     122 * Connect to the network interface layer service.
     123 * Determine the device broadcast address, its address lengths and packet size.
     124 *
     125 * @param[in] sess      ARP module session.
     126 * @param[in] device_id New device identifier.
     127 * @param[in] protocol  Requesting protocol service.
     128 * @param[in] netif     Underlying device network interface layer service.
     129 * @param[in] address   Local requesting protocol address of the device.
     130 *
     131 * @return EOK on success.
     132 * @return EEXIST if the device is already used.
     133 * @return ENOMEM if there is not enough memory left.
     134 * @return ENOENT if the network interface service is not known.
     135 * @return EREFUSED if the network interface service is not
     136 *         responding.
     137 * @return Other error codes as defined for the
     138 *         nil_packet_get_size() function.
     139 * @return Other error codes as defined for the nil_get_addr()
     140 *         function.
     141 * @return Other error codes as defined for the
     142 *         nil_get_broadcast_addr() function.
     143 *
     144 */
     145int arp_device_req(async_sess_t *sess, device_id_t device_id,
     146    services_t protocol, services_t netif, measured_string_t *address)
     147{
     148        async_exch_t *exch = async_exchange_begin(sess);
     149        aid_t message_id = async_send_3(exch, NET_ARP_DEVICE,
     150            (sysarg_t) device_id, protocol, netif, NULL);
     151        measured_strings_send(exch, address, 1);
     152        async_exchange_end(exch);
     153       
     154        sysarg_t result;
    93155        async_wait_for(message_id, &result);
    94156
     
    96158}
    97159
    98 /** Clears the device cache.
     160/** Translate the given protocol address to the network interface address.
    99161 *
    100  * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    101  * @param[in] device_id The device identifier.
    102  * @return              EOK on success.
    103  * @return              ENOENT if the device is not found.
     162 * Broadcast the ARP request if the mapping is not found.
     163 * Allocate and returns the needed memory block as the data parameter.
     164 *
     165 * @param[in]  sess        ARP module session.
     166 * @param[in]  device_id   Device identifier.
     167 * @param[in]  protocol    Requesting protocol service.
     168 * @param[in]  address     Local requesting protocol address.
     169 * @param[out] translation Translation of the local protocol address.
     170 * @param[out] data        Allocated raw translation data container.
     171 *
     172 * @return EOK on success.
     173 * @return EINVAL if the address parameter is NULL.
     174 * @return EBADMEM if the translation or the data parameters are
     175 *         NULL.
     176 * @return ENOENT if the mapping is not found.
     177 *
    104178 */
    105 int arp_clear_device_req(int arp_phone, device_id_t device_id)
     179int arp_translate_req(async_sess_t *sess, device_id_t device_id,
     180    services_t protocol, measured_string_t *address,
     181    measured_string_t **translation, uint8_t **data)
    106182{
    107         return (int) async_obsolete_req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE,
    108             (sysarg_t) device_id);
    109 }
    110 
    111 /** Registers the new device and the requesting protocol service.
    112  *
    113  * Connects to the network interface layer service.
    114  * Determines the device broadcast address, its address lengths and packet size.
    115  *
    116  * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    117  * @param[in] device_id The new device identifier.
    118  * @param[in] protocol  The requesting protocol service.
    119  * @param[in] netif     The underlying device network interface layer service.
    120  * @param[in] address   The local requesting protocol address of the device.
    121  * @return              EOK on success.
    122  * @return              EEXIST if the device is already used.
    123  * @return              ENOMEM if there is not enough memory left.
    124  * @return              ENOENT if the network interface service is not known.
    125  * @return              EREFUSED if the network interface service is not
    126  *                      responding.
    127  * @return              Other error codes as defined for the
    128  *                      nil_packet_get_size() function.
    129  * @return              Other error codes as defined for the nil_get_addr()
    130  *                      function.
    131  * @return              Other error codes as defined for the
    132  *                      nil_get_broadcast_addr() function.
    133  */
    134 int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol,
    135     services_t netif, measured_string_t *address)
    136 {
    137         aid_t message_id;
    138         sysarg_t result;
    139 
    140         message_id = async_obsolete_send_3(arp_phone, NET_ARP_DEVICE,
    141             (sysarg_t) device_id, protocol, netif, NULL);
    142         measured_strings_send(arp_phone, address, 1);
    143         async_wait_for(message_id, &result);
    144 
    145         return (int) result;
    146 }
    147 
    148 /** Translates the given protocol address to the network interface address.
    149  *
    150  * Broadcasts the ARP request if the mapping is not found.
    151  * Allocates and returns the needed memory block as the data parameter.
    152  *
    153  * @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    154  * @param[in] device_id The device identifier.
    155  * @param[in] protocol  The requesting protocol service.
    156  * @param[in] address   The local requesting protocol address.
    157  * @param[out] translation The translation of the local protocol address.
    158  * @param[out] data     The allocated raw translation data container.
    159  * @return              EOK on success.
    160  * @return              EINVAL if the address parameter is NULL.
    161  * @return              EBADMEM if the translation or the data parameters are
    162  *                      NULL.
    163  * @return              ENOENT if the mapping is not found.
    164  */
    165 int
    166 arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol,
    167     measured_string_t *address, measured_string_t **translation, uint8_t **data)
    168 {
    169         return generic_translate_req(arp_phone, NET_ARP_TRANSLATE, device_id,
     183        return generic_translate_req(sess, NET_ARP_TRANSLATE, device_id,
    170184            protocol, address, 1, translation, data);
    171185}
  • uspace/lib/net/il/il_remote.c

    r55091847 r6b82009  
    3939#include <generic.h>
    4040#include <packet_client.h>
    41 
    4241#include <ipc/services.h>
    4342#include <ipc/il.h>
    44 
    4543#include <net/device.h>
    4644#include <net/packet.h>
     
    4846/** Notify the internetwork layer modules about the device state change.
    4947 *
    50  * @param[in] il_phone  The internetwork layer module phone used for
    51  *                      (semi)remote calls.
    52  * @param[in] device_id The device identifier.
    53  * @param[in] state     The new device state.
    54  * @param[in] target    The target internetwork module service to be
     48 * @param[in] sess      Internetwork layer module session.
     49 * @param[in] device_id Device identifier.
     50 * @param[in] state     New device state.
     51 * @param[in] target    Target internetwork module service to be
    5552 *                      delivered to.
    5653 *
     
    5855 *
    5956 */
    60 int il_device_state_msg(int il_phone, device_id_t device_id,
     57int il_device_state_msg(async_sess_t *sess, device_id_t device_id,
    6158    device_state_t state, services_t target)
    6259{
    63         return generic_device_state_msg_remote(il_phone, NET_IL_DEVICE_STATE,
     60        return generic_device_state_msg_remote(sess, NET_IL_DEVICE_STATE,
    6461            device_id, state, target);
    6562}
     
    6764/** Notify the internetwork layer modules about the received packet/s.
    6865 *
    69  * @param[in] il_phone  The internetwork layer module phone used for
    70  *                      (semi)remote calls.
    71  * @param[in] device_id The device identifier.
    72  * @param[in] packet    The received packet or the received packet queue.
    73  * @param[in] target    The target internetwork module service to be
     66 * @param[in] sess      Internetwork layer module session.
     67 * @param[in] device_id Device identifier.
     68 * @param[in] packet    Received packet or the received packet queue.
     69 * @param[in] target    Target internetwork module service to be
    7470 *                      delivered to.
    7571 *
     
    7773 *
    7874 */
    79 int il_received_msg(int il_phone, device_id_t device_id, packet_t *packet,
     75int il_received_msg(async_sess_t *sess, device_id_t device_id, packet_t *packet,
    8076    services_t target)
    8177{
    82         return generic_received_msg_remote(il_phone, NET_IL_RECEIVED, device_id,
     78        return generic_received_msg_remote(sess, NET_IL_RECEIVED, device_id,
    8379            packet_get_id(packet), target, 0);
    8480}
     
    8682/** Notify the internetwork layer modules about the mtu change.
    8783 *
    88  * @param[in] il_phone  The internetwork layer module phone used for
    89  *                      (semi)remote calls.
    90  * @param[in] device_id The device identifier.
    91  * @param[in] mtu       The new mtu value.
    92  * @param[in] target    The target internetwork module service to be
     84 * @param[in] sess      Internetwork layer module session.
     85 * @param[in] device_id Device identifier.
     86 * @param[in] mtu       New MTU value.
     87 * @param[in] target    Target internetwork module service to be
    9388 *                      delivered to.
    9489 *
     
    9691 *
    9792 */
    98 int il_mtu_changed_msg(int il_phone, device_id_t device_id, size_t mtu,
     93int il_mtu_changed_msg(async_sess_t *sess, device_id_t device_id, size_t mtu,
    9994    services_t target)
    10095{
    101         return generic_device_state_msg_remote(il_phone, NET_IL_MTU_CHANGED,
    102             device_id, (int) mtu, target);
     96        return generic_device_state_msg_remote(sess, NET_IL_MTU_CHANGED,
     97            device_id, mtu, target);
    10398}
    10499
  • uspace/lib/net/il/il_skel.c

    r55091847 r6b82009  
    3838#include <bool.h>
    3939#include <errno.h>
     40#include <ns.h>
    4041#include <il_skel.h>
    4142#include <net_interface.h>
    4243#include <net/modules.h>
    43 #include <async_obsolete.h>
    44 
    45 // FIXME: remove this header
    46 #include <kernel/ipc/ipc_methods.h>
    4744
    4845/** Default thread for new connections.
     
    10097 * @return Other error codes as defined for the il_initialize()
    10198 *         function.
    102  * @return Other error codes as defined for the REGISTER_ME() macro
    103  *         function.
    10499 *
    105100 */
    106 int il_module_start(int service)
     101int il_module_start(sysarg_t service)
    107102{
    108103        async_set_client_connection(il_client_connection);
    109         int net_phone = net_connect_module();
    110         if (net_phone < 0)
    111                 return net_phone;
     104        async_sess_t *sess = net_connect_module();
     105        if (!sess)
     106                return ENOENT;
    112107       
    113108        int rc = pm_init();
     
    115110                return rc;
    116111       
    117         rc = il_initialize(net_phone);
     112        rc = il_initialize(sess);
    118113        if (rc != EOK)
    119114                goto out;
    120115       
    121         rc = async_obsolete_connect_to_me(PHONE_NS, service, 0, 0, NULL, NULL);
     116        rc = service_register(service);
    122117        if (rc != EOK)
    123118                goto out;
  • uspace/lib/net/il/ip_remote.c

    r55091847 r6b82009  
    4444#include <packet_client.h>
    4545#include <generic.h>
    46 #include <async_obsolete.h>
    4746#include <ipc/services.h>
    4847#include <ipc/il.h>
    4948#include <ipc/ip.h>
    50 
    5149#include <net/modules.h>
    5250#include <net/device.h>
     
    5755 * The target network is routed using this device.
    5856 *
    59  * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
    60  * @param[in] device_id The device identifier.
    61  * @param[in] address   The target network address.
    62  * @param[in] netmask   The target network mask.
    63  * @param[in] gateway   The target network gateway. Not used if zero.
    64  */
    65 int ip_add_route_req_remote(int ip_phone, device_id_t device_id,
     57 * @param[in] sess      IP module sessions.
     58 * @param[in] device_id Device identifier.
     59 * @param[in] address   Target network address.
     60 * @param[in] netmask   Target network mask.
     61 * @param[in] gateway   Target network gateway. Not used if zero.
     62 *
     63 */
     64int ip_add_route_req_remote(async_sess_t *sess, device_id_t device_id,
    6665    in_addr_t address, in_addr_t netmask, in_addr_t gateway)
    6766{
    68         return (int) async_obsolete_req_4_0(ip_phone, NET_IP_ADD_ROUTE,
     67        async_exch_t *exch = async_exchange_begin(sess);
     68        int rc = async_req_4_0(exch, NET_IP_ADD_ROUTE,
    6969            (sysarg_t) device_id, (sysarg_t) gateway.s_addr,
    7070            (sysarg_t) address.s_addr, (sysarg_t) netmask.s_addr);
    71 }
    72 
    73 /** Creates bidirectional connection with the ip module service and registers
     71        async_exchange_end(exch);
     72       
     73        return rc;
     74}
     75
     76/** Create bidirectional connection with the ip module service and register
    7477 * the message receiver.
    7578 *
    76  * @param[in] service   The IP module service.
    77  * @param[in] protocol  The transport layer protocol.
    78  * @param[in] me        The requesting module service.
    79  * @param[in] receiver  The message receiver. Used for remote connection.
    80  * @return              The phone of the needed service.
    81  * @return              EOK on success.
    82  * @return              Other error codes as defined for the bind_service()
    83  *                      function.
    84  */
    85 int ip_bind_service(services_t service, int protocol, services_t me,
     79 * @param[in] service  IP module service.
     80 * @param[in] protocol Transport layer protocol.
     81 * @param[in] me       Rquesting module service.
     82 * @param[in] receiver Message receiver. Used for remote connection.
     83 *
     84 * @return Session to the needed service.
     85 * @return NULL on failure.
     86 *
     87 */
     88async_sess_t *ip_bind_service(services_t service, int protocol, services_t me,
    8689    async_client_conn_t receiver)
    8790{
    88         return (int) bind_service(service, (sysarg_t) protocol, me, service,
     91        return bind_service(service, (sysarg_t) protocol, me, service,
    8992            receiver);
    9093}
    9194
    92 /** Connects to the IP module.
    93  *
    94  * @param service       The IP module service. Ignored parameter.
    95  * @return              The IP module phone on success.
    96  */
    97 int ip_connect_module(services_t service)
    98 {
     95/** Connect to the IP module.
     96 *
     97 * @return The IP module session.
     98 *
     99 */
     100async_sess_t *ip_connect_module(services_t service)
     101{
     102        // FIXME: Get rid of the useless argument
    99103        return connect_to_service(SERVICE_IP);
    100104}
     
    105109 * If the device uses ARP registers also the new ARP device.
    106110 *
    107  * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
    108  * @param[in] device_id The new device identifier.
    109  * @param[in] netif     The underlying device network interface layer service.
    110  * @return              EOK on success.
    111  * @return              ENOMEM if there is not enough memory left.
    112  * @return              EINVAL if the device configuration is invalid.
    113  * @return              ENOTSUP if the device uses IPv6.
    114  * @return              ENOTSUP if the device uses DHCP.
    115  * @return              Other error codes as defined for the
    116  *                      net_get_device_conf_req() function.
    117  * @return              Other error codes as defined for the arp_device_req()
    118  *                      function.
    119  */
    120 int ip_device_req_remote(int ip_phone, device_id_t device_id,
    121     services_t service)
    122 {
    123         return generic_device_req_remote(ip_phone, NET_IP_DEVICE, device_id, 0,
    124             service);
     111 * @param[in] sess      IP module session.
     112 * @param[in] device_id New device identifier.
     113 *
     114 * @return EOK on success.
     115 * @return ENOMEM if there is not enough memory left.
     116 * @return EINVAL if the device configuration is invalid.
     117 * @return ENOTSUP if the device uses IPv6.
     118 * @return ENOTSUP if the device uses DHCP.
     119 * @return Other error codes as defined for the
     120 *         net_get_device_conf_req() function.
     121 * @return Other error codes as defined for the arp_device_req()
     122 *         function.
     123 *
     124 */
     125int ip_device_req_remote(async_sess_t *sess, device_id_t device_id)
     126{
     127        return generic_device_req_remote(sess, NET_IP_DEVICE, device_id, 0, 0);
    125128}
    126129
     
    128131 * destination address.
    129132 *
    130  * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
    131  * @param[in] protocol  The transport protocol.
    132  * @param[in] destination The destination address.
    133  * @param[in] addrlen   The destination address length.
    134  * @param[out] device_id The device identifier.
    135  * @param[out] header   The constructed IP pseudo header.
    136  * @param[out] headerlen The IP pseudo header length.
    137  *
    138  */
    139 int ip_get_route_req_remote(int ip_phone, ip_protocol_t protocol,
     133 * @param[in] sess        IP module session.
     134 * @param[in] protocol    Transport protocol.
     135 * @param[in] destination Destination address.
     136 * @param[in] addrlen     Destination address length.
     137 * @param[out] device_id  Device identifier.
     138 * @param[out] header     Constructed IP pseudo header.
     139 * @param[out] headerlen IP pseudo header length.
     140 *
     141 */
     142int ip_get_route_req_remote(async_sess_t *sess, ip_protocol_t protocol,
    140143    const struct sockaddr *destination, socklen_t addrlen,
    141144    device_id_t *device_id, void **header, size_t *headerlen)
    142145{
    143         if (!destination || (addrlen == 0))
     146        if ((!destination) || (addrlen == 0))
    144147                return EINVAL;
    145148       
    146         if (!device_id || !header || !headerlen)
     149        if ((!device_id) || (!header) || (!headerlen))
    147150                return EBADMEM;
    148151       
    149152        *header = NULL;
    150153       
     154        async_exch_t *exch = async_exchange_begin(sess);
     155       
    151156        ipc_call_t answer;
    152         aid_t message_id = async_obsolete_send_1(ip_phone, NET_IP_GET_ROUTE,
     157        aid_t message_id = async_send_1(exch, NET_IP_GET_ROUTE,
    153158            (sysarg_t) protocol, &answer);
    154159       
    155         if ((async_obsolete_data_write_start(ip_phone, destination, addrlen) == EOK) &&
    156             (async_obsolete_data_read_start(ip_phone, headerlen,
    157             sizeof(*headerlen)) == EOK) && (*headerlen > 0)) {
     160        if ((async_data_write_start(exch, destination, addrlen) == EOK) &&
     161            (async_data_read_start(exch, headerlen, sizeof(*headerlen)) == EOK) &&
     162            (*headerlen > 0)) {
    158163                *header = malloc(*headerlen);
    159164                if (*header) {
    160                         if (async_obsolete_data_read_start(ip_phone, *header,
     165                        if (async_data_read_start(exch, *header,
    161166                            *headerlen) != EOK)
    162167                                free(*header);
     
    164169        }
    165170       
     171        async_exchange_end(exch);
     172       
    166173        sysarg_t result;
    167174        async_wait_for(message_id, &result);
     
    177184/** Return the device packet dimension for sending.
    178185 *
    179  * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
    180  * @param[in] device_id The device identifier.
    181  * @param[out] packet_dimension The packet dimension.
    182  * @return              EOK on success.
    183  * @return              ENOENT if there is no such device.
    184  * @return              Other error codes as defined for the
    185  *                      generic_packet_size_req_remote() function.
    186  */
    187 int ip_packet_size_req_remote(int ip_phone, device_id_t device_id,
     186 * @param[in] sess              IP module session.
     187 * @param[in] device_id         Device identifier.
     188 * @param[out] packet_dimension Packet dimension.
     189 *
     190 * @return EOK on success.
     191 * @return ENOENT if there is no such device.
     192 * @return Other error codes as defined for the
     193 *         generic_packet_size_req_remote() function.
     194 *
     195 */
     196int ip_packet_size_req_remote(async_sess_t *sess, device_id_t device_id,
    188197    packet_dimension_t *packet_dimension)
    189198{
    190         return generic_packet_size_req_remote(ip_phone, NET_IP_PACKET_SPACE,
     199        return generic_packet_size_req_remote(sess, NET_IP_PACKET_SPACE,
    191200            device_id, packet_dimension);
    192201}
     
    194203/** Notify the IP module about the received error notification packet.
    195204 *
    196  * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
    197  * @param[in] device_id The device identifier.
    198  * @param[in] packet    The received packet or the received packet queue.
    199  * @param[in] target    The target internetwork module service to be
    200  *                      delivered to.
    201  * @param[in] error     The packet error reporting service. Prefixes the
    202  *                      received packet.
    203  * @return              EOK on success.
    204  */
    205 int ip_received_error_msg_remote(int ip_phone, device_id_t device_id,
     205 * @param[in] sess      IP module session.
     206 * @param[in] device_id Device identifier.
     207 * @param[in] packet    Received packet or the received packet queue.
     208 * @param[in] target    Target internetwork module service to be
     209 *                      delivered to.
     210 * @param[in] error     Packet error reporting service. Prefixes the
     211 *                      received packet.
     212 *
     213 * @return EOK on success.
     214 *
     215 */
     216int ip_received_error_msg_remote(async_sess_t *sess, device_id_t device_id,
    206217    packet_t *packet, services_t target, services_t error)
    207218{
    208         return generic_received_msg_remote(ip_phone, NET_IP_RECEIVED_ERROR,
     219        return generic_received_msg_remote(sess, NET_IP_RECEIVED_ERROR,
    209220            device_id, packet_get_id(packet), target, error);
    210221}
     
    214225 * The packets may get fragmented if needed.
    215226 *
    216  * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
    217  * @param[in] device_id The device identifier.
    218  * @param[in] packet    The packet fragments as a packet queue. All the
    219  *                      packets have to have the same destination address.
    220  * @param[in] sender    The sending module service.
    221  * @param[in] error     The packet error reporting service. Prefixes the
    222  *                      received packet.
    223  * @return              EOK on success.
    224  * @return              Other error codes as defined for the generic_send_msg()
    225  *                      function.
    226  */
    227 int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t *packet,
    228     services_t sender, services_t error)
    229 {
    230         return generic_send_msg_remote(ip_phone, NET_IP_SEND, device_id,
     227 * @param[in] sess      IP module session.
     228 * @param[in] device_id Device identifier.
     229 * @param[in] packet    Packet fragments as a packet queue. All the
     230 *                      packets have to have the same destination address.
     231 * @param[in] sender    Sending module service.
     232 * @param[in] error     Packet error reporting service. Prefixes the
     233 *                      received packet.
     234 *
     235 * @return EOK on success.
     236 * @return Other error codes as defined for the generic_send_msg()
     237 *         function.
     238 *
     239 */
     240int ip_send_msg_remote(async_sess_t *sess, device_id_t device_id,
     241    packet_t *packet, services_t sender, services_t error)
     242{
     243        return generic_send_msg_remote(sess, NET_IP_SEND, device_id,
    231244            packet_get_id(packet), sender, error);
    232245}
     
    236249 * This gateway is used if no other route is found.
    237250 *
    238  * @param[in] ip_phone  The IP module phone used for (semi)remote calls.
    239  * @param[in] device_id The device identifier.
    240  * @param[in] gateway   The default gateway.
    241  */
    242 int ip_set_gateway_req_remote(int ip_phone, device_id_t device_id,
     251 * @param[in] sess      IP module session.
     252 * @param[in] device_id Device identifier.
     253 * @param[in] gateway   Default gateway.
     254 *
     255 */
     256int ip_set_gateway_req_remote(async_sess_t *sess, device_id_t device_id,
    243257    in_addr_t gateway)
    244258{
    245         return (int) async_obsolete_req_2_0(ip_phone, NET_IP_SET_GATEWAY,
     259        async_exch_t *exch = async_exchange_begin(sess);
     260        int rc = async_req_2_0(exch, NET_IP_SET_GATEWAY,
    246261            (sysarg_t) device_id, (sysarg_t) gateway.s_addr);
     262        async_exchange_end(exch);
     263       
     264        return rc;
    247265}
    248266
Note: See TracChangeset for help on using the changeset viewer.