Changeset b86a32e in mainline for uspace/lib/c/generic/iplink_srv.c
- Timestamp:
- 2013-07-15T12:14:55Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c84146d3
- Parents:
- 87159eb8 (diff), 956d4281 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/iplink_srv.c
r87159eb8 rb86a32e 50 50 } 51 51 52 static void iplink_get_mac48_srv(iplink_srv_t *srv, ipc_callid_t iid, 53 ipc_call_t *icall) 54 { 55 addr48_t mac; 56 int rc = srv->ops->get_mac48(srv, &mac); 57 if (rc != EOK) { 58 async_answer_0(iid, rc); 59 return; 60 } 61 62 ipc_callid_t callid; 63 size_t size; 64 if (!async_data_read_receive(&callid, &size)) { 65 async_answer_0(callid, EREFUSED); 66 async_answer_0(iid, EREFUSED); 67 return; 68 } 69 70 if (size != sizeof(addr48_t)) { 71 async_answer_0(callid, EINVAL); 72 async_answer_0(iid, EINVAL); 73 return; 74 } 75 76 rc = async_data_read_finalize(callid, &mac, size); 77 if (rc != EOK) 78 async_answer_0(callid, rc); 79 80 async_answer_0(iid, (sysarg_t) rc); 81 } 82 52 83 static void iplink_addr_add_srv(iplink_srv_t *srv, ipc_callid_t iid, 53 84 ipc_call_t *icall) … … 111 142 iplink_sdu_t sdu; 112 143 144 sdu.src = IPC_GET_ARG1(*icall); 145 sdu.dest = IPC_GET_ARG2(*icall); 146 147 int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, 148 &sdu.size); 149 if (rc != EOK) { 150 async_answer_0(iid, rc); 151 return; 152 } 153 154 rc = srv->ops->send(srv, &sdu); 155 free(sdu.data); 156 async_answer_0(iid, rc); 157 } 158 159 static void iplink_send6_srv(iplink_srv_t *srv, ipc_callid_t iid, 160 ipc_call_t *icall) 161 { 162 iplink_sdu6_t sdu; 163 113 164 ipc_callid_t callid; 114 165 size_t size; … … 119 170 } 120 171 121 if (size != sizeof( inet_addr_t)) {172 if (size != sizeof(addr48_t)) { 122 173 async_answer_0(callid, EINVAL); 123 174 async_answer_0(iid, EINVAL); … … 125 176 } 126 177 127 int rc = async_data_write_finalize(callid, &sdu. src, size);178 int rc = async_data_write_finalize(callid, &sdu.dest, size); 128 179 if (rc != EOK) { 129 180 async_answer_0(callid, (sysarg_t) rc); … … 131 182 } 132 183 133 if (!async_data_write_receive(&callid, &size)) {134 async_answer_0(callid, EREFUSED);135 async_answer_0(iid, EREFUSED);136 return;137 }138 139 if (size != sizeof(inet_addr_t)) {140 async_answer_0(callid, EINVAL);141 async_answer_0(iid, EINVAL);142 return;143 }144 145 rc = async_data_write_finalize(callid, &sdu.dest, size);146 if (rc != EOK) {147 async_answer_0(callid, (sysarg_t) rc);148 async_answer_0(iid, (sysarg_t) rc);149 }150 151 184 rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, 152 185 &sdu.size); 153 if (rc != EOK) 154 return; 155 156 rc = srv->ops->send(srv, &sdu); 186 if (rc != EOK) { 187 async_answer_0(iid, rc); 188 return; 189 } 190 191 rc = srv->ops->send6(srv, &sdu); 157 192 free(sdu.data); 158 193 async_answer_0(iid, rc); … … 170 205 int iplink_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 171 206 { 172 iplink_srv_t *srv = (iplink_srv_t *) arg;207 iplink_srv_t *srv = (iplink_srv_t *) arg; 173 208 int rc; 174 209 … … 214 249 iplink_get_mtu_srv(srv, callid, &call); 215 250 break; 251 case IPLINK_GET_MAC48: 252 iplink_get_mac48_srv(srv, callid, &call); 253 break; 216 254 case IPLINK_SEND: 217 255 iplink_send_srv(srv, callid, &call); 256 break; 257 case IPLINK_SEND6: 258 iplink_send6_srv(srv, callid, &call); 218 259 break; 219 260 case IPLINK_ADDR_ADD:
Note:
See TracChangeset
for help on using the changeset viewer.