Changeset bc38578 in mainline


Ignore:
Timestamp:
2012-02-06T16:12:58Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ceba4bed
Parents:
06295a9
Message:

Identify incoming IP link connections.

Location:
uspace/srv/ethip
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/ethip/ethip.c

    r06295a9 rbc38578  
    106106        }
    107107
     108        nic->iplink_sid = sid;
     109
    108110        rc = loc_category_get_id("iplink", &iplink_cat, IPC_FLAG_BLOCKING);
    109111        if (rc != EOK) {
     
    128130static void ethip_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    129131{
    130         log_msg(LVL_DEBUG, "ethip_client_conn(%u)", (unsigned) IPC_GET_ARG1(*icall));
    131         if (0) iplink_conn(iid, icall, NULL);
     132        ethip_nic_t *nic;
     133        service_id_t sid;
     134
     135        sid = (service_id_t)IPC_GET_ARG1(*icall);
     136        log_msg(LVL_DEBUG, "ethip_client_conn(%u)", (unsigned)sid);
     137        nic = ethip_nic_find_by_iplink_sid(sid);
     138        if (nic == NULL) {
     139                log_msg(LVL_WARN, "Uknown service ID.");
     140                return;
     141        }
     142
     143        iplink_conn(iid, icall, &nic->iplink);
    132144}
    133145
  • uspace/srv/ethip/ethip.h

    r06295a9 rbc38578  
    4545
    4646        iplink_srv_t iplink;
     47        service_id_t iplink_sid;
    4748} ethip_nic_t;
    4849
  • uspace/srv/ethip/ethip_nic.c

    r06295a9 rbc38578  
    3535 */
    3636
     37#include <adt/list.h>
    3738#include <async.h>
    3839#include <bool.h>
     
    256257}
    257258
     259ethip_nic_t *ethip_nic_find_by_iplink_sid(service_id_t iplink_sid)
     260{
     261        log_msg(LVL_DEBUG, "ethip_nic_find_by_iplink_sid(%u)",
     262            (unsigned) iplink_sid);
     263
     264        list_foreach(ethip_nic_list, link) {
     265                log_msg(LVL_DEBUG, "ethip_nic_find_by_iplink_sid - element");
     266                ethip_nic_t *nic = list_get_instance(link, ethip_nic_t,
     267                    nic_list);
     268
     269                if (nic->iplink_sid == iplink_sid) {
     270                        log_msg(LVL_DEBUG, "ethip_nic_find_by_iplink_sid - found %p", nic);
     271                        return nic;
     272                }
     273        }
     274
     275        log_msg(LVL_DEBUG, "ethip_nic_find_by_iplink_sid - not found");
     276        return NULL;
     277}
     278
    258279/** @}
    259280 */
  • uspace/srv/ethip/ethip_nic.h

    r06295a9 rbc38578  
    3838#define ETHIP_NIC_H_
    3939
     40#include <ipc/loc.h>
     41
    4042extern int ethip_nic_discovery_start(void);
     43extern ethip_nic_t *ethip_nic_find_by_iplink_sid(service_id_t);
    4144
    4245#endif
Note: See TracChangeset for help on using the changeset viewer.