Changeset 774e6d1a in mainline for uspace/srv
- Timestamp:
- 2011-01-09T23:24:53Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4b86dac
- Parents:
- 3c106e88
- Location:
- uspace/srv/net
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/il/arp/arp.c
r3c106e88 r774e6d1a 457 457 uint8_t *des_proto; 458 458 int rc; 459 459 460 460 length = packet_get_data_length(packet); 461 461 if (length <= sizeof(arp_header_t)) … … 677 677 int 678 678 arp_message_standalone(ipc_callid_t callid, ipc_call_t *call, 679 ipc_call_t *answer, int *answer_count)679 ipc_call_t *answer, size_t *answer_count) 680 680 { 681 681 measured_string_t *address; … … 696 696 return rc; 697 697 698 rc = arp_device_message(IPC_GET_DEVICE( call),699 IPC_GET_SERVICE( call), ARP_GET_NETIF(call), address);698 rc = arp_device_message(IPC_GET_DEVICE(*call), 699 IPC_GET_SERVICE(*call), ARP_GET_NETIF(*call), address); 700 700 if (rc != EOK) { 701 701 free(address); … … 710 710 711 711 fibril_mutex_lock(&arp_globals.lock); 712 rc = arp_translate_message(IPC_GET_DEVICE( call),713 IPC_GET_SERVICE( call), address, &translation);712 rc = arp_translate_message(IPC_GET_DEVICE(*call), 713 IPC_GET_SERVICE(*call), address, &translation); 714 714 free(address); 715 715 free(data); … … 727 727 728 728 case NET_ARP_CLEAR_DEVICE: 729 return arp_clear_device_req(0, IPC_GET_DEVICE( call));729 return arp_clear_device_req(0, IPC_GET_DEVICE(*call)); 730 730 731 731 case NET_ARP_CLEAR_ADDRESS: … … 734 734 return rc; 735 735 736 arp_clear_address_req(0, IPC_GET_DEVICE( call),737 IPC_GET_SERVICE( call), address);736 arp_clear_address_req(0, IPC_GET_DEVICE(*call), 737 IPC_GET_SERVICE(*call), address); 738 738 free(address); 739 739 free(data); … … 750 750 751 751 rc = packet_translate_remote(arp_globals.net_phone, &packet, 752 IPC_GET_PACKET( call));752 IPC_GET_PACKET(*call)); 753 753 if (rc != EOK) 754 754 return rc; … … 757 757 do { 758 758 next = pq_detach(packet); 759 rc = arp_receive_message(IPC_GET_DEVICE( call), packet);759 rc = arp_receive_message(IPC_GET_DEVICE(*call), packet); 760 760 if (rc != 1) { 761 761 pq_release_remote(arp_globals.net_phone, … … 769 769 770 770 case NET_IL_MTU_CHANGED: 771 return arp_mtu_changed_message(IPC_GET_DEVICE( call),772 IPC_GET_MTU( call));771 return arp_mtu_changed_message(IPC_GET_DEVICE(*call), 772 IPC_GET_MTU(*call)); 773 773 } 774 774 … … 791 791 while (true) { 792 792 ipc_call_t answer; 793 int answer_count;793 size_t count; 794 794 795 795 /* Clear the answer structure */ 796 refresh_answer(&answer, & answer_count);796 refresh_answer(&answer, &count); 797 797 798 798 /* Fetch the next message */ … … 802 802 /* Process the message */ 803 803 int res = il_module_message_standalone(callid, &call, &answer, 804 & answer_count);804 &count); 805 805 806 806 /* … … 813 813 814 814 /* Answer the message */ 815 answer_call(callid, res, &answer, answer_count);815 answer_call(callid, res, &answer, count); 816 816 } 817 817 } -
uspace/srv/net/il/arp/arp_module.c
r3c106e88 r774e6d1a 58 58 59 59 int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 60 ipc_call_t *answer, int *answer_count)60 ipc_call_t *answer, size_t *count) 61 61 { 62 return arp_message_standalone(callid, call, answer, answer_count);62 return arp_message_standalone(callid, call, answer, count); 63 63 } 64 64 -
uspace/srv/net/il/arp/arp_module.h
r3c106e88 r774e6d1a 44 44 extern int arp_initialize(async_client_conn_t); 45 45 extern int arp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *, 46 int *);46 size_t *); 47 47 48 48 #endif -
uspace/srv/net/il/ip/ip.c
r3c106e88 r774e6d1a 477 477 ip_globals.gateway.gateway.s_addr = gateway.s_addr; 478 478 ip_globals.gateway.netif = ip_netif; 479 480 char defgateway[INET_ADDRSTRLEN]; 481 inet_ntop(AF_INET, (uint8_t *) &gateway.s_addr, 482 defgateway, INET_ADDRSTRLEN); 483 printf("%s: Default gateway (%s)\n", NAME, defgateway); 479 484 } 480 485 … … 1069 1074 int index; 1070 1075 ip_route_t *route; 1071 1076 1072 1077 if (!netif) 1073 1078 return NULL; 1074 1075 / / start with the first one - the direct route1079 1080 /* Start with the first one (the direct route) */ 1076 1081 for (index = 0; index < ip_routes_count(&netif->routes); index++) { 1077 1082 route = ip_routes_get_index(&netif->routes, index); 1078 if ( route&&1083 if ((route) && 1079 1084 ((route->address.s_addr & route->netmask.s_addr) == 1080 (destination.s_addr & route->netmask.s_addr))) {1085 (destination.s_addr & route->netmask.s_addr))) 1081 1086 return route; 1082 }1083 1087 } 1084 1088 … … 1288 1292 if (device_id > 0) { 1289 1293 netif = ip_netifs_find(&ip_globals.netifs, device_id); 1290 route = ip_netif_find_route(netif, * 1294 route = ip_netif_find_route(netif, *dest); 1291 1295 if (netif && !route && (ip_globals.gateway.netif == netif)) 1292 1296 route = &ip_globals.gateway; … … 1318 1322 } 1319 1323 } 1320 1324 1321 1325 // if the local host is the destination 1322 1326 if ((route->address.s_addr == dest->s_addr) && … … 1562 1566 socklen_t addrlen; 1563 1567 int rc; 1564 1568 1565 1569 header = (ip_header_t *) packet_get_data(packet); 1566 1570 if (!header) … … 1588 1592 return EINVAL; 1589 1593 } 1590 1594 1591 1595 // process ipopt and get destination 1592 1596 dest = ip_get_destination(header); … … 1609 1613 if (rc != EOK) 1610 1614 return rc; 1611 1615 1612 1616 route = ip_find_route(dest); 1613 1617 if (!route) { … … 1886 1890 int 1887 1891 ip_message_standalone(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, 1888 int *answer_count)1892 size_t *answer_count) 1889 1893 { 1890 1894 packet_t *packet; … … 1905 1909 1906 1910 case IPC_M_CONNECT_TO_ME: 1907 return ip_register(IL_GET_PROTO( call), IL_GET_SERVICE(call),1908 IPC_GET_PHONE( call), NULL);1911 return ip_register(IL_GET_PROTO(*call), IL_GET_SERVICE(*call), 1912 IPC_GET_PHONE(*call), NULL); 1909 1913 1910 1914 case NET_IL_DEVICE: 1911 return ip_device_req_local(0, IPC_GET_DEVICE( call),1912 IPC_GET_SERVICE( call));1915 return ip_device_req_local(0, IPC_GET_DEVICE(*call), 1916 IPC_GET_SERVICE(*call)); 1913 1917 1914 1918 case NET_IL_SEND: 1915 1919 rc = packet_translate_remote(ip_globals.net_phone, &packet, 1916 IPC_GET_PACKET( call));1920 IPC_GET_PACKET(*call)); 1917 1921 if (rc != EOK) 1918 1922 return rc; 1919 return ip_send_msg_local(0, IPC_GET_DEVICE( call), packet, 0,1920 IPC_GET_ERROR( call));1923 return ip_send_msg_local(0, IPC_GET_DEVICE(*call), packet, 0, 1924 IPC_GET_ERROR(*call)); 1921 1925 1922 1926 case NET_IL_DEVICE_STATE: 1923 return ip_device_state_message(IPC_GET_DEVICE( call),1924 IPC_GET_STATE( call));1927 return ip_device_state_message(IPC_GET_DEVICE(*call), 1928 IPC_GET_STATE(*call)); 1925 1929 1926 1930 case NET_IL_RECEIVED: 1927 1931 rc = packet_translate_remote(ip_globals.net_phone, &packet, 1928 IPC_GET_PACKET( call));1932 IPC_GET_PACKET(*call)); 1929 1933 if (rc != EOK) 1930 1934 return rc; 1931 return ip_receive_message(IPC_GET_DEVICE( call), packet);1935 return ip_receive_message(IPC_GET_DEVICE(*call), packet); 1932 1936 1933 1937 case NET_IP_RECEIVED_ERROR: 1934 1938 rc = packet_translate_remote(ip_globals.net_phone, &packet, 1935 IPC_GET_PACKET( call));1939 IPC_GET_PACKET(*call)); 1936 1940 if (rc != EOK) 1937 1941 return rc; 1938 return ip_received_error_msg_local(0, IPC_GET_DEVICE( call),1939 packet, IPC_GET_TARGET( call), IPC_GET_ERROR(call));1942 return ip_received_error_msg_local(0, IPC_GET_DEVICE(*call), 1943 packet, IPC_GET_TARGET(*call), IPC_GET_ERROR(*call)); 1940 1944 1941 1945 case NET_IP_ADD_ROUTE: 1942 return ip_add_route_req_local(0, IPC_GET_DEVICE( call),1943 IP_GET_ADDRESS( call), IP_GET_NETMASK(call),1944 IP_GET_GATEWAY( call));1946 return ip_add_route_req_local(0, IPC_GET_DEVICE(*call), 1947 IP_GET_ADDRESS(*call), IP_GET_NETMASK(*call), 1948 IP_GET_GATEWAY(*call)); 1945 1949 1946 1950 case NET_IP_SET_GATEWAY: 1947 return ip_set_gateway_req_local(0, IPC_GET_DEVICE( call),1948 IP_GET_GATEWAY( call));1951 return ip_set_gateway_req_local(0, IPC_GET_DEVICE(*call), 1952 IP_GET_GATEWAY(*call)); 1949 1953 1950 1954 case NET_IP_GET_ROUTE: … … 1954 1958 return rc; 1955 1959 1956 rc = ip_get_route_req_local(0, IP_GET_PROTOCOL( call), addr,1960 rc = ip_get_route_req_local(0, IP_GET_PROTOCOL(*call), addr, 1957 1961 (socklen_t) addrlen, &device_id, &header, &headerlen); 1958 1962 if (rc != EOK) 1959 1963 return rc; 1960 1964 1961 IPC_SET_DEVICE( answer, device_id);1962 IP_SET_HEADERLEN( answer, headerlen);1965 IPC_SET_DEVICE(*answer, device_id); 1966 IP_SET_HEADERLEN(*answer, headerlen); 1963 1967 1964 1968 *answer_count = 2; … … 1972 1976 1973 1977 case NET_IL_PACKET_SPACE: 1974 rc = ip_packet_size_message(IPC_GET_DEVICE( call), &addrlen,1978 rc = ip_packet_size_message(IPC_GET_DEVICE(*call), &addrlen, 1975 1979 &prefix, &content, &suffix); 1976 1980 if (rc != EOK) 1977 1981 return rc; 1978 1982 1979 IPC_SET_ADDR( answer, addrlen);1980 IPC_SET_PREFIX( answer, prefix);1981 IPC_SET_CONTENT( answer, content);1982 IPC_SET_SUFFIX( answer, suffix);1983 IPC_SET_ADDR(*answer, addrlen); 1984 IPC_SET_PREFIX(*answer, prefix); 1985 IPC_SET_CONTENT(*answer, content); 1986 IPC_SET_SUFFIX(*answer, suffix); 1983 1987 *answer_count = 4; 1984 1988 return EOK; 1985 1989 1986 1990 case NET_IL_MTU_CHANGED: 1987 return ip_mtu_changed_message(IPC_GET_DEVICE( call),1988 IPC_GET_MTU( call));1991 return ip_mtu_changed_message(IPC_GET_DEVICE(*call), 1992 IPC_GET_MTU(*call)); 1989 1993 } 1990 1994 … … 2007 2011 while (true) { 2008 2012 ipc_call_t answer; 2009 int answer_count;2013 size_t count; 2010 2014 2011 2015 /* Clear the answer structure */ 2012 refresh_answer(&answer, & answer_count);2016 refresh_answer(&answer, &count); 2013 2017 2014 2018 /* Fetch the next message */ … … 2018 2022 /* Process the message */ 2019 2023 int res = il_module_message_standalone(callid, &call, &answer, 2020 & answer_count);2024 &count); 2021 2025 2022 2026 /* … … 2030 2034 2031 2035 /* Answer the message */ 2032 answer_call(callid, res, &answer, answer_count);2036 answer_call(callid, res, &answer, count); 2033 2037 } 2034 2038 } -
uspace/srv/net/il/ip/ip_module.c
r3c106e88 r774e6d1a 59 59 int 60 60 il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 61 ipc_call_t *answer, int *answer_count)61 ipc_call_t *answer, size_t *count) 62 62 { 63 return ip_message_standalone(callid, call, answer, answer_count);63 return ip_message_standalone(callid, call, answer, count); 64 64 } 65 65 -
uspace/srv/net/il/ip/ip_module.h
r3c106e88 r774e6d1a 43 43 extern int ip_initialize(async_client_conn_t); 44 44 extern int ip_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *, 45 int *);45 size_t *); 46 46 47 47 #endif -
uspace/srv/net/net/net.c
r3c106e88 r774e6d1a 474 474 475 475 setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_IO, 0); 476 int io = setting ? strtol((char *) setting->value, NULL, 16) : 0;477 478 rc = netif_probe_req _remote(netif->driver->phone, netif->id, irq,io);476 uintptr_t io = setting ? strtol((char *) setting->value, NULL, 16) : 0; 477 478 rc = netif_probe_req(netif->driver->phone, netif->id, irq, (void *) io); 479 479 if (rc != EOK) 480 480 return rc; … … 511 511 } 512 512 513 return netif_start_req _remote(netif->driver->phone, netif->id);513 return netif_start_req(netif->driver->phone, netif->id); 514 514 } 515 515 … … 613 613 /** Process the networking message. 614 614 * 615 * @param[in] callidThe message identifier.616 * @param[in] callThe message parameters.615 * @param[in] callid The message identifier. 616 * @param[in] call The message parameters. 617 617 * @param[out] answer The message answer parameters. 618 618 * @param[out] answer_count The last parameter for the actual answer … … 627 627 */ 628 628 int net_message(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, 629 int *answer_count)629 size_t *answer_count) 630 630 { 631 631 measured_string_t *strings; … … 639 639 case NET_NET_GET_DEVICE_CONF: 640 640 rc = measured_strings_receive(&strings, &data, 641 IPC_GET_COUNT( call));641 IPC_GET_COUNT(*call)); 642 642 if (rc != EOK) 643 643 return rc; 644 net_get_device_conf_req(0, IPC_GET_DEVICE( call), &strings,645 IPC_GET_COUNT( call), NULL);644 net_get_device_conf_req(0, IPC_GET_DEVICE(*call), &strings, 645 IPC_GET_COUNT(*call), NULL); 646 646 647 647 /* Strings should not contain received data anymore */ 648 648 free(data); 649 649 650 rc = measured_strings_reply(strings, IPC_GET_COUNT( call));650 rc = measured_strings_reply(strings, IPC_GET_COUNT(*call)); 651 651 free(strings); 652 652 return rc; 653 653 case NET_NET_GET_CONF: 654 654 rc = measured_strings_receive(&strings, &data, 655 IPC_GET_COUNT( call));655 IPC_GET_COUNT(*call)); 656 656 if (rc != EOK) 657 657 return rc; 658 net_get_conf_req(0, &strings, IPC_GET_COUNT( call), NULL);658 net_get_conf_req(0, &strings, IPC_GET_COUNT(*call), NULL); 659 659 660 660 /* Strings should not contain received data anymore */ 661 661 free(data); 662 662 663 rc = measured_strings_reply(strings, IPC_GET_COUNT( call));663 rc = measured_strings_reply(strings, IPC_GET_COUNT(*call)); 664 664 free(strings); 665 665 return rc; … … 688 688 /* Clear the answer structure */ 689 689 ipc_call_t answer; 690 int answer_count;690 size_t answer_count; 691 691 refresh_answer(&answer, &answer_count); 692 692 -
uspace/srv/net/net/net.h
r3c106e88 r774e6d1a 135 135 extern int add_configuration(measured_strings_t *, const uint8_t *, 136 136 const uint8_t *); 137 extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);137 extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, size_t *); 138 138 extern int net_initialize_build(async_client_conn_t); 139 extern int net_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);139 extern int net_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, size_t *); 140 140 141 141 #endif -
uspace/srv/net/net/net_standalone.c
r3c106e88 r774e6d1a 100 100 */ 101 101 int net_module_message(ipc_callid_t callid, ipc_call_t *call, 102 ipc_call_t *answer, int *answer_count)102 ipc_call_t *answer, size_t *count) 103 103 { 104 if (IS_NET_PACKET_MESSAGE( call))105 return packet_server_message(callid, call, answer, answer_count);104 if (IS_NET_PACKET_MESSAGE(*call)) 105 return packet_server_message(callid, call, answer, count); 106 106 107 return net_message(callid, call, answer, answer_count);107 return net_message(callid, call, answer, count); 108 108 } 109 109 -
uspace/srv/net/netif/lo/lo.c
r3c106e88 r774e6d1a 49 49 #include <net/device.h> 50 50 #include <nil_interface.h> 51 #include <netif_interface.h> 52 #include <netif_local.h> 51 #include <netif_skel.h> 53 52 54 53 /** Default hardware address. */ … … 65 64 66 65 int netif_specific_message(ipc_callid_t callid, ipc_call_t *call, 67 ipc_call_t *answer, int *answer_count)66 ipc_call_t *answer, size_t *count) 68 67 { 69 68 return ENOTSUP; … … 172 171 } 173 172 174 int netif_probe_message(device_id_t device_id, int irq, uintptr_tio)173 int netif_probe_message(device_id_t device_id, int irq, void *io) 175 174 { 176 175 netif_device_t *device; … … 233 232 } 234 233 235 /** Default thread for new connections.236 *237 * @param[in] iid The initial message identifier.238 * @param[in] icall The initial message call structure.239 */240 static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)241 {242 /*243 * Accept the connection244 * - Answer the first IPC_M_CONNECT_ME_TO call.245 */246 ipc_answer_0(iid, EOK);247 248 while (true) {249 ipc_call_t answer;250 int answer_count;251 252 /* Clear the answer structure */253 refresh_answer(&answer, &answer_count);254 255 /* Fetch the next message */256 ipc_call_t call;257 ipc_callid_t callid = async_get_call(&call);258 259 /* Process the message */260 int res = netif_module_message(NAME, callid, &call, &answer,261 &answer_count);262 263 /*264 * End if told to either by the message or the processing265 * result.266 */267 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||268 (res == EHANGUP))269 return;270 271 /* Answer the message */272 answer_call(callid, res, &answer, answer_count);273 }274 }275 276 234 int main(int argc, char *argv[]) 277 235 { 278 int rc;279 280 236 /* Start the module */ 281 rc = netif_module_start(netif_client_connection); 282 return rc; 237 return netif_module_start(); 283 238 } 284 239 -
uspace/srv/net/nil/eth/eth.c
r3c106e88 r774e6d1a 54 54 #include <protocol_map.h> 55 55 #include <net/device.h> 56 #include <netif_ interface.h>56 #include <netif_remote.h> 57 57 #include <net_interface.h> 58 58 #include <nil_interface.h> … … 239 239 switch (IPC_GET_IMETHOD(*icall)) { 240 240 case NET_NIL_DEVICE_STATE: 241 nil_device_state_msg_local(0, IPC_GET_DEVICE( icall),242 IPC_GET_STATE( icall));241 nil_device_state_msg_local(0, IPC_GET_DEVICE(*icall), 242 IPC_GET_STATE(*icall)); 243 243 ipc_answer_0(iid, EOK); 244 244 break; 245 245 case NET_NIL_RECEIVED: 246 246 rc = packet_translate_remote(eth_globals.net_phone, 247 &packet, IPC_GET_PACKET( icall));247 &packet, IPC_GET_PACKET(*icall)); 248 248 if (rc == EOK) { 249 249 rc = nil_received_msg_local(0, 250 IPC_GET_DEVICE( icall), packet, 0);250 IPC_GET_DEVICE(*icall), packet, 0); 251 251 } 252 252 ipc_answer_0(iid, (sysarg_t) rc); … … 837 837 838 838 int nil_message_standalone(const char *name, ipc_callid_t callid, 839 ipc_call_t *call, ipc_call_t *answer, int *answer_count)839 ipc_call_t *call, ipc_call_t *answer, size_t *answer_count) 840 840 { 841 841 measured_string_t *address; … … 853 853 854 854 case NET_NIL_DEVICE: 855 return eth_device_message(IPC_GET_DEVICE( call),856 IPC_GET_SERVICE( call), IPC_GET_MTU(call));855 return eth_device_message(IPC_GET_DEVICE(*call), 856 IPC_GET_SERVICE(*call), IPC_GET_MTU(*call)); 857 857 case NET_NIL_SEND: 858 858 rc = packet_translate_remote(eth_globals.net_phone, &packet, 859 IPC_GET_PACKET( call));859 IPC_GET_PACKET(*call)); 860 860 if (rc != EOK) 861 861 return rc; 862 return eth_send_message(IPC_GET_DEVICE( call), packet,863 IPC_GET_SERVICE( call));862 return eth_send_message(IPC_GET_DEVICE(*call), packet, 863 IPC_GET_SERVICE(*call)); 864 864 case NET_NIL_PACKET_SPACE: 865 rc = eth_packet_space_message(IPC_GET_DEVICE( call), &addrlen,865 rc = eth_packet_space_message(IPC_GET_DEVICE(*call), &addrlen, 866 866 &prefix, &content, &suffix); 867 867 if (rc != EOK) 868 868 return rc; 869 IPC_SET_ADDR( answer, addrlen);870 IPC_SET_PREFIX( answer, prefix);871 IPC_SET_CONTENT( answer, content);872 IPC_SET_SUFFIX( answer, suffix);869 IPC_SET_ADDR(*answer, addrlen); 870 IPC_SET_PREFIX(*answer, prefix); 871 IPC_SET_CONTENT(*answer, content); 872 IPC_SET_SUFFIX(*answer, suffix); 873 873 *answer_count = 4; 874 874 return EOK; 875 875 case NET_NIL_ADDR: 876 rc = eth_addr_message(IPC_GET_DEVICE( call), ETH_LOCAL_ADDR,876 rc = eth_addr_message(IPC_GET_DEVICE(*call), ETH_LOCAL_ADDR, 877 877 &address); 878 878 if (rc != EOK) … … 880 880 return measured_strings_reply(address, 1); 881 881 case NET_NIL_BROADCAST_ADDR: 882 rc = eth_addr_message(IPC_GET_DEVICE( call), ETH_BROADCAST_ADDR,882 rc = eth_addr_message(IPC_GET_DEVICE(*call), ETH_BROADCAST_ADDR, 883 883 &address); 884 884 if (rc != EOK) … … 886 886 return measured_strings_reply(address, 1); 887 887 case IPC_M_CONNECT_TO_ME: 888 return eth_register_message(NIL_GET_PROTO( call),889 IPC_GET_PHONE( call));888 return eth_register_message(NIL_GET_PROTO(*call), 889 IPC_GET_PHONE(*call)); 890 890 } 891 891 … … 908 908 while (true) { 909 909 ipc_call_t answer; 910 int answer_count;910 size_t count; 911 911 912 912 /* Clear the answer structure */ 913 refresh_answer(&answer, & answer_count);913 refresh_answer(&answer, &count); 914 914 915 915 /* Fetch the next message */ … … 919 919 /* Process the message */ 920 920 int res = nil_module_message_standalone(NAME, callid, &call, 921 &answer, & answer_count);921 &answer, &count); 922 922 923 923 /* … … 930 930 931 931 /* Answer the message */ 932 answer_call(callid, res, &answer, answer_count);932 answer_call(callid, res, &answer, count); 933 933 } 934 934 } -
uspace/srv/net/nil/eth/eth_header.h
r3c106e88 r774e6d1a 42 42 43 43 /** Ethernet address length. */ 44 #define ETH_ADDR 44 #define ETH_ADDR 6 45 45 46 46 /** Ethernet header preamble value. */ 47 #define ETH_PREAMBLE 47 #define ETH_PREAMBLE 0x55 48 48 49 49 /** Ethernet header start of frame value. */ 50 #define ETH_SFD 50 #define ETH_SFD 0xD5 51 51 52 52 /** IEEE 802.2 unordered information control field. */ 53 #define IEEE_8023_2_UI 53 #define IEEE_8023_2_UI 0x03 54 54 55 55 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. -
uspace/srv/net/nil/eth/eth_module.c
r3c106e88 r774e6d1a 78 78 79 79 int nil_module_message_standalone(const char *name, ipc_callid_t callid, 80 ipc_call_t *call, ipc_call_t *answer, int *answer_count)80 ipc_call_t *call, ipc_call_t *answer, size_t *count) 81 81 { 82 return nil_message_standalone(name, callid, call, answer, answer_count);82 return nil_message_standalone(name, callid, call, answer, count); 83 83 } 84 84 -
uspace/srv/net/nil/nildummy/nildummy.c
r3c106e88 r774e6d1a 47 47 #include <net/modules.h> 48 48 #include <net/device.h> 49 #include <netif_interface.h>50 49 #include <nil_interface.h> 51 50 #include <il_interface.h> … … 53 52 #include <net/packet.h> 54 53 #include <packet_remote.h> 54 #include <netif_remote.h> 55 55 #include <nil_local.h> 56 56 … … 113 113 case NET_NIL_DEVICE_STATE: 114 114 rc = nil_device_state_msg_local(0, 115 IPC_GET_DEVICE( icall), IPC_GET_STATE(icall));115 IPC_GET_DEVICE(*icall), IPC_GET_STATE(*icall)); 116 116 ipc_answer_0(iid, (sysarg_t) rc); 117 117 break; … … 119 119 case NET_NIL_RECEIVED: 120 120 rc = packet_translate_remote(nildummy_globals.net_phone, 121 &packet, IPC_GET_PACKET( icall));121 &packet, IPC_GET_PACKET(*icall)); 122 122 if (rc == EOK) { 123 123 rc = nil_received_msg_local(0, 124 IPC_GET_DEVICE( icall), packet, 0);124 IPC_GET_DEVICE(*icall), packet, 0); 125 125 } 126 126 ipc_answer_0(iid, (sysarg_t) rc); … … 375 375 376 376 int nil_message_standalone(const char *name, ipc_callid_t callid, 377 ipc_call_t *call, ipc_call_t *answer, int *answer_count)377 ipc_call_t *call, ipc_call_t *answer, size_t *answer_count) 378 378 { 379 379 measured_string_t *address; … … 391 391 392 392 case NET_NIL_DEVICE: 393 return nildummy_device_message(IPC_GET_DEVICE( call),394 IPC_GET_SERVICE( call), IPC_GET_MTU(call));393 return nildummy_device_message(IPC_GET_DEVICE(*call), 394 IPC_GET_SERVICE(*call), IPC_GET_MTU(*call)); 395 395 396 396 case NET_NIL_SEND: 397 397 rc = packet_translate_remote(nildummy_globals.net_phone, 398 &packet, IPC_GET_PACKET( call));398 &packet, IPC_GET_PACKET(*call)); 399 399 if (rc != EOK) 400 400 return rc; 401 return nildummy_send_message(IPC_GET_DEVICE( call), packet,402 IPC_GET_SERVICE( call));401 return nildummy_send_message(IPC_GET_DEVICE(*call), packet, 402 IPC_GET_SERVICE(*call)); 403 403 404 404 case NET_NIL_PACKET_SPACE: 405 rc = nildummy_packet_space_message(IPC_GET_DEVICE( call),405 rc = nildummy_packet_space_message(IPC_GET_DEVICE(*call), 406 406 &addrlen, &prefix, &content, &suffix); 407 407 if (rc != EOK) 408 408 return rc; 409 IPC_SET_ADDR( answer, addrlen);410 IPC_SET_PREFIX( answer, prefix);411 IPC_SET_CONTENT( answer, content);412 IPC_SET_SUFFIX( answer, suffix);409 IPC_SET_ADDR(*answer, addrlen); 410 IPC_SET_PREFIX(*answer, prefix); 411 IPC_SET_CONTENT(*answer, content); 412 IPC_SET_SUFFIX(*answer, suffix); 413 413 *answer_count = 4; 414 414 return EOK; 415 415 416 416 case NET_NIL_ADDR: 417 rc = nildummy_addr_message(IPC_GET_DEVICE( call), &address);417 rc = nildummy_addr_message(IPC_GET_DEVICE(*call), &address); 418 418 if (rc != EOK) 419 419 return rc; … … 421 421 422 422 case NET_NIL_BROADCAST_ADDR: 423 rc = nildummy_addr_message(IPC_GET_DEVICE( call), &address);423 rc = nildummy_addr_message(IPC_GET_DEVICE(*call), &address); 424 424 if (rc != EOK) 425 425 return rc; … … 427 427 428 428 case IPC_M_CONNECT_TO_ME: 429 return nildummy_register_message(NIL_GET_PROTO( call),430 IPC_GET_PHONE( call));429 return nildummy_register_message(NIL_GET_PROTO(*call), 430 IPC_GET_PHONE(*call)); 431 431 } 432 432 … … 449 449 while (true) { 450 450 ipc_call_t answer; 451 int answer_count;451 size_t count; 452 452 453 453 /* Clear the answer structure */ 454 refresh_answer(&answer, & answer_count);454 refresh_answer(&answer, &count); 455 455 456 456 /* Fetch the next message */ … … 460 460 /* Process the message */ 461 461 int res = nil_module_message_standalone(NAME, callid, &call, 462 &answer, & answer_count);462 &answer, &count); 463 463 464 464 /* … … 471 471 472 472 /* Answer the message */ 473 answer_call(callid, res, &answer, answer_count);473 answer_call(callid, res, &answer, count); 474 474 } 475 475 } -
uspace/srv/net/nil/nildummy/nildummy_module.c
r3c106e88 r774e6d1a 79 79 80 80 int nil_module_message_standalone(const char *name, ipc_callid_t callid, 81 ipc_call_t *call, ipc_call_t *answer, int *answer_count)81 ipc_call_t *call, ipc_call_t *answer, size_t *count) 82 82 { 83 return nil_message_standalone(name, callid, call, answer, answer_count);83 return nil_message_standalone(name, callid, call, answer, count); 84 84 } 85 85 -
uspace/srv/net/tl/icmp/icmp.c
r3c106e88 r774e6d1a 696 696 case NET_ICMP_DEST_UNREACH: 697 697 rc = packet_translate_remote(icmp_globals.net_phone, &packet, 698 IPC_GET_PACKET( call));698 IPC_GET_PACKET(*call)); 699 699 if (rc != EOK) 700 700 return rc; 701 701 return icmp_destination_unreachable_msg_local(0, 702 ICMP_GET_CODE( call), ICMP_GET_MTU(call), packet);702 ICMP_GET_CODE(*call), ICMP_GET_MTU(*call), packet); 703 703 case NET_ICMP_SOURCE_QUENCH: 704 704 rc = packet_translate_remote(icmp_globals.net_phone, &packet, 705 IPC_GET_PACKET( call));705 IPC_GET_PACKET(*call)); 706 706 if (rc != EOK) 707 707 return rc; … … 709 709 case NET_ICMP_TIME_EXCEEDED: 710 710 rc = packet_translate_remote(icmp_globals.net_phone, &packet, 711 IPC_GET_PACKET( call));711 IPC_GET_PACKET(*call)); 712 712 if (rc != EOK) 713 713 return rc; 714 return icmp_time_exceeded_msg_local(0, ICMP_GET_CODE( call),714 return icmp_time_exceeded_msg_local(0, ICMP_GET_CODE(*call), 715 715 packet); 716 716 case NET_ICMP_PARAMETERPROB: 717 717 rc = packet_translate_remote(icmp_globals.net_phone, &packet, 718 IPC_GET_PACKET( call));718 IPC_GET_PACKET(*call)); 719 719 if (rc != EOK) 720 720 return rc; 721 return icmp_parameter_problem_msg_local(0, ICMP_GET_CODE( call),722 ICMP_GET_POINTER( call), packet);721 return icmp_parameter_problem_msg_local(0, ICMP_GET_CODE(*call), 722 ICMP_GET_POINTER(*call), packet); 723 723 default: 724 724 return ENOTSUP; … … 787 787 bool keep_on_going = true; 788 788 ipc_call_t answer; 789 int answer_count;789 size_t answer_count; 790 790 size_t length; 791 791 struct sockaddr *addr; … … 894 894 */ 895 895 int icmp_message_standalone(ipc_callid_t callid, ipc_call_t *call, 896 ipc_call_t *answer, int *answer_count)896 ipc_call_t *answer, size_t *answer_count) 897 897 { 898 898 packet_t *packet; … … 903 903 case NET_TL_RECEIVED: 904 904 rc = packet_translate_remote(icmp_globals.net_phone, &packet, 905 IPC_GET_PACKET( call));905 IPC_GET_PACKET(*call)); 906 906 if (rc != EOK) 907 907 return rc; 908 return icmp_received_msg_local(IPC_GET_DEVICE( call), packet,909 SERVICE_ICMP, IPC_GET_ERROR( call));908 return icmp_received_msg_local(IPC_GET_DEVICE(*call), packet, 909 SERVICE_ICMP, IPC_GET_ERROR(*call)); 910 910 911 911 case NET_ICMP_INIT: 912 return icmp_process_client_messages(callid, * 912 return icmp_process_client_messages(callid, *call); 913 913 914 914 default: … … 936 936 while (true) { 937 937 ipc_call_t answer; 938 int answer_count;938 size_t answer_count; 939 939 940 940 /* Clear the answer structure */ -
uspace/srv/net/tl/icmp/icmp_module.c
r3c106e88 r774e6d1a 86 86 87 87 int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 88 ipc_call_t *answer, int *answer_count)88 ipc_call_t *answer, size_t *count) 89 89 { 90 return icmp_message_standalone(callid, call, answer, answer_count);90 return icmp_message_standalone(callid, call, answer, count); 91 91 } 92 92 -
uspace/srv/net/tl/icmp/icmp_module.h
r3c106e88 r774e6d1a 44 44 extern int icmp_initialize(async_client_conn_t); 45 45 extern int icmp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *, 46 int *);46 size_t *); 47 47 48 48 #endif -
uspace/srv/net/tl/tcp/tcp.c
r3c106e88 r774e6d1a 1262 1262 int 1263 1263 tcp_message_standalone(ipc_callid_t callid, ipc_call_t *call, 1264 ipc_call_t *answer, int *answer_count)1264 ipc_call_t *answer, size_t *answer_count) 1265 1265 { 1266 1266 packet_t *packet; … … 1276 1276 // fibril_rwlock_read_lock(&tcp_globals.lock); 1277 1277 rc = packet_translate_remote(tcp_globals.net_phone, &packet, 1278 IPC_GET_PACKET( call));1278 IPC_GET_PACKET(*call)); 1279 1279 if (rc != EOK) { 1280 1280 // fibril_rwlock_read_unlock(&tcp_globals.lock); 1281 1281 return rc; 1282 1282 } 1283 rc = tcp_received_msg(IPC_GET_DEVICE( call), packet, SERVICE_TCP,1284 IPC_GET_ERROR( call));1283 rc = tcp_received_msg(IPC_GET_DEVICE(*call), packet, SERVICE_TCP, 1284 IPC_GET_ERROR(*call)); 1285 1285 // fibril_rwlock_read_unlock(&tcp_globals.lock); 1286 1286 return rc; … … 1323 1323 bool keep_on_going = true; 1324 1324 socket_cores_t local_sockets; 1325 int app_phone = IPC_GET_PHONE( &call);1325 int app_phone = IPC_GET_PHONE(call); 1326 1326 struct sockaddr *addr; 1327 1327 int socket_id; … … 1330 1330 fibril_rwlock_t lock; 1331 1331 ipc_call_t answer; 1332 int answer_count;1332 size_t answer_count; 1333 1333 tcp_socket_data_t *socket_data; 1334 1334 socket_core_t *socket; … … 2502 2502 while (true) { 2503 2503 ipc_call_t answer; 2504 int answer_count;2504 size_t answer_count; 2505 2505 2506 2506 /* Clear the answer structure */ -
uspace/srv/net/tl/tcp/tcp_module.c
r3c106e88 r774e6d1a 87 87 88 88 int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 89 ipc_call_t *answer, int *answer_count)89 ipc_call_t *answer, size_t *count) 90 90 { 91 return tcp_message_standalone(callid, call, answer, answer_count);91 return tcp_message_standalone(callid, call, answer, count); 92 92 } 93 93 -
uspace/srv/net/tl/tcp/tcp_module.h
r3c106e88 r774e6d1a 44 44 extern int tcp_initialize(async_client_conn_t); 45 45 extern int tcp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *, 46 int *);46 size_t *); 47 47 48 48 #endif -
uspace/srv/net/tl/udp/udp.c
r3c106e88 r774e6d1a 707 707 bool keep_on_going = true; 708 708 socket_cores_t local_sockets; 709 int app_phone = IPC_GET_PHONE( &call);709 int app_phone = IPC_GET_PHONE(call); 710 710 struct sockaddr *addr; 711 711 int socket_id; … … 713 713 size_t size; 714 714 ipc_call_t answer; 715 int answer_count;715 size_t answer_count; 716 716 packet_dimension_t *packet_dimension; 717 717 … … 861 861 */ 862 862 int udp_message_standalone(ipc_callid_t callid, ipc_call_t *call, 863 ipc_call_t *answer, int *answer_count)863 ipc_call_t *answer, size_t *answer_count) 864 864 { 865 865 packet_t *packet; … … 871 871 case NET_TL_RECEIVED: 872 872 rc = packet_translate_remote(udp_globals.net_phone, &packet, 873 IPC_GET_PACKET( call));873 IPC_GET_PACKET(*call)); 874 874 if (rc != EOK) 875 875 return rc; 876 return udp_received_msg(IPC_GET_DEVICE( call), packet,877 SERVICE_UDP, IPC_GET_ERROR( call));876 return udp_received_msg(IPC_GET_DEVICE(*call), packet, 877 SERVICE_UDP, IPC_GET_ERROR(*call)); 878 878 case IPC_M_CONNECT_TO_ME: 879 return udp_process_client_messages(callid, * 879 return udp_process_client_messages(callid, *call); 880 880 } 881 881 … … 898 898 while (true) { 899 899 ipc_call_t answer; 900 int answer_count;900 size_t answer_count; 901 901 902 902 /* Clear the answer structure */ -
uspace/srv/net/tl/udp/udp_module.c
r3c106e88 r774e6d1a 87 87 88 88 int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 89 ipc_call_t *answer, int *answer_count)89 ipc_call_t *answer, size_t *count) 90 90 { 91 return udp_message_standalone(callid, call, answer, answer_count);91 return udp_message_standalone(callid, call, answer, count); 92 92 } 93 93 -
uspace/srv/net/tl/udp/udp_module.h
r3c106e88 r774e6d1a 44 44 extern int udp_initialize(async_client_conn_t); 45 45 extern int udp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *, 46 int *);46 size_t *); 47 47 48 48 #endif
Note:
See TracChangeset
for help on using the changeset viewer.