Changeset b1bd89ea in mainline
- Timestamp:
- 2012-04-24T16:15:41Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 76983ff, bc03679
- Parents:
- 32fef47
- Location:
- uspace
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r32fef47 rb1bd89ea 122 122 generic/vfs/canonify.c \ 123 123 generic/net/inet.c \ 124 generic/net/modules.c \125 124 generic/net/socket_client.c \ 126 125 generic/net/socket_parse.c \ -
uspace/lib/c/generic/net/socket_client.c
r32fef47 rb1bd89ea 44 44 #include <errno.h> 45 45 #include <task.h> 46 #include <ns.h> 46 47 #include <ipc/services.h> 47 48 #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 = bind_service(SERVICE_TCP,286 socket_globals.tcp_sess = service_bind(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 = bind_service(SERVICE_UDP,303 socket_globals.udp_sess = service_bind(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 * bind_service() function.380 * service_bind() function. 381 381 */ 382 382 int socket(int domain, int type, int protocol) -
uspace/lib/c/generic/ns.c
r32fef47 rb1bd89ea 37 37 #include <async.h> 38 38 #include <macros.h> 39 #include <errno.h> 39 40 #include "private/ns.h" 40 41 … … 48 49 } 49 50 50 async_sess_t *service_connect(exch_mgmt_t mgmt, s ysarg_t service, sysarg_t arg2,51 async_sess_t *service_connect(exch_mgmt_t mgmt, services_t service, sysarg_t arg2, 51 52 sysarg_t arg3) 52 53 { … … 72 73 } 73 74 74 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, s ysarg_t service,75 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, services_t service, 75 76 sysarg_t arg2, sysarg_t arg3) 76 77 { … … 81 82 async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3); 82 83 async_exchange_end(exch); 83 84 84 85 if (!sess) 85 86 return NULL; … … 91 92 */ 92 93 async_sess_args_set(sess, arg2, arg3, 0); 94 95 return sess; 96 } 97 98 /** Create bidirectional connection with a service 99 * 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 } 93 129 94 130 return sess; -
uspace/lib/c/include/ns.h
r32fef47 rb1bd89ea 37 37 38 38 #include <sys/types.h> 39 #include <ipc/services.h> 39 40 #include <task.h> 40 41 #include <async.h> 41 42 42 43 extern int service_register(sysarg_t); 43 extern async_sess_t *service_connect(exch_mgmt_t, s ysarg_t, sysarg_t, sysarg_t);44 extern async_sess_t *service_connect_blocking(exch_mgmt_t, s ysarg_t, sysarg_t,44 extern async_sess_t *service_connect(exch_mgmt_t, services_t, sysarg_t, sysarg_t); 45 extern async_sess_t *service_connect_blocking(exch_mgmt_t, services_t, sysarg_t, 45 46 sysarg_t); 47 extern async_sess_t *service_bind(services_t, sysarg_t, sysarg_t, sysarg_t, 48 async_client_conn_t); 46 49 47 50 extern int ns_ping(void); -
uspace/lib/net/tl/socket_core.c
r32fef47 rb1bd89ea 39 39 #include <net/in.h> 40 40 #include <net/inet.h> 41 #include <net/modules.h>42 41 #include <stdint.h> 43 42 #include <stdlib.h> -
uspace/srv/net/tcp/sock.c
r32fef47 rb1bd89ea 42 42 #include <ipc/services.h> 43 43 #include <ipc/socket.h> 44 #include <net/modules.h>45 44 #include <net/socket.h> 46 45 #include <ns.h> … … 144 143 sock->sock_core = sock_core; 145 144 146 refresh_answer(&answer, NULL);147 145 SOCKET_SET_SOCKET_ID(answer, sock_id); 148 146 149 147 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 150 148 SOCKET_SET_HEADER_SIZE(answer, sizeof(tcp_header_t)); 151 answer_call(callid, EOK, &answer, 3); 149 150 async_answer_3(callid, EOK, IPC_GET_ARG1(answer), 151 IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 152 152 } 153 153 … … 468 468 assert(asock_core != NULL); 469 469 470 refresh_answer(&answer, NULL);471 472 470 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 473 471 SOCKET_SET_SOCKET_ID(answer, asock_id); 474 472 SOCKET_SET_ADDRESS_LENGTH(answer, sizeof(struct sockaddr_in)); 475 476 answer_call(callid, asock_core->socket_id, &answer, 3); 477 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 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 refresh_answer(&answer, NULL);561 IPC_SET_ARG1(answer, 0); 562 562 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 563 answer_call(callid, EOK, &answer, 2); 563 async_answer_2(callid, EOK, IPC_GET_ARG1(answer), 564 IPC_GET_ARG2(answer)); 564 565 fibril_mutex_unlock(&socket->lock); 565 566 } … … 679 680 680 681 SOCKET_SET_READ_DATA_LENGTH(answer, length); 681 a nswer_call(callid, EOK, &answer, 1);682 682 async_answer_1(callid, EOK, IPC_GET_ARG1(answer)); 683 683 684 /* Push one fragment notification to client's queue */ 684 685 tcp_sock_notify_data(sock_core); -
uspace/srv/net/udp/sock.c
r32fef47 rb1bd89ea 43 43 #include <ipc/services.h> 44 44 #include <ipc/socket.h> 45 #include <net/modules.h>46 45 #include <net/socket.h> 47 46 #include <ns.h> … … 134 133 assert(sock_core != NULL); 135 134 sock->sock_core = sock_core; 136 137 138 refresh_answer(&answer, NULL); 135 139 136 SOCKET_SET_SOCKET_ID(answer, sock_id); 140 137 141 138 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 142 139 SOCKET_SET_HEADER_SIZE(answer, sizeof(udp_header_t)); 143 answer_call(callid, EOK, &answer, 3); 140 async_answer_3(callid, EOK, IPC_GET_ARG1(answer), 141 IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 144 142 } 145 143 … … 369 367 } 370 368 } 371 372 refresh_answer(&answer, NULL);369 370 IPC_SET_ARG1(answer, 0); 373 371 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE); 374 answer_call(callid, EOK, &answer, 2); 372 async_answer_2(callid, EOK, IPC_GET_ARG1(answer), 373 IPC_GET_ARG2(answer)); 375 374 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); 488 489 SOCKET_SET_READ_DATA_LENGTH(answer, length); 489 490 SOCKET_SET_ADDRESS_LENGTH(answer, sizeof(addr)); 490 answer_call(callid, EOK, &answer, 3); 491 491 async_answer_3(callid, EOK, IPC_GET_ARG1(answer), 492 IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 493 492 494 /* Push one fragment notification to client's queue */ 493 495 udp_sock_notify_data(sock_core);
Note:
See TracChangeset
for help on using the changeset viewer.