Changes in uspace/srv/net/tl/tcp/tcp.c [28a3e74:49bd793b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/tcp/tcp.c
r28a3e74 r49bd793b 169 169 static int tcp_release_after_timeout(void *); 170 170 171 static int tcp_process_packet( device_id_t, packet_t *, services_t);171 static int tcp_process_packet(nic_device_id_t, packet_t *, services_t); 172 172 static int tcp_connect_core(socket_core_t *, socket_cores_t *, 173 173 struct sockaddr *, socklen_t); … … 177 177 size_t); 178 178 static packet_t *tcp_get_packets_to_send(socket_core_t *, tcp_socket_data_t *); 179 static void tcp_send_packets( device_id_t, packet_t *);179 static void tcp_send_packets(nic_device_id_t, packet_t *); 180 180 181 181 static void tcp_process_acknowledgement(socket_core_t *, tcp_socket_data_t *, … … 205 205 static void tcp_queue_received_end_of_data(socket_core_t *socket); 206 206 207 static int tcp_received_msg(device_id_t, packet_t *, services_t, services_t); 208 static int tcp_process_client_messages(ipc_callid_t, ipc_call_t); 207 static int tcp_received_msg(nic_device_id_t, packet_t *, services_t, services_t); 208 static int tcp_process_client_messages(async_sess_t *, ipc_callid_t, 209 ipc_call_t); 209 210 210 211 static int tcp_listen_message(socket_cores_t *, int, int); … … 219 220 tcp_globals_t tcp_globals; 220 221 221 int tcp_received_msg( device_id_t device_id, packet_t *packet,222 int tcp_received_msg(nic_device_id_t device_id, packet_t *packet, 222 223 services_t receiver, services_t error) 223 224 { … … 237 238 } 238 239 239 int tcp_process_packet( device_id_t device_id, packet_t *packet, services_t error)240 int tcp_process_packet(nic_device_id_t device_id, packet_t *packet, services_t error) 240 241 { 241 242 size_t length; … … 324 325 325 326 if (!socket) { 326 if (tl_prepare_icmp_packet(tcp_globals.net_ phone,327 tcp_globals.icmp_ phone, packet, error) == EOK) {328 icmp_destination_unreachable_msg(tcp_globals.icmp_ phone,327 if (tl_prepare_icmp_packet(tcp_globals.net_sess, 328 tcp_globals.icmp_sess, packet, error) == EOK) { 329 icmp_destination_unreachable_msg(tcp_globals.icmp_sess, 329 330 ICMP_PORT_UNREACH, 0, packet); 330 331 } … … 397 398 fibril_rwlock_write_unlock(socket_data->local_lock); 398 399 399 rc = tl_prepare_icmp_packet(tcp_globals.net_ phone,400 tcp_globals.icmp_ phone, packet, error);400 rc = tl_prepare_icmp_packet(tcp_globals.net_sess, 401 tcp_globals.icmp_sess, packet, error); 401 402 if (rc == EOK) { 402 403 /* Checksum error ICMP */ 403 icmp_parameter_problem_msg(tcp_globals.icmp_ phone,404 icmp_parameter_problem_msg(tcp_globals.icmp_sess, 404 405 ICMP_PARAM_POINTER, 405 406 ((size_t) ((void *) &header->checksum)) - … … 439 440 break; 440 441 default: 441 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));442 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 442 443 } 443 444 … … 476 477 old_incoming = socket_data->next_incoming; 477 478 478 if ( header->finalize) {479 if (GET_TCP_HEADER_FINALIZE(header)) { 479 480 socket_data->fin_incoming = new_sequence_number + 480 481 total_length - TCP_HEADER_LENGTH(header); … … 502 503 /* Release the acknowledged packets */ 503 504 next_packet = pq_next(packet); 504 pq_release_remote(tcp_globals.net_ phone,505 pq_release_remote(tcp_globals.net_sess, 505 506 packet_get_id(packet)); 506 507 packet = next_packet; … … 561 562 next_packet = pq_next(next_packet); 562 563 pq_insert_after(tmp_packet, next_packet); 563 pq_release_remote(tcp_globals.net_ phone,564 pq_release_remote(tcp_globals.net_sess, 564 565 packet_get_id(tmp_packet)); 565 566 } … … 598 599 if (packet == socket_data->incoming) 599 600 socket_data->incoming = next_packet; 600 pq_release_remote(tcp_globals.net_ phone,601 pq_release_remote(tcp_globals.net_sess, 601 602 packet_get_id(packet)); 602 603 packet = next_packet; … … 621 622 if (length <= 0) { 622 623 /* Remove the empty packet */ 623 pq_release_remote(tcp_globals.net_ phone,624 pq_release_remote(tcp_globals.net_sess, 624 625 packet_get_id(packet)); 625 626 packet = next_packet; … … 668 669 } 669 670 /* Remove the duplicit or corrupted packet */ 670 pq_release_remote(tcp_globals.net_ phone,671 pq_release_remote(tcp_globals.net_sess, 671 672 packet_get_id(packet)); 672 673 packet = next_packet; … … 695 696 if (rc != EOK) { 696 697 /* Remove the corrupted packets */ 697 pq_release_remote(tcp_globals.net_ phone,698 pq_release_remote(tcp_globals.net_sess, 698 699 packet_get_id(packet)); 699 pq_release_remote(tcp_globals.net_ phone,700 pq_release_remote(tcp_globals.net_sess, 700 701 packet_get_id(next_packet)); 701 702 } else { … … 708 709 new_sequence_number, length); 709 710 if (rc != EOK) { 710 pq_release_remote(tcp_globals.net_ phone,711 pq_release_remote(tcp_globals.net_sess, 711 712 packet_get_id(next_packet)); 712 713 } 713 714 rc = pq_insert_after(packet, next_packet); 714 715 if (rc != EOK) { 715 pq_release_remote(tcp_globals.net_ phone,716 pq_release_remote(tcp_globals.net_sess, 716 717 packet_get_id(next_packet)); 717 718 } … … 722 723 printf("unexpected\n"); 723 724 /* Release duplicite or restricted */ 724 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));725 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 725 726 forced_ack = true; 726 727 } … … 790 791 if (rc != EOK) 791 792 return tcp_release_and_return(packet, rc); 792 rc = tl_get_ip_packet_dimension(tcp_globals.ip_ phone,793 rc = tl_get_ip_packet_dimension(tcp_globals.ip_sess, 793 794 &tcp_globals.dimensions, socket_data->device_id, &packet_dimension); 794 795 if (rc != EOK) … … 799 800 800 801 /* Notify the destination socket */ 801 async_ msg_5(socket->phone, NET_SOCKET_RECEIVED,802 802 async_exch_t *exch = async_exchange_begin(socket->sess); 803 async_msg_5(exch, NET_SOCKET_RECEIVED, (sysarg_t) socket->socket_id, 803 804 ((packet_dimension->content < socket_data->data_fragment_size) ? 804 805 packet_dimension->content : socket_data->data_fragment_size), 0, 0, 805 806 (sysarg_t) fragments); 807 async_exchange_end(exch); 806 808 807 809 return EOK; … … 820 822 821 823 /* Notify the destination socket */ 822 async_ msg_5(socket->phone, NET_SOCKET_RECEIVED,823 824 0, 0, 0, 825 (sysarg_t) 0 /* 0 fragments == no more data */);824 async_exch_t *exch = async_exchange_begin(socket->sess); 825 async_msg_5(exch, NET_SOCKET_RECEIVED, (sysarg_t) socket->socket_id, 826 0, 0, 0, (sysarg_t) 0 /* 0 fragments == no more data */); 827 async_exchange_end(exch); 826 828 } 827 829 … … 838 840 assert(packet); 839 841 840 if (! header->synchronize)842 if (!GET_TCP_HEADER_SYNCHRONIZE(header)) 841 843 return tcp_release_and_return(packet, EINVAL); 842 844 … … 849 851 next_packet = pq_detach(packet); 850 852 if (next_packet) { 851 pq_release_remote(tcp_globals.net_ phone,853 pq_release_remote(tcp_globals.net_sess, 852 854 packet_get_id(next_packet)); 853 855 } … … 903 905 assert(packet); 904 906 905 if (! header->synchronize)907 if (!GET_TCP_HEADER_SYNCHRONIZE(header)) 906 908 return tcp_release_and_return(packet, EINVAL); 907 909 … … 936 938 /* Create a socket */ 937 939 socket_id = -1; 938 rc = socket_create(socket_data->local_sockets, listening_socket-> phone,940 rc = socket_create(socket_data->local_sockets, listening_socket->sess, 939 941 socket_data, &socket_id); 940 942 if (rc != EOK) { … … 989 991 fibril_rwlock_write_unlock(&tcp_globals.lock); 990 992 if (rc != EOK) { 991 socket_destroy(tcp_globals.net_ phone, socket->socket_id,993 socket_destroy(tcp_globals.net_sess, socket->socket_id, 992 994 socket_data->local_sockets, &tcp_globals.sockets, 993 995 tcp_free_socket_data); … … 1001 1003 next_packet = pq_detach(packet); 1002 1004 if (next_packet) { 1003 pq_release_remote(tcp_globals.net_ phone,1005 pq_release_remote(tcp_globals.net_sess, 1004 1006 packet_get_id(next_packet)); 1005 1007 } … … 1010 1012 packet_get_data_length(packet) - sizeof(*header)); 1011 1013 if (rc != EOK) { 1012 socket_destroy(tcp_globals.net_ phone, socket->socket_id,1014 socket_destroy(tcp_globals.net_sess, socket->socket_id, 1013 1015 socket_data->local_sockets, &tcp_globals.sockets, 1014 1016 tcp_free_socket_data); … … 1021 1023 rc = tcp_queue_packet(socket, socket_data, packet, 1); 1022 1024 if (rc != EOK) { 1023 socket_destroy(tcp_globals.net_ phone, socket->socket_id,1025 socket_destroy(tcp_globals.net_sess, socket->socket_id, 1024 1026 socket_data->local_sockets, &tcp_globals.sockets, 1025 1027 tcp_free_socket_data); … … 1029 1031 packet = tcp_get_packets_to_send(socket, socket_data); 1030 1032 if (!packet) { 1031 socket_destroy(tcp_globals.net_ phone, socket->socket_id,1033 socket_destroy(tcp_globals.net_sess, socket->socket_id, 1032 1034 socket_data->local_sockets, &tcp_globals.sockets, 1033 1035 tcp_free_socket_data); … … 1057 1059 assert(packet); 1058 1060 1059 if (! header->acknowledge)1061 if (!GET_TCP_HEADER_ACKNOWLEDGE(header)) 1060 1062 return tcp_release_and_return(packet, EINVAL); 1061 1063 … … 1064 1066 1065 1067 socket_data->next_incoming = ntohl(header->sequence_number); /* + 1; */ 1066 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));1068 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 1067 1069 socket_data->state = TCP_SOCKET_ESTABLISHED; 1068 1070 listening_socket = socket_cores_find(socket_data->local_sockets, … … 1078 1080 if (rc == EOK) { 1079 1081 /* Notify the destination socket */ 1080 async_msg_5(socket->phone, NET_SOCKET_ACCEPTED, 1082 async_exch_t *exch = async_exchange_begin(socket->sess); 1083 async_msg_5(exch, NET_SOCKET_ACCEPTED, 1081 1084 (sysarg_t) listening_socket->socket_id, 1082 1085 socket_data->data_fragment_size, TCP_HEADER_SIZE, 1083 1086 0, (sysarg_t) socket->socket_id); 1087 async_exchange_end(exch); 1084 1088 1085 1089 fibril_rwlock_write_unlock(socket_data->local_lock); … … 1126 1130 assert(header); 1127 1131 1128 if (! header->acknowledge)1132 if (!GET_TCP_HEADER_ACKNOWLEDGE(header)) 1129 1133 return; 1130 1134 … … 1177 1181 /* Add to acknowledged or release */ 1178 1182 if (pq_add(&acknowledged, packet, 0, 0) != EOK) 1179 pq_release_remote(tcp_globals.net_ phone,1183 pq_release_remote(tcp_globals.net_sess, 1180 1184 packet_get_id(packet)); 1181 1185 packet = next; … … 1186 1190 /* Release acknowledged */ 1187 1191 if (acknowledged) { 1188 pq_release_remote(tcp_globals.net_ phone,1192 pq_release_remote(tcp_globals.net_sess, 1189 1193 packet_get_id(acknowledged)); 1190 1194 } … … 1230 1234 assert(answer); 1231 1235 assert(answer_count); 1232 1236 1233 1237 *answer_count = 0; 1234 switch (IPC_GET_IMETHOD(*call)) { 1235 case IPC_M_CONNECT_TO_ME: 1236 return tcp_process_client_messages(callid, *call); 1237 } 1238 1238 1239 async_sess_t *callback = 1240 async_callback_receive_start(EXCHANGE_SERIALIZE, call); 1241 if (callback) 1242 return tcp_process_client_messages(callback, callid, *call); 1243 1239 1244 return ENOTSUP; 1240 1245 } … … 1246 1251 bzero(socket_data, sizeof(*socket_data)); 1247 1252 socket_data->state = TCP_SOCKET_INITIAL; 1248 socket_data->device_id = DEVICE_INVALID_ID;1253 socket_data->device_id = NIC_DEVICE_INVALID_ID; 1249 1254 socket_data->window = NET_DEFAULT_TCP_WINDOW; 1250 1255 socket_data->treshold = socket_data->window; … … 1266 1271 } 1267 1272 1268 int tcp_process_client_messages(ipc_callid_t callid, ipc_call_t call) 1273 int tcp_process_client_messages(async_sess_t *sess, ipc_callid_t callid, 1274 ipc_call_t call) 1269 1275 { 1270 1276 int res; 1271 bool keep_on_going = true;1272 1277 socket_cores_t local_sockets; 1273 int app_phone = IPC_GET_PHONE(call);1274 1278 struct sockaddr *addr; 1275 1279 int socket_id; … … 1293 1297 fibril_rwlock_initialize(&lock); 1294 1298 1295 while ( keep_on_going) {1299 while (true) { 1296 1300 1297 1301 /* Answer the call */ … … 1301 1305 /* Get the next call */ 1302 1306 callid = async_get_call(&call); 1307 1308 if (!IPC_GET_IMETHOD(call)) { 1309 res = EHANGUP; 1310 break; 1311 } 1303 1312 1304 1313 /* Process the call */ 1305 1314 switch (IPC_GET_IMETHOD(call)) { 1306 case IPC_M_PHONE_HUNGUP:1307 keep_on_going = false;1308 res = EHANGUP;1309 break;1310 1311 1315 case NET_SOCKET: 1312 1316 socket_data = … … 1322 1326 fibril_rwlock_write_lock(&lock); 1323 1327 socket_id = SOCKET_GET_SOCKET_ID(call); 1324 res = socket_create(&local_sockets, app_phone,1328 res = socket_create(&local_sockets, sess, 1325 1329 socket_data, &socket_id); 1326 1330 SOCKET_SET_SOCKET_ID(answer, socket_id); … … 1330 1334 break; 1331 1335 } 1332 if (tl_get_ip_packet_dimension(tcp_globals.ip_ phone,1333 &tcp_globals.dimensions, DEVICE_INVALID_ID,1336 if (tl_get_ip_packet_dimension(tcp_globals.ip_sess, 1337 &tcp_globals.dimensions, NIC_DEVICE_INVALID_ID, 1334 1338 &packet_dimension) == EOK) { 1335 1339 SOCKET_SET_DATA_FRAGMENT_SIZE(answer, … … 1505 1509 } 1506 1510 1507 /* Release the application phone*/1508 async_hangup( app_phone);1511 /* Release the application session */ 1512 async_hangup(sess); 1509 1513 1510 1514 printf("release\n"); 1511 1515 /* Release all local sockets */ 1512 socket_cores_release(tcp_globals.net_ phone, &local_sockets,1516 socket_cores_release(tcp_globals.net_sess, &local_sockets, 1513 1517 &tcp_globals.sockets, tcp_free_socket_data); 1514 1518 … … 1618 1622 local_lock = socket_data->local_lock; 1619 1623 fibril_rwlock_write_lock(local_lock); 1620 socket_destroy(tcp_globals.net_ phone,1624 socket_destroy(tcp_globals.net_sess, 1621 1625 timeout->socket_id, timeout->local_sockets, 1622 1626 &tcp_globals.sockets, tcp_free_socket_data); … … 1647 1651 /* Sent packet? */ 1648 1652 packet = pq_find(socket_data->outgoing, sequence_number); 1649 printf("retransmit %d\n", packet_get_id(packet));1650 1653 if (packet) { 1651 1654 pq_get_order(packet, NULL, &data_length); … … 1751 1754 } 1752 1755 1753 rc = ip_get_route_req(tcp_globals.ip_ phone, IPPROTO_TCP,1756 rc = ip_get_route_req(tcp_globals.ip_sess, IPPROTO_TCP, 1754 1757 addr, addrlen, &socket_data->device_id, 1755 1758 &socket_data->pseudo_header, &socket_data->headerlen); … … 1786 1789 1787 1790 /* Send the packet */ 1788 printf("connecting %d\n", packet_get_id(packet));1789 1791 tcp_send_packets(socket_data->device_id, packet); 1790 1792 … … 1833 1835 1834 1836 /* Remember the outgoing FIN */ 1835 if ( header->finalize)1837 if (GET_TCP_HEADER_FINALIZE(header)) 1836 1838 socket_data->fin_outgoing = socket_data->next_outgoing; 1837 1839 … … 1899 1901 rc = pq_insert_after(previous, copy); 1900 1902 if (rc != EOK) { 1901 pq_release_remote(tcp_globals.net_ phone,1903 pq_release_remote(tcp_globals.net_sess, 1902 1904 packet_get_id(copy)); 1903 1905 return sending; … … 1936 1938 socket_data->headerlen, packet_get_data_length(packet)); 1937 1939 if (rc != EOK) { 1938 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));1940 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 1939 1941 return NULL; 1940 1942 } … … 1943 1945 header = (tcp_header_t *) packet_get_data(packet); 1944 1946 if (!header) { 1945 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));1947 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 1946 1948 return NULL; 1947 1949 } … … 1952 1954 header->acknowledgement_number = 1953 1955 htonl(socket_data->next_incoming); 1954 header->acknowledge = 1;1956 SET_TCP_HEADER_ACKNOWLEDGE(header, 1); 1955 1957 } 1956 1958 header->window = htons(socket_data->window); … … 1968 1970 rc = ip_client_prepare_packet(packet, IPPROTO_TCP, 0, 0, 0, 0); 1969 1971 if (rc != EOK) { 1970 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));1972 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 1971 1973 return NULL; 1972 1974 } … … 1975 1977 sequence_number, socket_data->state, socket_data->timeout, true); 1976 1978 if (rc != EOK) { 1977 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));1979 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 1978 1980 return NULL; 1979 1981 } … … 1992 1994 1993 1995 /* Make a copy of the packet */ 1994 copy = packet_get_copy(tcp_globals.net_ phone, packet);1996 copy = packet_get_copy(tcp_globals.net_sess, packet); 1995 1997 if (!copy) 1996 1998 return NULL; … … 2000 2002 } 2001 2003 2002 void tcp_send_packets( device_id_t device_id, packet_t *packet)2004 void tcp_send_packets(nic_device_id_t device_id, packet_t *packet) 2003 2005 { 2004 2006 packet_t *next; … … 2006 2008 while (packet) { 2007 2009 next = pq_detach(packet); 2008 ip_send_msg(tcp_globals.ip_ phone, device_id, packet,2010 ip_send_msg(tcp_globals.ip_sess, device_id, packet, 2009 2011 SERVICE_TCP, 0); 2010 2012 packet = next; … … 2024 2026 header->source_port = htons(socket->port); 2025 2027 header->source_port = htons(socket_data->dest_port); 2026 header->header_length = TCP_COMPUTE_HEADER_LENGTH(sizeof(*header)); 2027 header->synchronize = synchronize; 2028 header->finalize = finalize; 2028 SET_TCP_HEADER_LENGTH(header, 2029 TCP_COMPUTE_HEADER_LENGTH(sizeof(*header))); 2030 SET_TCP_HEADER_SYNCHRONIZE(header, synchronize); 2031 SET_TCP_HEADER_FINALIZE(header, finalize); 2029 2032 } 2030 2033 … … 2118 2121 return NO_DATA; 2119 2122 2120 rc = packet_translate_remote(tcp_globals.net_ phone, &packet, packet_id);2123 rc = packet_translate_remote(tcp_globals.net_sess, &packet, packet_id); 2121 2124 if (rc != EOK) 2122 2125 return rc; … … 2129 2132 /* Release the packet */ 2130 2133 dyn_fifo_pop(&socket->received); 2131 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));2134 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 2132 2135 2133 2136 /* Return the total length */ … … 2167 2170 return ENOTCONN; 2168 2171 2169 rc = tl_get_ip_packet_dimension(tcp_globals.ip_ phone,2172 rc = tl_get_ip_packet_dimension(tcp_globals.ip_sess, 2170 2173 &tcp_globals.dimensions, socket_data->device_id, &packet_dimension); 2171 2174 if (rc != EOK) … … 2178 2181 for (index = 0; index < fragments; index++) { 2179 2182 /* Read the data fragment */ 2180 result = tl_socket_read_packet_data(tcp_globals.net_ phone,2183 result = tl_socket_read_packet_data(tcp_globals.net_sess, 2181 2184 &packet, TCP_HEADER_SIZE, packet_dimension, 2182 2185 socket_data->addr, socket_data->addrlen); … … 2241 2244 default: 2242 2245 /* Just destroy */ 2243 rc = socket_destroy(tcp_globals.net_ phone, socket_id,2246 rc = socket_destroy(tcp_globals.net_sess, socket_id, 2244 2247 local_sockets, &tcp_globals.sockets, 2245 2248 tcp_free_socket_data); … … 2289 2292 2290 2293 /* Get the device packet dimension */ 2291 rc = tl_get_ip_packet_dimension(tcp_globals.ip_ phone,2294 rc = tl_get_ip_packet_dimension(tcp_globals.ip_sess, 2292 2295 &tcp_globals.dimensions, socket_data->device_id, &packet_dimension); 2293 2296 if (rc != EOK) … … 2295 2298 2296 2299 /* Get a new packet */ 2297 *packet = packet_get_4_remote(tcp_globals.net_ phone, TCP_HEADER_SIZE,2300 *packet = packet_get_4_remote(tcp_globals.net_sess, TCP_HEADER_SIZE, 2298 2301 packet_dimension->addr_len, packet_dimension->prefix, 2299 2302 packet_dimension->suffix); … … 2358 2361 if (rc != EOK) 2359 2362 return rc; 2360 rc = tl_get_ip_packet_dimension(tcp_globals.ip_ phone,2363 rc = tl_get_ip_packet_dimension(tcp_globals.ip_sess, 2361 2364 &tcp_globals.dimensions, socket_data->device_id, 2362 2365 &packet_dimension); … … 2430 2433 int tcp_release_and_return(packet_t *packet, int result) 2431 2434 { 2432 pq_release_remote(tcp_globals.net_ phone, packet_get_id(packet));2435 pq_release_remote(tcp_globals.net_sess, packet_get_id(packet)); 2433 2436 return result; 2434 2437 } … … 2438 2441 * @param[in] iid Message identifier. 2439 2442 * @param[in,out] icall Message parameters. 2443 * @param[in] arg Local argument. 2440 2444 * 2441 2445 */ 2442 static void tcp_receiver(ipc_callid_t iid, ipc_call_t *icall )2446 static void tcp_receiver(ipc_callid_t iid, ipc_call_t *icall, void *arg) 2443 2447 { 2444 2448 packet_t *packet; … … 2448 2452 switch (IPC_GET_IMETHOD(*icall)) { 2449 2453 case NET_TL_RECEIVED: 2450 rc = packet_translate_remote(tcp_globals.net_ phone, &packet,2454 rc = packet_translate_remote(tcp_globals.net_sess, &packet, 2451 2455 IPC_GET_PACKET(*icall)); 2452 2456 if (rc == EOK) … … 2466 2470 /** Initialize the TCP module. 2467 2471 * 2468 * @param[in] net_phone Network module phone.2472 * @param[in] sess Network module session. 2469 2473 * 2470 2474 * @return EOK on success. … … 2472 2476 * 2473 2477 */ 2474 int tl_initialize( int net_phone)2478 int tl_initialize(async_sess_t *sess) 2475 2479 { 2476 2480 fibril_rwlock_initialize(&tcp_globals.lock); 2477 2481 fibril_rwlock_write_lock(&tcp_globals.lock); 2478 2482 2479 tcp_globals.net_ phone = net_phone;2483 tcp_globals.net_sess = sess; 2480 2484 2481 tcp_globals.icmp_ phone = icmp_connect_module(ICMP_CONNECT_TIMEOUT);2482 tcp_globals.ip_ phone= ip_bind_service(SERVICE_IP, IPPROTO_TCP,2485 tcp_globals.icmp_sess = icmp_connect_module(); 2486 tcp_globals.ip_sess = ip_bind_service(SERVICE_IP, IPPROTO_TCP, 2483 2487 SERVICE_TCP, tcp_receiver); 2484 if (tcp_globals.ip_ phone < 0) {2488 if (tcp_globals.ip_sess == NULL) { 2485 2489 fibril_rwlock_write_unlock(&tcp_globals.lock); 2486 return tcp_globals.ip_phone;2490 return ENOENT; 2487 2491 } 2488 2492
Note:
See TracChangeset
for help on using the changeset viewer.