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