Changeset b10460a in mainline for uspace/srv/net/udp/service.c
- Timestamp:
- 2015-08-07T21:39:00Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b688fd8
- Parents:
- 6accc5cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/udp/service.c
r6accc5cf rb10460a 52 52 #define NAME "udp" 53 53 54 /** Maximum message size */ 54 55 #define MAX_MSG_SIZE DATA_XFER_LIMIT 55 56 56 57 static void udp_cassoc_recv_msg(void *, inet_ep2_t *, udp_msg_t *); 57 58 59 /** Callbacks to tie us to association layer */ 58 60 static udp_assoc_cb_t udp_cassoc_cb = { 59 61 .recv_msg = udp_cassoc_recv_msg 60 62 }; 61 63 64 /** Add message to client receive queue. 65 * 66 * @param cassoc Client association 67 * @param epp Endpoint pair on which message was received 68 * @param msg Message 69 * 70 * @return EOK on success, ENOMEM if out of memory 71 */ 62 72 static int udp_cassoc_queue_msg(udp_cassoc_t *cassoc, inet_ep2_t *epp, 63 73 udp_msg_t *msg) … … 86 96 } 87 97 98 /** Send 'data' event to client. 99 * 100 * @param client Client 101 */ 88 102 static void udp_ev_data(udp_client_t *client) 89 103 { … … 99 113 } 100 114 115 /** Create client association. 116 * 117 * This effectively adds an association into a client's namespace. 118 * 119 * @param client Client 120 * @param assoc Association 121 * @param rcassoc Place to store pointer to new client association 122 * 123 * @return EOK on soccess, ENOMEM if out of memory 124 */ 101 125 static int udp_cassoc_create(udp_client_t *client, udp_assoc_t *assoc, 102 126 udp_cassoc_t **rcassoc) … … 125 149 } 126 150 151 /** Destroy client association. 152 * 153 * @param cassoc Client association 154 */ 127 155 static void udp_cassoc_destroy(udp_cassoc_t *cassoc) 128 156 { … … 131 159 } 132 160 161 /** Get client association by ID. 162 * 163 * @param client Client 164 * @param id Client association ID 165 * @param rcassoc Place to store pointer to client association 166 * 167 * @return EOK on success, ENOENT if no client association with the given ID 168 * is found. 169 */ 133 170 static int udp_cassoc_get(udp_client_t *client, sysarg_t id, 134 171 udp_cassoc_t **rcassoc) … … 144 181 } 145 182 183 /** Message received on client association. 184 * 185 * Used as udp_assoc_cb.recv_msg callback. 186 * 187 * @param arg Callback argument, client association 188 * @param epp Endpoint pair where message was received 189 * @param msg Message 190 */ 146 191 static void udp_cassoc_recv_msg(void *arg, inet_ep2_t *epp, udp_msg_t *msg) 147 192 { … … 152 197 } 153 198 199 /** Create association. 200 * 201 * Handle client request to create association (with parameters unmarshalled). 202 * 203 * @param client UDP client 204 * @param epp Endpoint pair 205 * @param rassoc_id Place to store ID of new association 206 * 207 * @return EOK on success or negative error code 208 */ 154 209 static int udp_assoc_create_impl(udp_client_t *client, inet_ep2_t *epp, 155 210 sysarg_t *rassoc_id) … … 189 244 } 190 245 246 /** Destroy association. 247 * 248 * Handle client request to destroy association (with parameters unmarshalled). 249 * 250 * @param client UDP client 251 * @param assoc_id Association ID 252 * @return EOK on success, ENOENT if no such association is found 253 */ 191 254 static int udp_assoc_destroy_impl(udp_client_t *client, sysarg_t assoc_id) 192 255 { … … 207 270 } 208 271 272 /** Send message via association. 273 * 274 * Handle client request to send message (with parameters unmarshalled). 275 * 276 * @param client UDP client 277 * @param assoc_id Association ID 278 * @param dest Destination endpoint or @c NULL to use the default from 279 * association 280 * @param data Message data 281 * @param size Message size 282 * 283 * @return EOK on success or negative error code 284 */ 209 285 static int udp_assoc_send_msg_impl(udp_client_t *client, sysarg_t assoc_id, 210 286 inet_ep_t *dest, void *data, size_t size) … … 227 303 } 228 304 305 /** Create callback session. 306 * 307 * Handle client request to create callback session. 308 * 309 * @param client UDP client 310 * @param iid Async request ID 311 * @param icall Async request data 312 */ 229 313 static void udp_callback_create_srv(udp_client_t *client, ipc_callid_t iid, 230 314 ipc_call_t *icall) … … 242 326 } 243 327 328 /** Create association. 329 * 330 * Handle client request to create association. 331 * 332 * @param client UDP client 333 * @param iid Async request ID 334 * @param icall Async request data 335 */ 244 336 static void udp_assoc_create_srv(udp_client_t *client, ipc_callid_t iid, 245 337 ipc_call_t *icall) … … 281 373 } 282 374 375 /** Destroy association. 376 * 377 * Handle client request to destroy association. 378 * 379 * @param client UDP client 380 * @param iid Async request ID 381 * @param icall Async request data 382 */ 283 383 static void udp_assoc_destroy_srv(udp_client_t *client, ipc_callid_t iid, 284 384 ipc_call_t *icall) … … 294 394 } 295 395 396 /** Send message via association. 397 * 398 * Handle client request to send message. 399 * 400 * @param client UDP client 401 * @param iid Async request ID 402 * @param icall Async request data 403 */ 296 404 static void udp_assoc_send_msg_srv(udp_client_t *client, ipc_callid_t iid, 297 405 ipc_call_t *icall) … … 368 476 } 369 477 478 /** Get next received message. 479 * 480 * @param client UDP Client 481 * @return Pointer to queue entry for next received message 482 */ 370 483 static udp_crcv_queue_entry_t *udp_rmsg_get_next(udp_client_t *client) 371 484 { … … 379 492 } 380 493 494 /** Get info on first received message. 495 * 496 * Handle client request to get information on received message. 497 * 498 * @param client UDP client 499 * @param iid Async request ID 500 * @param icall Async request data 501 */ 381 502 static void udp_rmsg_info_srv(udp_client_t *client, ipc_callid_t iid, 382 503 ipc_call_t *icall) … … 418 539 } 419 540 541 /** Read data from first received message. 542 * 543 * Handle client request to read data from first received message. 544 * 545 * @param client UDP client 546 * @param iid Async request ID 547 * @param icall Async request data 548 */ 420 549 static void udp_rmsg_read_srv(udp_client_t *client, ipc_callid_t iid, 421 550 ipc_call_t *icall) … … 460 589 } 461 590 591 /** Discard first received message. 592 * 593 * Handle client request to discard first received message, advancing 594 * to the next one. 595 * 596 * @param client UDP client 597 * @param iid Async request ID 598 * @param icall Async request data 599 */ 462 600 static void udp_rmsg_discard_srv(udp_client_t *client, ipc_callid_t iid, 463 601 ipc_call_t *icall) … … 480 618 } 481 619 620 /** Handle UDP client connection. 621 * 622 * @param iid Connect call ID 623 * @param icall Connect call data 624 * @param arg Connection argument 625 */ 482 626 static void udp_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 483 627 { … … 551 695 } 552 696 697 /** Initialize UDP service. 698 * 699 * @return EOK on success or negative error code. 700 */ 553 701 int udp_service_init(void) 554 702 {
Note:
See TracChangeset
for help on using the changeset viewer.