Changes in / [bc03679:ee3b6150] in mainline
- Location:
- uspace
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
rbc03679 ree3b6150 122 122 generic/vfs/canonify.c \ 123 123 generic/net/inet.c \ 124 generic/net/modules.c \ 124 125 generic/net/socket_client.c \ 125 126 generic/net/socket_parse.c \ -
uspace/lib/c/generic/net/socket_client.c
rbc03679 ree3b6150 44 44 #include <errno.h> 45 45 #include <task.h> 46 #include <ns.h>47 46 #include <ipc/services.h> 48 47 #include <ipc/socket.h> 48 #include <net/modules.h> 49 49 #include <net/in.h> 50 50 #include <net/socket.h> … … 284 284 { 285 285 if (socket_globals.tcp_sess == NULL) { 286 socket_globals.tcp_sess = service_bind(SERVICE_TCP,286 socket_globals.tcp_sess = bind_service(SERVICE_TCP, 287 287 0, 0, SERVICE_TCP, socket_connection); 288 288 } … … 301 301 { 302 302 if (socket_globals.udp_sess == NULL) { 303 socket_globals.udp_sess = service_bind(SERVICE_UDP,303 socket_globals.udp_sess = bind_service(SERVICE_UDP, 304 304 0, 0, SERVICE_UDP, socket_connection); 305 305 } … … 378 378 * @return Other error codes as defined for the NET_SOCKET message. 379 379 * @return Other error codes as defined for the 380 * service_bind() function.380 * bind_service() function. 381 381 */ 382 382 int socket(int domain, int type, int protocol) -
uspace/lib/c/generic/ns.c
rbc03679 ree3b6150 37 37 #include <async.h> 38 38 #include <macros.h> 39 #include <errno.h>40 39 #include "private/ns.h" 41 40 … … 49 48 } 50 49 51 async_sess_t *service_connect(exch_mgmt_t mgmt, s ervices_t service, sysarg_t arg2,50 async_sess_t *service_connect(exch_mgmt_t mgmt, sysarg_t service, sysarg_t arg2, 52 51 sysarg_t arg3) 53 52 { … … 73 72 } 74 73 75 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, s ervices_t service,74 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, sysarg_t service, 76 75 sysarg_t arg2, sysarg_t arg3) 77 76 { … … 82 81 async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3); 83 82 async_exchange_end(exch); 84 83 85 84 if (!sess) 86 85 return NULL; … … 92 91 */ 93 92 async_sess_args_set(sess, arg2, arg3, 0); 94 95 return sess;96 }97 98 /** Create bidirectional connection with a service99 *100 * @param[in] service Service.101 * @param[in] arg1 First parameter.102 * @param[in] arg2 Second parameter.103 * @param[in] arg3 Third parameter.104 * @param[in] client_receiver Message receiver.105 *106 * @return Session to the service.107 * @return Other error codes as defined by async_connect_to_me().108 *109 */110 async_sess_t *service_bind(services_t service, sysarg_t arg1, sysarg_t arg2,111 sysarg_t arg3, async_client_conn_t client_receiver)112 {113 /* Connect to the needed service */114 async_sess_t *sess =115 service_connect_blocking(EXCHANGE_SERIALIZE, service, 0, 0);116 if (sess != NULL) {117 /* Request callback connection */118 async_exch_t *exch = async_exchange_begin(sess);119 int rc = async_connect_to_me(exch, arg1, arg2, arg3,120 client_receiver, NULL);121 async_exchange_end(exch);122 123 if (rc != EOK) {124 async_hangup(sess);125 errno = rc;126 return NULL;127 }128 }129 93 130 94 return sess; -
uspace/lib/c/include/ns.h
rbc03679 ree3b6150 37 37 38 38 #include <sys/types.h> 39 #include <ipc/services.h>40 39 #include <task.h> 41 40 #include <async.h> 42 41 43 42 extern int service_register(sysarg_t); 44 extern async_sess_t *service_connect(exch_mgmt_t, s ervices_t, sysarg_t, sysarg_t);45 extern async_sess_t *service_connect_blocking(exch_mgmt_t, s ervices_t, sysarg_t,43 extern async_sess_t *service_connect(exch_mgmt_t, sysarg_t, sysarg_t, sysarg_t); 44 extern async_sess_t *service_connect_blocking(exch_mgmt_t, sysarg_t, sysarg_t, 46 45 sysarg_t); 47 extern async_sess_t *service_bind(services_t, sysarg_t, sysarg_t, sysarg_t,48 async_client_conn_t);49 46 50 47 extern int ns_ping(void); -
uspace/lib/net/tl/socket_core.c
rbc03679 ree3b6150 39 39 #include <net/in.h> 40 40 #include <net/inet.h> 41 #include <net/modules.h> 41 42 #include <stdint.h> 42 43 #include <stdlib.h> -
uspace/srv/net/tcp/sock.c
rbc03679 ree3b6150 42 42 #include <ipc/services.h> 43 43 #include <ipc/socket.h> 44 #include <net/modules.h> 44 45 #include <net/socket.h> 45 46 #include <ns.h> … … 143 144 sock->sock_core = sock_core; 144 145 146 refresh_answer(&answer, NULL); 145 147 SOCKET_SET_SOCKET_ID(answer, sock_id); 146 148 147 149 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 148 150 SOCKET_SET_HEADER_SIZE(answer, sizeof(tcp_header_t)); 149 150 async_answer_3(callid, EOK, IPC_GET_ARG1(answer), 151 IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 151 answer_call(callid, EOK, &answer, 3); 152 152 } 153 153 … … 468 468 assert(asock_core != NULL); 469 469 470 refresh_answer(&answer, NULL); 471 470 472 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 471 473 SOCKET_SET_SOCKET_ID(answer, asock_id); 472 474 SOCKET_SET_ADDRESS_LENGTH(answer, sizeof(struct sockaddr_in)); 473 474 async_answer_3(callid, asock_core->socket_id, 475 IPC_GET_ARG1(answer), IPC_GET_ARG2(answer), 476 IPC_GET_ARG3(answer)); 477 475 476 answer_call(callid, asock_core->socket_id, &answer, 3); 477 478 478 /* Push one fragment notification to client's queue */ 479 479 log_msg(LVL_DEBUG, "tcp_sock_accept(): notify data\n"); … … 559 559 } 560 560 561 IPC_SET_ARG1(answer, 0);561 refresh_answer(&answer, NULL); 562 562 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 563 async_answer_2(callid, EOK, IPC_GET_ARG1(answer), 564 IPC_GET_ARG2(answer)); 563 answer_call(callid, EOK, &answer, 2); 565 564 fibril_mutex_unlock(&socket->lock); 566 565 } … … 680 679 681 680 SOCKET_SET_READ_DATA_LENGTH(answer, length); 682 a sync_answer_1(callid, EOK, IPC_GET_ARG1(answer));683 681 answer_call(callid, EOK, &answer, 1); 682 684 683 /* Push one fragment notification to client's queue */ 685 684 tcp_sock_notify_data(sock_core); -
uspace/srv/net/udp/sock.c
rbc03679 ree3b6150 43 43 #include <ipc/services.h> 44 44 #include <ipc/socket.h> 45 #include <net/modules.h> 45 46 #include <net/socket.h> 46 47 #include <ns.h> … … 133 134 assert(sock_core != NULL); 134 135 sock->sock_core = sock_core; 135 136 137 138 refresh_answer(&answer, NULL); 136 139 SOCKET_SET_SOCKET_ID(answer, sock_id); 137 140 138 141 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 139 142 SOCKET_SET_HEADER_SIZE(answer, sizeof(udp_header_t)); 140 async_answer_3(callid, EOK, IPC_GET_ARG1(answer), 141 IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 143 answer_call(callid, EOK, &answer, 3); 142 144 } 143 145 … … 367 369 } 368 370 } 369 370 IPC_SET_ARG1(answer, 0);371 372 refresh_answer(&answer, NULL); 371 373 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 372 async_answer_2(callid, EOK, IPC_GET_ARG1(answer), 373 IPC_GET_ARG2(answer)); 374 answer_call(callid, EOK, &answer, 2); 374 375 fibril_mutex_unlock(&socket->lock); 375 376 376 out: 377 377 if (addr != NULL) … … 486 486 487 487 log_msg(LVL_DEBUG, "read_data_length <- %zu", length); 488 IPC_SET_ARG2(answer, 0);489 488 SOCKET_SET_READ_DATA_LENGTH(answer, length); 490 489 SOCKET_SET_ADDRESS_LENGTH(answer, sizeof(addr)); 491 async_answer_3(callid, EOK, IPC_GET_ARG1(answer), 492 IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 493 490 answer_call(callid, EOK, &answer, 3); 491 494 492 /* Push one fragment notification to client's queue */ 495 493 udp_sock_notify_data(sock_core);
Note:
See TracChangeset
for help on using the changeset viewer.