Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/iplink.c

    rf9b2cb4c ra17356fd  
    4747static void iplink_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    4848
    49 int iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, void *arg,
     49int iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops,
    5050    iplink_t **riplink)
    5151{
     
    5656        iplink->sess = sess;
    5757        iplink->ev_ops = ev_ops;
    58         iplink->arg = arg;
    5958       
    6059        async_exch_t *exch = async_exchange_begin(sess);
    61 
    62         port_id_t port;
    63         int rc = async_create_callback_port(exch, INTERFACE_IPLINK_CB, 0, 0,
    64             iplink_cb_conn, iplink, &port);
    65        
     60       
     61        int rc = async_connect_to_me(exch, 0, 0, 0, iplink_cb_conn, iplink);
    6662        async_exchange_end(exch);
    6763       
     
    175171}
    176172
    177 int iplink_set_mac48(iplink_t *iplink, addr48_t mac)
    178 {
    179         async_exch_t *exch = async_exchange_begin(iplink->sess);
    180        
    181         ipc_call_t answer;
    182         aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
    183        
    184         int rc = async_data_read_start(exch, mac, sizeof(addr48_t));
    185        
    186         loc_exchange_end(exch);
    187        
    188         if (rc != EOK) {
    189                 async_forget(req);
    190                 return rc;
    191         }
    192        
    193         sysarg_t retval;
    194         async_wait_for(req, &retval);
    195        
    196         return (int) retval;
    197 }
    198 
    199 
    200173int iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
    201174{
     
    238211       
    239212        return (int) retval;
    240 }
    241 
    242 void *iplink_get_userptr(iplink_t *iplink)
    243 {
    244         return iplink->arg;
    245213}
    246214
     
    250218        iplink_recv_sdu_t sdu;
    251219       
    252         ip_ver_t ver = IPC_GET_ARG1(*icall);
     220        uint16_t af = IPC_GET_ARG1(*icall);
    253221       
    254222        int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
     
    259227        }
    260228       
    261         rc = iplink->ev_ops->recv(iplink, &sdu, ver);
     229        rc = iplink->ev_ops->recv(iplink, &sdu, af);
    262230        free(sdu.data);
    263231        async_answer_0(iid, rc);
    264 }
    265 
    266 static void iplink_ev_change_addr(iplink_t *iplink, ipc_callid_t iid,
    267     ipc_call_t *icall)
    268 {
    269         addr48_t *addr;
    270         size_t size;
    271        
    272         int rc = async_data_write_accept((void **)&addr, false,
    273             sizeof(addr48_t), sizeof(addr48_t), 0, &size);
    274         if (rc != EOK) {
    275                 async_answer_0(iid, rc);
    276                 return;
    277         }
    278 
    279         rc = iplink->ev_ops->change_addr(iplink, *addr);
    280         free(addr);
    281         async_answer_0(iid, EOK);
    282232}
    283233
     
    299249                        iplink_ev_recv(iplink, callid, &call);
    300250                        break;
    301                 case IPLINK_EV_CHANGE_ADDR:
    302                         iplink_ev_change_addr(iplink, callid, &call);
    303251                default:
    304252                        async_answer_0(callid, ENOTSUP);
Note: See TracChangeset for help on using the changeset viewer.