Changes in uspace/lib/c/generic/iplink.c [f9b2cb4c:a17356fd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/iplink.c
rf9b2cb4c ra17356fd 47 47 static void iplink_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg); 48 48 49 int iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, void *arg,49 int iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, 50 50 iplink_t **riplink) 51 51 { … … 56 56 iplink->sess = sess; 57 57 iplink->ev_ops = ev_ops; 58 iplink->arg = arg;59 58 60 59 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); 66 62 async_exchange_end(exch); 67 63 … … 175 171 } 176 172 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 200 173 int iplink_addr_add(iplink_t *iplink, inet_addr_t *addr) 201 174 { … … 238 211 239 212 return (int) retval; 240 }241 242 void *iplink_get_userptr(iplink_t *iplink)243 {244 return iplink->arg;245 213 } 246 214 … … 250 218 iplink_recv_sdu_t sdu; 251 219 252 ip_ver_t ver= IPC_GET_ARG1(*icall);220 uint16_t af = IPC_GET_ARG1(*icall); 253 221 254 222 int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, … … 259 227 } 260 228 261 rc = iplink->ev_ops->recv(iplink, &sdu, ver);229 rc = iplink->ev_ops->recv(iplink, &sdu, af); 262 230 free(sdu.data); 263 231 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);282 232 } 283 233 … … 299 249 iplink_ev_recv(iplink, callid, &call); 300 250 break; 301 case IPLINK_EV_CHANGE_ADDR:302 iplink_ev_change_addr(iplink, callid, &call);303 251 default: 304 252 async_answer_0(callid, ENOTSUP);
Note:
See TracChangeset
for help on using the changeset viewer.