Changeset e4f8c77 in mainline for uspace/srv/net/tl/icmp/icmp.c


Ignore:
Timestamp:
2011-07-13T22:39:18Z (13 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e6910c8
Parents:
5974661 (diff), 8ecef91 (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.
Message:

Merge libposix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/icmp/icmp.c

    r5974661 re4f8c77  
    118118
    119119/** Global data */
    120 static int phone_net = -1;
    121 static int phone_ip = -1;
     120static async_sess_t *net_sess = NULL;
     121static async_sess_t *ip_sess = NULL;
    122122static bool error_reporting = true;
    123123static bool echo_replying = true;
     
    173173static void icmp_release(packet_t *packet)
    174174{
    175         pq_release_remote(phone_net, packet_get_id(packet));
     175        pq_release_remote(net_sess, packet_get_id(packet));
    176176}
    177177
     
    225225        }
    226226       
    227         return ip_send_msg(phone_ip, -1, packet, SERVICE_ICMP, error);
     227        return ip_send_msg(ip_sess, -1, packet, SERVICE_ICMP, error);
    228228}
    229229
     
    297297        size_t length = (size_t) addrlen;
    298298       
    299         packet_t *packet = packet_get_4_remote(phone_net, size,
     299        packet_t *packet = packet_get_4_remote(net_sess, size,
    300300            icmp_dimension.addr_len, ICMP_HEADER_SIZE + icmp_dimension.prefix,
    301301            icmp_dimension.suffix);
     
    595595        case ICMP_SKIP:
    596596        case ICMP_PHOTURIS:
    597                 ip_received_error_msg(phone_ip, -1, packet,
     597                ip_received_error_msg(ip_sess, -1, packet,
    598598                    SERVICE_IP, SERVICE_ICMP);
    599599                return EOK;
     
    608608 * @param[in]     iid   Message identifier.
    609609 * @param[in,out] icall Message parameters.
    610  *
    611  */
    612 static void icmp_receiver(ipc_callid_t iid, ipc_call_t *icall)
     610 * @param[in]     arg   Local argument.
     611 *
     612 */
     613static void icmp_receiver(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    613614{
    614615        packet_t *packet;
     
    621622                switch (IPC_GET_IMETHOD(*icall)) {
    622623                case NET_TL_RECEIVED:
    623                         rc = packet_translate_remote(phone_net, &packet,
     624                        rc = packet_translate_remote(net_sess, &packet,
    624625                            IPC_GET_PACKET(*icall));
    625626                        if (rc == EOK) {
     
    641642/** Initialize the ICMP module.
    642643 *
    643  * @param[in] net_phone Network module phone.
     644 * @param[in] sess Network module session.
    644645 *
    645646 * @return EOK on success.
     
    647648 *
    648649 */
    649 int tl_initialize(int net_phone)
     650int tl_initialize(async_sess_t *sess)
    650651{
    651652        measured_string_t names[] = {
     
    669670        atomic_set(&icmp_client, 0);
    670671       
    671         phone_net = net_phone;
    672         phone_ip = ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP,
     672        net_sess = sess;
     673        ip_sess = ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP,
    673674            icmp_receiver);
    674         if (phone_ip < 0)
    675                 return phone_ip;
    676        
    677         int rc = ip_packet_size_req(phone_ip, -1, &icmp_dimension);
     675        if (ip_sess == NULL)
     676                return ENOENT;
     677       
     678        int rc = ip_packet_size_req(ip_sess, -1, &icmp_dimension);
    678679        if (rc != EOK)
    679680                return rc;
     
    684685        /* Get configuration */
    685686        configuration = &names[0];
    686         rc = net_get_conf_req(phone_net, &configuration, count, &data);
     687        rc = net_get_conf_req(net_sess, &configuration, count, &data);
    687688        if (rc != EOK)
    688689                return rc;
     
    762763       
    763764        case NET_ICMP_DEST_UNREACH:
    764                 rc = packet_translate_remote(phone_net, &packet,
     765                rc = packet_translate_remote(net_sess, &packet,
    765766                    IPC_GET_PACKET(*call));
    766767                if (rc != EOK)
     
    771772       
    772773        case NET_ICMP_SOURCE_QUENCH:
    773                 rc = packet_translate_remote(phone_net, &packet,
     774                rc = packet_translate_remote(net_sess, &packet,
    774775                    IPC_GET_PACKET(*call));
    775776                if (rc != EOK)
     
    779780       
    780781        case NET_ICMP_TIME_EXCEEDED:
    781                 rc = packet_translate_remote(phone_net, &packet,
     782                rc = packet_translate_remote(net_sess, &packet,
    782783                    IPC_GET_PACKET(*call));
    783784                if (rc != EOK)
     
    787788       
    788789        case NET_ICMP_PARAMETERPROB:
    789                 rc = packet_translate_remote(phone_net, &packet,
     790                rc = packet_translate_remote(net_sess, &packet,
    790791                    IPC_GET_PACKET(*call));
    791792                if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.