Changeset a46e56b in mainline for uspace/lib/c/generic/inet.c
- Timestamp:
- 2018-03-22T06:49:35Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77f0a1d
- Parents:
- 3e242d2
- git-author:
- Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
- git-committer:
- Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/inet.c
r3e242d2 ra46e56b 36 36 #include <stdlib.h> 37 37 38 static void inet_cb_conn(cap_call_handle_t i id, ipc_call_t *icall, void *arg);38 static void inet_cb_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg); 39 39 40 40 static async_sess_t *inet_sess = NULL; … … 176 176 } 177 177 178 static void inet_ev_recv(cap_call_handle_t i id, ipc_call_t *icall)178 static void inet_ev_recv(cap_call_handle_t icall_handle, ipc_call_t *icall) 179 179 { 180 180 inet_dgram_t dgram; … … 183 183 dgram.iplink = IPC_GET_ARG2(*icall); 184 184 185 cap_call_handle_t c allid;185 cap_call_handle_t chandle; 186 186 size_t size; 187 if (!async_data_write_receive(&c allid, &size)) {188 async_answer_0(c allid, EINVAL);189 async_answer_0(i id, EINVAL);187 if (!async_data_write_receive(&chandle, &size)) { 188 async_answer_0(chandle, EINVAL); 189 async_answer_0(icall_handle, EINVAL); 190 190 return; 191 191 } 192 192 193 193 if (size != sizeof(inet_addr_t)) { 194 async_answer_0(c allid, EINVAL);195 async_answer_0(i id, EINVAL);196 return; 197 } 198 199 errno_t rc = async_data_write_finalize(c allid, &dgram.src, size);200 if (rc != EOK) { 201 async_answer_0(c allid, rc);202 async_answer_0(i id, rc);203 return; 204 } 205 206 if (!async_data_write_receive(&c allid, &size)) {207 async_answer_0(c allid, EINVAL);208 async_answer_0(i id, EINVAL);194 async_answer_0(chandle, EINVAL); 195 async_answer_0(icall_handle, EINVAL); 196 return; 197 } 198 199 errno_t rc = async_data_write_finalize(chandle, &dgram.src, size); 200 if (rc != EOK) { 201 async_answer_0(chandle, rc); 202 async_answer_0(icall_handle, rc); 203 return; 204 } 205 206 if (!async_data_write_receive(&chandle, &size)) { 207 async_answer_0(chandle, EINVAL); 208 async_answer_0(icall_handle, EINVAL); 209 209 return; 210 210 } 211 211 212 212 if (size != sizeof(inet_addr_t)) { 213 async_answer_0(c allid, EINVAL);214 async_answer_0(i id, EINVAL);215 return; 216 } 217 218 rc = async_data_write_finalize(c allid, &dgram.dest, size);219 if (rc != EOK) { 220 async_answer_0(c allid, rc);221 async_answer_0(i id, rc);213 async_answer_0(chandle, EINVAL); 214 async_answer_0(icall_handle, EINVAL); 215 return; 216 } 217 218 rc = async_data_write_finalize(chandle, &dgram.dest, size); 219 if (rc != EOK) { 220 async_answer_0(chandle, rc); 221 async_answer_0(icall_handle, rc); 222 222 return; 223 223 } … … 225 225 rc = async_data_write_accept(&dgram.data, false, 0, 0, 0, &dgram.size); 226 226 if (rc != EOK) { 227 async_answer_0(i id, rc);227 async_answer_0(icall_handle, rc); 228 228 return; 229 229 } … … 231 231 rc = inet_ev_ops->recv(&dgram); 232 232 free(dgram.data); 233 async_answer_0(i id, rc);234 } 235 236 static void inet_cb_conn(cap_call_handle_t i id, ipc_call_t *icall, void *arg)233 async_answer_0(icall_handle, rc); 234 } 235 236 static void inet_cb_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 237 237 { 238 238 while (true) { 239 239 ipc_call_t call; 240 cap_call_handle_t c allid= async_get_call(&call);240 cap_call_handle_t chandle = async_get_call(&call); 241 241 242 242 if (!IPC_GET_IMETHOD(call)) { … … 247 247 switch (IPC_GET_IMETHOD(call)) { 248 248 case INET_EV_RECV: 249 inet_ev_recv(c allid, &call);249 inet_ev_recv(chandle, &call); 250 250 break; 251 251 default: 252 async_answer_0(c allid, ENOTSUP);252 async_answer_0(chandle, ENOTSUP); 253 253 } 254 254 }
Note:
See TracChangeset
for help on using the changeset viewer.