Changes in uspace/lib/net/tl/socket_core.c [46d4d9f:0ab68f6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/tl/socket_core.c
r46d4d9f r0ab68f6 68 68 INT_MAP_IMPLEMENT(socket_cores, socket_core_t); 69 69 70 GENERIC_CHAR_MAP_IMPLEMENT(socket_port_map, socket_core_ t *);70 GENERIC_CHAR_MAP_IMPLEMENT(socket_port_map, socket_core_ref); 71 71 72 72 INT_MAP_IMPLEMENT(socket_ports, socket_port_t); … … 85 85 */ 86 86 static void 87 socket_destroy_core(int packet_phone, socket_core_ t *socket,88 socket_cores_ t *local_sockets, socket_ports_t *global_sockets,89 void (* socket_release)(socket_core_ t *socket))87 socket_destroy_core(int packet_phone, socket_core_ref socket, 88 socket_cores_ref local_sockets, socket_ports_ref global_sockets, 89 void (* socket_release)(socket_core_ref socket)) 90 90 { 91 91 int packet_id; … … 121 121 */ 122 122 void 123 socket_cores_release(int packet_phone, socket_cores_ t *local_sockets,124 socket_ports_ t *global_sockets,125 void (* socket_release)(socket_core_ t *socket))123 socket_cores_release(int packet_phone, socket_cores_ref local_sockets, 124 socket_ports_ref global_sockets, 125 void (* socket_release)(socket_core_ref socket)) 126 126 { 127 127 int index; … … 156 156 * @param[in] key The socket key identifier. 157 157 * @param[in] key_length The socket key length. 158 * @return EOK on success.159 * @return ENOMEM if there is not enough memory left.158 * @returns EOK on success. 159 * @returns ENOMEM if there is not enough memory left. 160 160 */ 161 161 static int 162 socket_port_add_core(socket_port_ t *socket_port, socket_core_t *socket,162 socket_port_add_core(socket_port_ref socket_port, socket_core_ref socket, 163 163 const char *key, size_t key_length) 164 164 { 165 socket_core_ t **socket_ref;165 socket_core_ref *socket_ref; 166 166 int rc; 167 167 … … 194 194 * @param[in] socket The socket to be added. 195 195 * @param[in] port The port number to be bound to. 196 * @return EOK on success.197 * @return ENOMEM if there is not enough memory left.198 * @return Other error codes as defined for the196 * @returns EOK on success. 197 * @returns ENOMEM if there is not enough memory left. 198 * @returns Other error codes as defined for the 199 199 * socket_ports_add() function. 200 200 */ 201 201 static int 202 socket_bind_insert(socket_ports_ t *global_sockets, socket_core_t *socket,202 socket_bind_insert(socket_ports_ref global_sockets, socket_core_ref socket, 203 203 int port) 204 204 { 205 socket_port_ t *socket_port;205 socket_port_ref socket_port; 206 206 int rc; 207 207 … … 248 248 * @param[in] free_ports_end The maximum free port. 249 249 * @param[in] last_used_port The last used free port. 250 * @return EOK on success.251 * @return ENOTSOCK if the socket was not found.252 * @return EAFNOSUPPORT if the address family is not supported.253 * @return EADDRINUSE if the port is already in use.254 * @return Other error codes as defined for the250 * @returns EOK on success. 251 * @returns ENOTSOCK if the socket was not found. 252 * @returns EAFNOSUPPORT if the address family is not supported. 253 * @returns EADDRINUSE if the port is already in use. 254 * @returns Other error codes as defined for the 255 255 * socket_bind_free_port() function. 256 * @return Other error codes as defined for the256 * @returns Other error codes as defined for the 257 257 * socket_bind_insert() function. 258 258 */ 259 259 int 260 socket_bind(socket_cores_ t *local_sockets, socket_ports_t *global_sockets,260 socket_bind(socket_cores_ref local_sockets, socket_ports_ref global_sockets, 261 261 int socket_id, void *addr, size_t addrlen, int free_ports_start, 262 262 int free_ports_end, int last_used_port) 263 263 { 264 socket_core_ t *socket;265 socket_port_ t *socket_port;264 socket_core_ref socket; 265 socket_port_ref socket_port; 266 266 struct sockaddr *address; 267 267 struct sockaddr_in *address_in; … … 322 322 * @param[in] free_ports_end The maximum free port. 323 323 * @param[in] last_used_port The last used free port. 324 * @return EOK on success.325 * @return ENOTCONN if no free port was found.326 * @return Other error codes as defined for the324 * @returns EOK on success. 325 * @returns ENOTCONN if no free port was found. 326 * @returns Other error codes as defined for the 327 327 * socket_bind_insert() function. 328 328 */ 329 329 int 330 socket_bind_free_port(socket_ports_ t *global_sockets, socket_core_t *socket,330 socket_bind_free_port(socket_ports_ref global_sockets, socket_core_ref socket, 331 331 int free_ports_start, int free_ports_end, int last_used_port) 332 332 { … … 367 367 * requested. A negative identifier is requested if set to 368 368 * false. 369 * @return The new socket identifier.370 * @return ELIMIT if there is no socket identifier available.371 */ 372 static int socket_generate_new_id(socket_cores_ t *local_sockets, int positive)369 * @returns The new socket identifier. 370 * @returns ELIMIT if there is no socket identifier available. 371 */ 372 static int socket_generate_new_id(socket_cores_ref local_sockets, int positive) 373 373 { 374 374 int socket_id; … … 410 410 * chosen if set to zero or negative. A negative identifier 411 411 * is chosen if set to negative. 412 * @return EOK on success.413 * @return EINVAL if the socket_id parameter is NULL.414 * @return ENOMEM if there is not enough memory left.412 * @returns EOK on success. 413 * @returns EINVAL if the socket_id parameter is NULL. 414 * @returns ENOMEM if there is not enough memory left. 415 415 */ 416 416 int 417 socket_create(socket_cores_ t *local_sockets, int app_phone,417 socket_create(socket_cores_ref local_sockets, int app_phone, 418 418 void *specific_data, int *socket_id) 419 419 { 420 socket_core_ t *socket;420 socket_core_ref socket; 421 421 int positive; 422 422 int rc; … … 437 437 } 438 438 439 socket = (socket_core_ t *) malloc(sizeof(*socket));439 socket = (socket_core_ref) malloc(sizeof(*socket)); 440 440 if (!socket) 441 441 return ENOMEM; … … 482 482 * @param[in,out] global_sockets The global sockets to be updated. 483 483 * @param[in] socket_release The client release callback function. 484 * @return EOK on success.485 * @return ENOTSOCK if the socket is not found.484 * @returns EOK on success. 485 * @returns ENOTSOCK if the socket is not found. 486 486 */ 487 487 int 488 socket_destroy(int packet_phone, int socket_id, socket_cores_ t *local_sockets,489 socket_ports_ t *global_sockets,490 void (*socket_release)(socket_core_ t *socket))491 { 492 socket_core_ t *socket;488 socket_destroy(int packet_phone, int socket_id, socket_cores_ref local_sockets, 489 socket_ports_ref global_sockets, 490 void (*socket_release)(socket_core_ref socket)) 491 { 492 socket_core_ref socket; 493 493 int accepted_id; 494 494 … … 516 516 * @param[in] packet The packet to be transfered. 517 517 * @param[out] length The total data length. 518 * @return EOK on success.519 * @return EBADMEM if the length parameter is NULL.520 * @return ENOMEM if there is not enough memory left.521 * @return Other error codes as defined for the data_reply()518 * @returns EOK on success. 519 * @returns EBADMEM if the length parameter is NULL. 520 * @returns ENOMEM if there is not enough memory left. 521 * @returns Other error codes as defined for the data_reply() 522 522 * function. 523 523 */ 524 int socket_reply_packets(packet_t *packet, size_t *length)525 { 526 packet_t *next_packet;524 int socket_reply_packets(packet_t packet, size_t *length) 525 { 526 packet_t next_packet; 527 527 size_t fragments; 528 528 size_t *lengths; … … 598 598 * @param[in] key The socket key identifier. 599 599 * @param[in] key_length The socket key length. 600 * @return The found socket.601 * @return NULL if no socket was found.602 */ 603 socket_core_ t *604 socket_port_find(socket_ports_ t *global_sockets, int port, const char *key,600 * @returns The found socket. 601 * @returns NULL if no socket was found. 602 */ 603 socket_core_ref 604 socket_port_find(socket_ports_ref global_sockets, int port, const char *key, 605 605 size_t key_length) 606 606 { 607 socket_port_ t *socket_port;608 socket_core_ t **socket_ref;607 socket_port_ref socket_port; 608 socket_core_ref *socket_ref; 609 609 610 610 socket_port = socket_ports_find(global_sockets, port); … … 628 628 */ 629 629 void 630 socket_port_release(socket_ports_ t *global_sockets, socket_core_t *socket)631 { 632 socket_port_ t *socket_port;633 socket_core_ t **socket_ref;630 socket_port_release(socket_ports_ref global_sockets, socket_core_ref socket) 631 { 632 socket_port_ref socket_port; 633 socket_core_ref *socket_ref; 634 634 635 635 if (!socket->port) … … 673 673 * @param[in] key The socket key identifier. 674 674 * @param[in] key_length The socket key length. 675 * @return EOK on success.676 * @return ENOENT if the port is not already used.677 * @return Other error codes as defined for the675 * @returns EOK on success. 676 * @returns ENOENT if the port is not already used. 677 * @returns Other error codes as defined for the 678 678 * socket_port_add_core() function. 679 679 */ 680 680 int 681 socket_port_add(socket_ports_ t *global_sockets, int port,682 socket_core_ t *socket, const char *key, size_t key_length)683 { 684 socket_port_ t *socket_port;681 socket_port_add(socket_ports_ref global_sockets, int port, 682 socket_core_ref socket, const char *key, size_t key_length) 683 { 684 socket_port_ref socket_port; 685 685 int rc; 686 686
Note:
See TracChangeset
for help on using the changeset viewer.