Changes in uspace/srv/net/udp/service.c [1d03e86:1f2b07a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/udp/service.c
r1d03e86 r1f2b07a 52 52 #define NAME "udp" 53 53 54 /** Maximum message size */55 54 #define MAX_MSG_SIZE DATA_XFER_LIMIT 56 55 57 56 static void udp_cassoc_recv_msg(void *, inet_ep2_t *, udp_msg_t *); 58 57 59 /** Callbacks to tie us to association layer */60 58 static udp_assoc_cb_t udp_cassoc_cb = { 61 59 .recv_msg = udp_cassoc_recv_msg 62 60 }; 63 61 64 /** Add message to client receive queue.65 *66 * @param cassoc Client association67 * @param epp Endpoint pair on which message was received68 * @param msg Message69 *70 * @return EOK on success, ENOMEM if out of memory71 */72 62 static int udp_cassoc_queue_msg(udp_cassoc_t *cassoc, inet_ep2_t *epp, 73 63 udp_msg_t *msg) … … 96 86 } 97 87 98 /** Send 'data' event to client.99 *100 * @param client Client101 */102 88 static void udp_ev_data(udp_client_t *client) 103 89 { … … 113 99 } 114 100 115 /** Create client association.116 *117 * This effectively adds an association into a client's namespace.118 *119 * @param client Client120 * @param assoc Association121 * @param rcassoc Place to store pointer to new client association122 *123 * @return EOK on soccess, ENOMEM if out of memory124 */125 101 static int udp_cassoc_create(udp_client_t *client, udp_assoc_t *assoc, 126 102 udp_cassoc_t **rcassoc) … … 149 125 } 150 126 151 /** Destroy client association.152 *153 * @param cassoc Client association154 */155 127 static void udp_cassoc_destroy(udp_cassoc_t *cassoc) 156 128 { … … 159 131 } 160 132 161 /** Get client association by ID.162 *163 * @param client Client164 * @param id Client association ID165 * @param rcassoc Place to store pointer to client association166 *167 * @return EOK on success, ENOENT if no client association with the given ID168 * is found.169 */170 133 static int udp_cassoc_get(udp_client_t *client, sysarg_t id, 171 134 udp_cassoc_t **rcassoc) … … 181 144 } 182 145 183 /** Message received on client association.184 *185 * Used as udp_assoc_cb.recv_msg callback.186 *187 * @param arg Callback argument, client association188 * @param epp Endpoint pair where message was received189 * @param msg Message190 */191 146 static void udp_cassoc_recv_msg(void *arg, inet_ep2_t *epp, udp_msg_t *msg) 192 147 { … … 197 152 } 198 153 199 /** Create association.200 *201 * Handle client request to create association (with parameters unmarshalled).202 *203 * @param client UDP client204 * @param epp Endpoint pair205 * @param rassoc_id Place to store ID of new association206 *207 * @return EOK on success or negative error code208 */209 154 static int udp_assoc_create_impl(udp_client_t *client, inet_ep2_t *epp, 210 155 sysarg_t *rassoc_id) … … 244 189 } 245 190 246 /** Destroy association.247 *248 * Handle client request to destroy association (with parameters unmarshalled).249 *250 * @param client UDP client251 * @param assoc_id Association ID252 * @return EOK on success, ENOENT if no such association is found253 */254 191 static int udp_assoc_destroy_impl(udp_client_t *client, sysarg_t assoc_id) 255 192 { … … 270 207 } 271 208 272 /** Send message via association.273 *274 * Handle client request to send message (with parameters unmarshalled).275 *276 * @param client UDP client277 * @param assoc_id Association ID278 * @param dest Destination endpoint or @c NULL to use the default from279 * association280 * @param data Message data281 * @param size Message size282 *283 * @return EOK on success or negative error code284 */285 209 static int udp_assoc_send_msg_impl(udp_client_t *client, sysarg_t assoc_id, 286 210 inet_ep_t *dest, void *data, size_t size) … … 303 227 } 304 228 305 /** Create callback session.306 *307 * Handle client request to create callback session.308 *309 * @param client UDP client310 * @param iid Async request ID311 * @param icall Async request data312 */313 229 static void udp_callback_create_srv(udp_client_t *client, ipc_callid_t iid, 314 230 ipc_call_t *icall) … … 326 242 } 327 243 328 /** Create association.329 *330 * Handle client request to create association.331 *332 * @param client UDP client333 * @param iid Async request ID334 * @param icall Async request data335 */336 244 static void udp_assoc_create_srv(udp_client_t *client, ipc_callid_t iid, 337 245 ipc_call_t *icall) … … 373 281 } 374 282 375 /** Destroy association.376 *377 * Handle client request to destroy association.378 *379 * @param client UDP client380 * @param iid Async request ID381 * @param icall Async request data382 */383 283 static void udp_assoc_destroy_srv(udp_client_t *client, ipc_callid_t iid, 384 284 ipc_call_t *icall) … … 394 294 } 395 295 396 /** Send message via association.397 *398 * Handle client request to send message.399 *400 * @param client UDP client401 * @param iid Async request ID402 * @param icall Async request data403 */404 296 static void udp_assoc_send_msg_srv(udp_client_t *client, ipc_callid_t iid, 405 297 ipc_call_t *icall) … … 476 368 } 477 369 478 /** Get next received message.479 *480 * @param client UDP Client481 * @return Pointer to queue entry for next received message482 */483 370 static udp_crcv_queue_entry_t *udp_rmsg_get_next(udp_client_t *client) 484 371 { … … 492 379 } 493 380 494 /** Get info on first received message.495 *496 * Handle client request to get information on received message.497 *498 * @param client UDP client499 * @param iid Async request ID500 * @param icall Async request data501 */502 381 static void udp_rmsg_info_srv(udp_client_t *client, ipc_callid_t iid, 503 382 ipc_call_t *icall) … … 539 418 } 540 419 541 /** Read data from first received message.542 *543 * Handle client request to read data from first received message.544 *545 * @param client UDP client546 * @param iid Async request ID547 * @param icall Async request data548 */549 420 static void udp_rmsg_read_srv(udp_client_t *client, ipc_callid_t iid, 550 421 ipc_call_t *icall) … … 589 460 } 590 461 591 /** Discard first received message.592 *593 * Handle client request to discard first received message, advancing594 * to the next one.595 *596 * @param client UDP client597 * @param iid Async request ID598 * @param icall Async request data599 */600 462 static void udp_rmsg_discard_srv(udp_client_t *client, ipc_callid_t iid, 601 463 ipc_call_t *icall) … … 618 480 } 619 481 620 /** Handle UDP client connection.621 *622 * @param iid Connect call ID623 * @param icall Connect call data624 * @param arg Connection argument625 */626 482 static void udp_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 627 483 { 628 484 udp_client_t client; 629 unsigned longn;485 size_t n; 630 486 631 487 /* Accept the connection */ … … 685 541 if (n != 0) { 686 542 log_msg(LOG_DEFAULT, LVL_WARN, "udp_client_conn: " 687 "Client with % lu active associations closed session.", n);543 "Client with %zu active associations closed session.", n); 688 544 /* XXX Clean up */ 689 545 } … … 695 551 } 696 552 697 /** Initialize UDP service.698 *699 * @return EOK on success or negative error code.700 */701 553 int udp_service_init(void) 702 554 { … … 704 556 service_id_t sid; 705 557 706 async_set_ fallback_port_handler(udp_client_conn, NULL);558 async_set_client_connection(udp_client_conn); 707 559 708 560 rc = loc_server_register(NAME);
Note:
See TracChangeset
for help on using the changeset viewer.