Changeset 6610565b in mainline for uspace/srv/net
- Timestamp:
- 2011-01-10T16:20:56Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1ffa73b, 8048c648, 8426912a, 977fcea, f401312
- Parents:
- a97ea0f (diff), 4a5c6c1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/srv/net
- Files:
-
- 28 edited
-
cfg/ne2k (modified) (1 diff)
-
il/arp/arp.c (modified) (16 diffs)
-
il/arp/arp.h (modified) (3 diffs)
-
il/arp/arp_module.c (modified) (1 diff)
-
il/arp/arp_module.h (modified) (1 diff)
-
il/ip/ip.c (modified) (23 diffs)
-
il/ip/ip_module.c (modified) (1 diff)
-
il/ip/ip_module.h (modified) (1 diff)
-
net/net.c (modified) (25 diffs)
-
net/net.h (modified) (2 diffs)
-
net/net_standalone.c (modified) (2 diffs)
-
netif/lo/lo.c (modified) (5 diffs)
-
nil/eth/eth.c (modified) (14 diffs)
-
nil/eth/eth.h (modified) (1 diff)
-
nil/eth/eth_header.h (modified) (1 diff)
-
nil/eth/eth_module.c (modified) (1 diff)
-
nil/nildummy/nildummy.c (modified) (11 diffs)
-
nil/nildummy/nildummy.h (modified) (1 diff)
-
nil/nildummy/nildummy_module.c (modified) (1 diff)
-
tl/icmp/icmp.c (modified) (8 diffs)
-
tl/icmp/icmp_module.c (modified) (1 diff)
-
tl/icmp/icmp_module.h (modified) (1 diff)
-
tl/tcp/tcp.c (modified) (10 diffs)
-
tl/tcp/tcp_module.c (modified) (1 diff)
-
tl/tcp/tcp_module.h (modified) (1 diff)
-
tl/udp/udp.c (modified) (8 diffs)
-
tl/udp/udp_module.c (modified) (1 diff)
-
tl/udp/udp_module.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/cfg/ne2k
ra97ea0f r6610565b 22 22 ARP=arp 23 23 24 MTU=1 49224 MTU=1500 -
uspace/srv/net/il/arp/arp.c
ra97ea0f r6610565b 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)) … … 482 482 des_hw = src_proto + header->protocol_length; 483 483 des_proto = des_hw + header->hardware_length; 484 trans = arp_addr_find(&proto->addresses, (char *)src_proto,484 trans = arp_addr_find(&proto->addresses, src_proto, 485 485 header->protocol_length); 486 486 /* Exists? */ … … 493 493 if (proto->addr->length != header->protocol_length) 494 494 return EINVAL; 495 if (!str_lcmp(proto->addr->value, (char *) des_proto,496 proto->addr->length)) {495 496 if (!bcmp(proto->addr->value, des_proto, proto->addr->length)) { 497 497 /* Not already updated? */ 498 498 if (!trans) { … … 502 502 trans->hw_addr = NULL; 503 503 fibril_condvar_initialize(&trans->cv); 504 rc = arp_addr_add(&proto->addresses, (char *)src_proto,504 rc = arp_addr_add(&proto->addresses, src_proto, 505 505 header->protocol_length, trans); 506 506 if (rc != EOK) { … … 510 510 } 511 511 if (!trans->hw_addr) { 512 trans->hw_addr = measured_string_create_bulk( 513 (char *) src_hw,header->hardware_length);512 trans->hw_addr = measured_string_create_bulk(src_hw, 513 header->hardware_length); 514 514 if (!trans->hw_addr) 515 515 return ENOMEM; 516 516 517 517 /* Notify the fibrils that wait for the translation. */ 518 518 fibril_condvar_broadcast(&trans->cv); … … 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; 682 682 measured_string_t *translation; 683 char*data;683 uint8_t *data; 684 684 packet_t *packet; 685 685 packet_t *next; … … 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); … … 748 748 749 749 case NET_IL_RECEIVED: 750 750 751 rc = packet_translate_remote(arp_globals.net_phone, &packet, 751 IPC_GET_PACKET( call));752 IPC_GET_PACKET(*call)); 752 753 if (rc != EOK) 753 754 return rc; … … 756 757 do { 757 758 next = pq_detach(packet); 758 rc = arp_receive_message(IPC_GET_DEVICE( call), packet);759 rc = arp_receive_message(IPC_GET_DEVICE(*call), packet); 759 760 if (rc != 1) { 760 761 pq_release_remote(arp_globals.net_phone, … … 768 769 769 770 case NET_IL_MTU_CHANGED: 770 return arp_mtu_changed_message(IPC_GET_DEVICE( call),771 IPC_GET_MTU( call));771 return arp_mtu_changed_message(IPC_GET_DEVICE(*call), 772 IPC_GET_MTU(*call)); 772 773 } 773 774 … … 790 791 while (true) { 791 792 ipc_call_t answer; 792 int answer_count;793 size_t count; 793 794 794 795 /* Clear the answer structure */ 795 refresh_answer(&answer, & answer_count);796 refresh_answer(&answer, &count); 796 797 797 798 /* Fetch the next message */ … … 801 802 /* Process the message */ 802 803 int res = il_module_message_standalone(callid, &call, &answer, 803 & answer_count);804 &count); 804 805 805 806 /* … … 812 813 813 814 /* Answer the message */ 814 answer_call(callid, res, &answer, answer_count);815 answer_call(callid, res, &answer, count); 815 816 } 816 817 } -
uspace/srv/net/il/arp/arp.h
ra97ea0f r6610565b 96 96 measured_string_t *addr; 97 97 /** Actual device hardware address data. */ 98 char*addr_data;98 uint8_t *addr_data; 99 99 /** Broadcast device hardware address. */ 100 100 measured_string_t *broadcast_addr; 101 101 /** Broadcast device hardware address data. */ 102 char*broadcast_data;102 uint8_t *broadcast_data; 103 103 /** Device identifier. */ 104 104 device_id_t device_id; … … 142 142 measured_string_t *addr; 143 143 /** Actual device protocol address data. */ 144 char*addr_data;144 uint8_t *addr_data; 145 145 /** Address map. */ 146 146 arp_addr_t addresses; … … 154 154 * Hardware address for the translation. NULL denotes an incomplete 155 155 * record with possible waiters. 156 */ 156 */ 157 157 measured_string_t *hw_addr; 158 158 /** Condition variable used for waiting for completion of the record. */ -
uspace/srv/net/il/arp/arp_module.c
ra97ea0f r6610565b 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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 275 275 if (rc != EOK) 276 276 goto out; 277 rc = add_module(NULL, &ip_globals.modules, ARP_NAME, ARP_FILENAME,278 SERVICE_ARP, 0, arp_connect_module);277 rc = add_module(NULL, &ip_globals.modules, (uint8_t *) ARP_NAME, 278 (uint8_t *) ARP_FILENAME, SERVICE_ARP, 0, arp_connect_module); 279 279 280 280 out: … … 312 312 measured_string_t names[] = { 313 313 { 314 ( char*) "IPV",314 (uint8_t *) "IPV", 315 315 3 316 316 }, 317 317 { 318 ( char*) "IP_CONFIG",318 (uint8_t *) "IP_CONFIG", 319 319 9 320 320 }, 321 321 { 322 ( char*) "IP_ADDR",322 (uint8_t *) "IP_ADDR", 323 323 7 324 324 }, 325 325 { 326 ( char*) "IP_NETMASK",326 (uint8_t *) "IP_NETMASK", 327 327 10 328 328 }, 329 329 { 330 ( char*) "IP_GATEWAY",330 (uint8_t *) "IP_GATEWAY", 331 331 10 332 332 }, 333 333 { 334 ( char*) "IP_BROADCAST",334 (uint8_t *) "IP_BROADCAST", 335 335 12 336 336 }, 337 337 { 338 ( char*) "ARP",338 (uint8_t *) "ARP", 339 339 3 340 340 }, 341 341 { 342 ( char*) "IP_ROUTING",342 (uint8_t *) "IP_ROUTING", 343 343 10 344 344 } … … 346 346 measured_string_t *configuration; 347 347 size_t count = sizeof(names) / sizeof(measured_string_t); 348 char*data;348 uint8_t *data; 349 349 measured_string_t address; 350 350 ip_route_t *route; … … 368 368 if (configuration) { 369 369 if (configuration[0].value) 370 ip_netif->ipv = strtol( configuration[0].value, NULL, 0);371 372 ip_netif->dhcp = !str_lcmp( configuration[1].value, "dhcp",370 ip_netif->ipv = strtol((char *) configuration[0].value, NULL, 0); 371 372 ip_netif->dhcp = !str_lcmp((char *) configuration[1].value, "dhcp", 373 373 configuration[1].length); 374 374 … … 394 394 } 395 395 396 if ((inet_pton(AF_INET, configuration[2].value,396 if ((inet_pton(AF_INET, (char *) configuration[2].value, 397 397 (uint8_t *) &route->address.s_addr) != EOK) || 398 (inet_pton(AF_INET, configuration[3].value,398 (inet_pton(AF_INET, (char *) configuration[3].value, 399 399 (uint8_t *) &route->netmask.s_addr) != EOK) || 400 (inet_pton(AF_INET, configuration[4].value,400 (inet_pton(AF_INET, (char *) configuration[4].value, 401 401 (uint8_t *) &gateway.s_addr) == EINVAL) || 402 (inet_pton(AF_INET, configuration[5].value,402 (inet_pton(AF_INET, (char *) configuration[5].value, 403 403 (uint8_t *) &ip_netif->broadcast.s_addr) == EINVAL)) 404 404 { … … 441 441 if (ip_netif->arp) { 442 442 if (route) { 443 address.value = ( char*) &route->address.s_addr;443 address.value = (uint8_t *) &route->address.s_addr; 444 444 address.length = sizeof(in_addr_t); 445 445 … … 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 … … 997 1002 measured_string_t destination; 998 1003 measured_string_t *translation; 999 char*data;1004 uint8_t *data; 1000 1005 int phone; 1001 1006 int rc; … … 1004 1009 if (netif->arp && (route->address.s_addr != dest.s_addr)) { 1005 1010 destination.value = route->gateway.s_addr ? 1006 ( char *) &route->gateway.s_addr : (char*) &dest.s_addr;1011 (uint8_t *) &route->gateway.s_addr : (uint8_t *) &dest.s_addr; 1007 1012 destination.length = sizeof(dest.s_addr); 1008 1013 … … 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, * dest);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) { … … 1756 1760 (header->destination_address & route->netmask.s_addr))) { 1757 1761 // clear the ARP mapping if any 1758 address.value = ( char*) &header->destination_address;1762 address.value = (uint8_t *) &header->destination_address; 1759 1763 address.length = sizeof(header->destination_address); 1760 1764 arp_clear_address_req(netif->arp->phone, … … 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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 90 90 * 91 91 */ 92 int add_configuration(measured_strings_t *configuration, const char*name,93 const char*value)92 int add_configuration(measured_strings_t *configuration, const uint8_t *name, 93 const uint8_t *value) 94 94 { 95 95 int rc; … … 119 119 } 120 120 121 static int parse_line(measured_strings_t *configuration, char*line)121 static int parse_line(measured_strings_t *configuration, uint8_t *line) 122 122 { 123 123 int rc; 124 124 125 125 /* From the beginning */ 126 char*name = line;126 uint8_t *name = line; 127 127 128 128 /* Skip comments and blank lines */ … … 135 135 136 136 /* Remember the name start */ 137 char*value = name;137 uint8_t *value = name; 138 138 139 139 /* Skip the name */ … … 186 186 187 187 /* Construct the full filename */ 188 char line[BUFFER_SIZE];189 if (snprintf( line, BUFFER_SIZE, "%s/%s", directory, filename) > BUFFER_SIZE)188 char fname[BUFFER_SIZE]; 189 if (snprintf(fname, BUFFER_SIZE, "%s/%s", directory, filename) > BUFFER_SIZE) 190 190 return EOVERFLOW; 191 191 192 192 /* Open the file */ 193 FILE *cfg = fopen( line, "r");193 FILE *cfg = fopen(fname, "r"); 194 194 if (!cfg) 195 195 return ENOENT; … … 201 201 unsigned int line_number = 0; 202 202 size_t index = 0; 203 uint8_t line[BUFFER_SIZE]; 204 203 205 while (!ferror(cfg) && !feof(cfg)) { 204 206 int read = fgetc(cfg); … … 207 209 line[BUFFER_SIZE - 1] = '\0'; 208 210 fprintf(stderr, "%s: Configuration line %u too " 209 "long: %s\n", NAME, line_number, line);211 "long: %s\n", NAME, line_number, (char *) line); 210 212 211 213 /* No space left in the line buffer */ … … 213 215 } 214 216 /* Append the character */ 215 line[index] = ( char) read;217 line[index] = (uint8_t) read; 216 218 index++; 217 219 } else { … … 221 223 if (parse_line(configuration, line) != EOK) { 222 224 fprintf(stderr, "%s: Configuration error on " 223 "line %u: %s\n", NAME, line_number, line);225 "line %u: %s\n", NAME, line_number, (char *) line); 224 226 } 225 227 … … 282 284 return rc; 283 285 284 rc = add_module(NULL, &net_globals.modules, LO_NAME, LO_FILENAME,285 SERVICE_LO, 0, connect_to_service);286 if (rc != EOK) 287 return rc; 288 rc = add_module(NULL, &net_globals.modules, DP8390_NAME,289 DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service);290 if (rc != EOK) 291 return rc; 292 rc = add_module(NULL, &net_globals.modules, ETHERNET_NAME,293 ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service);294 if (rc != EOK) 295 return rc; 296 rc = add_module(NULL, &net_globals.modules, NILDUMMY_NAME,297 NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service);286 rc = add_module(NULL, &net_globals.modules, (uint8_t *) LO_NAME, 287 (uint8_t *) LO_FILENAME, SERVICE_LO, 0, connect_to_service); 288 if (rc != EOK) 289 return rc; 290 rc = add_module(NULL, &net_globals.modules, (uint8_t *) DP8390_NAME, 291 (uint8_t *) DP8390_FILENAME, SERVICE_DP8390, 0, connect_to_service); 292 if (rc != EOK) 293 return rc; 294 rc = add_module(NULL, &net_globals.modules, (uint8_t *) ETHERNET_NAME, 295 (uint8_t *) ETHERNET_FILENAME, SERVICE_ETHERNET, 0, connect_to_service); 296 if (rc != EOK) 297 return rc; 298 rc = add_module(NULL, &net_globals.modules, (uint8_t *) NILDUMMY_NAME, 299 (uint8_t *) NILDUMMY_FILENAME, SERVICE_NILDUMMY, 0, connect_to_service); 298 300 if (rc != EOK) 299 301 return rc; … … 364 366 */ 365 367 static int net_get_conf(measured_strings_t *netif_conf, 366 measured_string_t *configuration, size_t count, char**data)368 measured_string_t *configuration, size_t count, uint8_t **data) 367 369 { 368 370 if (data) … … 390 392 391 393 int net_get_conf_req(int net_phone, measured_string_t **configuration, 392 size_t count, char**data)394 size_t count, uint8_t **data) 393 395 { 394 396 if (!configuration || (count <= 0)) … … 399 401 400 402 int net_get_device_conf_req(int net_phone, device_id_t device_id, 401 measured_string_t **configuration, size_t count, char**data)403 measured_string_t **configuration, size_t count, uint8_t **data) 402 404 { 403 405 if ((!configuration) || (count == 0)) … … 411 413 } 412 414 413 void net_free_settings(measured_string_t *settings, char*data)415 void net_free_settings(measured_string_t *settings, uint8_t *data) 414 416 { 415 417 } … … 437 439 /* Mandatory netif */ 438 440 measured_string_t *setting = 439 measured_strings_find(&netif->configuration, CONF_NETIF, 0);441 measured_strings_find(&netif->configuration, (uint8_t *) CONF_NETIF, 0); 440 442 441 443 netif->driver = get_running_module(&net_globals.modules, setting->value); … … 447 449 448 450 /* Optional network interface layer */ 449 setting = measured_strings_find(&netif->configuration, CONF_NIL, 0);451 setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_NIL, 0); 450 452 if (setting) { 451 453 netif->nil = get_running_module(&net_globals.modules, setting->value); … … 459 461 460 462 /* Mandatory internet layer */ 461 setting = measured_strings_find(&netif->configuration, CONF_IL, 0);463 setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_IL, 0); 462 464 netif->il = get_running_module(&net_globals.modules, setting->value); 463 465 if (!netif->il) { … … 468 470 469 471 /* Hardware configuration */ 470 setting = measured_strings_find(&netif->configuration, CONF_IRQ, 0);471 int irq = setting ? strtol( setting->value, NULL, 10) : 0;472 473 setting = measured_strings_find(&netif->configuration, CONF_IO, 0);474 int io = setting ? strtol(setting->value, NULL, 16) : 0;475 476 rc = netif_probe_req _remote(netif->driver->phone, netif->id, irq,io);472 setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_IRQ, 0); 473 int irq = setting ? strtol((char *) setting->value, NULL, 10) : 0; 474 475 setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_IO, 0); 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); 477 479 if (rc != EOK) 478 480 return rc; … … 481 483 services_t internet_service; 482 484 if (netif->nil) { 483 setting = measured_strings_find(&netif->configuration, CONF_MTU, 0);485 setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_MTU, 0); 484 486 if (!setting) 485 487 setting = measured_strings_find(&net_globals.configuration, 486 CONF_MTU, 0);487 488 int mtu = setting ? strtol( setting->value, NULL, 10) : 0;488 (uint8_t *) CONF_MTU, 0); 489 490 int mtu = setting ? strtol((char *) setting->value, NULL, 10) : 0; 489 491 490 492 rc = nil_device_req(netif->nil->phone, netif->id, mtu, … … 509 511 } 510 512 511 return netif_start_req _remote(netif->driver->phone, netif->id);513 return netif_start_req(netif->driver->phone, netif->id); 512 514 } 513 515 … … 558 560 /* Mandatory name */ 559 561 measured_string_t *setting = 560 measured_strings_find(&netif->configuration, CONF_NAME, 0);562 measured_strings_find(&netif->configuration, (uint8_t *) CONF_NAME, 0); 561 563 if (!setting) { 562 564 fprintf(stderr, "%s: Network interface name is missing\n", NAME); … … 602 604 printf("%s: Network interface started (name: %s, id: %d, driver: %s, " 603 605 "nil: %s, il: %s)\n", NAME, netif->name, netif->id, 604 netif->driver->name, netif->nil ?netif->nil->name : "[none]",606 netif->driver->name, netif->nil ? (char *) netif->nil->name : "[none]", 605 607 netif->il->name); 606 608 } … … 611 613 /** Process the networking message. 612 614 * 613 * @param[in] callidThe message identifier.614 * @param[in] callThe message parameters.615 * @param[in] callid The message identifier. 616 * @param[in] call The message parameters. 615 617 * @param[out] answer The message answer parameters. 616 618 * @param[out] answer_count The last parameter for the actual answer … … 625 627 */ 626 628 int net_message(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, 627 int *answer_count)629 size_t *answer_count) 628 630 { 629 631 measured_string_t *strings; 630 char*data;632 uint8_t *data; 631 633 int rc; 632 634 … … 637 639 case NET_NET_GET_DEVICE_CONF: 638 640 rc = measured_strings_receive(&strings, &data, 639 IPC_GET_COUNT( call));641 IPC_GET_COUNT(*call)); 640 642 if (rc != EOK) 641 643 return rc; 642 net_get_device_conf_req(0, IPC_GET_DEVICE( call), &strings,643 IPC_GET_COUNT( call), NULL);644 net_get_device_conf_req(0, IPC_GET_DEVICE(*call), &strings, 645 IPC_GET_COUNT(*call), NULL); 644 646 645 647 /* Strings should not contain received data anymore */ 646 648 free(data); 647 649 648 rc = measured_strings_reply(strings, IPC_GET_COUNT( call));650 rc = measured_strings_reply(strings, IPC_GET_COUNT(*call)); 649 651 free(strings); 650 652 return rc; 651 653 case NET_NET_GET_CONF: 652 654 rc = measured_strings_receive(&strings, &data, 653 IPC_GET_COUNT( call));655 IPC_GET_COUNT(*call)); 654 656 if (rc != EOK) 655 657 return rc; 656 net_get_conf_req(0, &strings, IPC_GET_COUNT( call), NULL);658 net_get_conf_req(0, &strings, IPC_GET_COUNT(*call), NULL); 657 659 658 660 /* Strings should not contain received data anymore */ 659 661 free(data); 660 662 661 rc = measured_strings_reply(strings, IPC_GET_COUNT( call));663 rc = measured_strings_reply(strings, IPC_GET_COUNT(*call)); 662 664 free(strings); 663 665 return rc; … … 686 688 /* Clear the answer structure */ 687 689 ipc_call_t answer; 688 int answer_count;690 size_t answer_count; 689 691 refresh_answer(&answer, &answer_count); 690 692 -
uspace/srv/net/net/net.h
ra97ea0f r6610565b 105 105 module_t *driver; 106 106 107 device_id_t id; /**< System-unique network interface identifier. */108 module_t *il; /**< Serving internet layer module index. */109 char *name;/**< System-unique network interface name. */110 module_t *nil; /**< Serving link layer module index. */107 device_id_t id; /**< System-unique network interface identifier. */ 108 module_t *il; /**< Serving internet layer module index. */ 109 uint8_t *name; /**< System-unique network interface name. */ 110 module_t *nil; /**< Serving link layer module index. */ 111 111 } netif_t; 112 112 … … 133 133 } net_globals_t; 134 134 135 extern int add_configuration(measured_strings_t *, const char *, const char *); 136 extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *); 135 extern int add_configuration(measured_strings_t *, const uint8_t *, 136 const uint8_t *); 137 extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, size_t *); 137 138 extern int net_initialize_build(async_client_conn_t); 138 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 *); 139 140 140 141 #endif -
uspace/srv/net/net/net_standalone.c
ra97ea0f r6610565b 63 63 int rc; 64 64 65 task_id_t task_id = spawn("/srv/ip");65 task_id_t task_id = net_spawn((uint8_t *) "/srv/ip"); 66 66 if (!task_id) 67 67 return EINVAL; 68 68 69 rc = add_module(NULL, &net_globals.modules, IP_NAME,70 IP_FILENAME, SERVICE_IP, task_id, ip_connect_module);69 rc = add_module(NULL, &net_globals.modules, (uint8_t *) IP_NAME, 70 (uint8_t *) IP_FILENAME, SERVICE_IP, task_id, ip_connect_module); 71 71 if (rc != EOK) 72 72 return rc; 73 73 74 if (! spawn("/srv/icmp"))74 if (!net_spawn((uint8_t *) "/srv/icmp")) 75 75 return EINVAL; 76 76 77 if (! spawn("/srv/udp"))77 if (!net_spawn((uint8_t *) "/srv/udp")) 78 78 return EINVAL; 79 79 80 if (! spawn("/srv/tcp"))80 if (!net_spawn((uint8_t *) "/srv/tcp")) 81 81 return EINVAL; 82 82 … … 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
ra97ea0f r6610565b 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. */ 55 #define DEFAULT_ADDR "\0\0\0\0\0\0"54 #define DEFAULT_ADDR 0 56 55 57 56 /** Default address length. */ 58 #define DEFAULT_ADDR_LEN (sizeof(DEFAULT_ADDR) / sizeof(char))57 #define DEFAULT_ADDR_LEN 6 59 58 60 59 /** Loopback module name. */ … … 62 61 63 62 /** Network interface global data. */ 64 netif_globals_t netif_globals;63 netif_globals_t netif_globals; 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; … … 74 73 if (!address) 75 74 return EBADMEM; 76 77 address->value = str_dup(DEFAULT_ADDR); 75 76 uint8_t *addr = (uint8_t *) malloc(DEFAULT_ADDR_LEN); 77 memset(addr, DEFAULT_ADDR, DEFAULT_ADDR_LEN); 78 79 address->value = addr; 78 80 address->length = DEFAULT_ADDR_LEN; 79 81 80 82 return EOK; 81 83 } … … 169 171 } 170 172 171 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) 172 174 { 173 175 netif_device_t *device; … … 230 232 } 231 233 232 /** Default thread for new connections.233 *234 * @param[in] iid The initial message identifier.235 * @param[in] icall The initial message call structure.236 */237 static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)238 {239 /*240 * Accept the connection241 * - Answer the first IPC_M_CONNECT_ME_TO call.242 */243 ipc_answer_0(iid, EOK);244 245 while (true) {246 ipc_call_t answer;247 int answer_count;248 249 /* Clear the answer structure */250 refresh_answer(&answer, &answer_count);251 252 /* Fetch the next message */253 ipc_call_t call;254 ipc_callid_t callid = async_get_call(&call);255 256 /* Process the message */257 int res = netif_module_message(NAME, callid, &call, &answer,258 &answer_count);259 260 /*261 * End if told to either by the message or the processing262 * result.263 */264 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||265 (res == EHANGUP))266 return;267 268 /* Answer the message */269 answer_call(callid, res, &answer, answer_count);270 }271 }272 273 234 int main(int argc, char *argv[]) 274 235 { 275 int rc;276 277 236 /* Start the module */ 278 rc = netif_module_start(netif_client_connection); 279 return rc; 237 return netif_module_start(); 280 238 } 281 239 -
uspace/srv/net/nil/eth/eth.c
ra97ea0f r6610565b 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> … … 201 201 202 202 eth_globals.broadcast_addr = 203 measured_string_create_bulk( "\xFF\xFF\xFF\xFF\xFF\xFF", ETH_ADDR);203 measured_string_create_bulk((uint8_t *) "\xFF\xFF\xFF\xFF\xFF\xFF", ETH_ADDR); 204 204 if (!eth_globals.broadcast_addr) { 205 205 rc = ENOMEM; … … 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); … … 284 284 measured_string_t names[2] = { 285 285 { 286 ( char*) "ETH_MODE",286 (uint8_t *) "ETH_MODE", 287 287 8 288 288 }, 289 289 { 290 ( char*) "ETH_DUMMY",290 (uint8_t *) "ETH_DUMMY", 291 291 9 292 292 } … … 294 294 measured_string_t *configuration; 295 295 size_t count = sizeof(names) / sizeof(measured_string_t); 296 char*data;296 uint8_t *data; 297 297 eth_proto_t *proto; 298 298 int rc; … … 358 358 359 359 if (configuration) { 360 if (!str_lcmp( configuration[0].value, "DIX",360 if (!str_lcmp((char *) configuration[0].value, "DIX", 361 361 configuration[0].length)) { 362 362 device->flags |= ETH_DIX; 363 } else if(!str_lcmp( configuration[0].value, "8023_2_LSAP",363 } else if(!str_lcmp((char *) configuration[0].value, "8023_2_LSAP", 364 364 configuration[0].length)) { 365 365 device->flags |= ETH_8023_2_LSAP; … … 407 407 408 408 printf("%s: Device registered (id: %d, service: %d: mtu: %zu, " 409 "mac: % x:%x:%x:%x:%x:%x, flags: 0x%x)\n",409 "mac: %02x:%02x:%02x:%02x:%02x:%02x, flags: 0x%x)\n", 410 410 NAME, device->device_id, device->service, device->mtu, 411 411 device->addr_data[0], device->addr_data[1], … … 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.h
ra97ea0f r6610565b 91 91 /** Actual device hardware address. */ 92 92 measured_string_t *addr; 93 93 94 /** Actual device hardware address data. */ 94 char*addr_data;95 uint8_t *addr_data; 95 96 }; 96 97 -
uspace/srv/net/nil/eth/eth_header.h
ra97ea0f r6610565b 42 42 43 43 /** Ethernet address length. */ 44 #define ETH_ADDR 644 #define ETH_ADDR 6 45 45 46 46 /** Ethernet header preamble value. */ 47 #define ETH_PREAMBLE 0x5547 #define ETH_PREAMBLE 0x55 48 48 49 49 /** Ethernet header start of frame value. */ 50 #define ETH_SFD 0xD550 #define ETH_SFD 0xD5 51 51 52 52 /** IEEE 802.2 unordered information control field. */ 53 #define IEEE_8023_2_UI 0x0353 #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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 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.h
ra97ea0f r6610565b 78 78 measured_string_t *addr; 79 79 /** Actual device hardware address data. */ 80 char*addr_data;80 uint8_t *addr_data; 81 81 }; 82 82 -
uspace/srv/net/nil/nildummy/nildummy_module.c
ra97ea0f r6610565b 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
ra97ea0f r6610565b 405 405 measured_string_t names[] = { 406 406 { 407 ( char*) "ICMP_ERROR_REPORTING",407 (uint8_t *) "ICMP_ERROR_REPORTING", 408 408 20 409 409 }, 410 410 { 411 ( char*) "ICMP_ECHO_REPLYING",411 (uint8_t *) "ICMP_ECHO_REPLYING", 412 412 18 413 413 } … … 415 415 measured_string_t *configuration; 416 416 size_t count = sizeof(names) / sizeof(measured_string_t); 417 char*data;417 uint8_t *data; 418 418 int rc; 419 419 … … 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, * call);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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 154 154 155 155 /** Port map key. */ 156 char*key;156 uint8_t *key; 157 157 158 158 /** Port map key length. */ … … 358 358 /* Find the destination socket */ 359 359 socket = socket_port_find(&tcp_globals.sockets, 360 ntohs(header->destination_port), ( const char*) src, addrlen);360 ntohs(header->destination_port), (uint8_t *) src, addrlen); 361 361 if (!socket) { 362 362 /* Find the listening destination socket */ 363 363 socket = socket_port_find(&tcp_globals.sockets, 364 ntohs(header->destination_port), SOCKET_MAP_KEY_LISTENING,365 0);364 ntohs(header->destination_port), 365 (uint8_t *) SOCKET_MAP_KEY_LISTENING, 0); 366 366 } 367 367 … … 998 998 /* Find the destination socket */ 999 999 listening_socket = socket_port_find(&tcp_globals.sockets, 1000 listening_port, SOCKET_MAP_KEY_LISTENING, 0);1000 listening_port, (uint8_t *) SOCKET_MAP_KEY_LISTENING, 0); 1001 1001 if (!listening_socket || 1002 1002 (listening_socket->socket_id != listening_socket_id)) { … … 1022 1022 1023 1023 rc = socket_port_add(&tcp_globals.sockets, listening_port, socket, 1024 ( const char*) socket_data->addr, socket_data->addrlen);1024 (uint8_t *) socket_data->addr, socket_data->addrlen); 1025 1025 assert(socket == socket_port_find(&tcp_globals.sockets, listening_port, 1026 ( const char*) socket_data->addr, socket_data->addrlen));1026 (uint8_t *) socket_data->addr, socket_data->addrlen)); 1027 1027 1028 1028 // rc = socket_bind_free_port(&tcp_globals.sockets, socket, … … 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; … … 2109 2109 2110 2110 /* Copy the key */ 2111 operation_timeout->key = (( char*) operation_timeout) +2111 operation_timeout->key = ((uint8_t *) operation_timeout) + 2112 2112 sizeof(*operation_timeout); 2113 2113 operation_timeout->key_length = socket->key_length; … … 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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 104 104 measured_string_t names[] = { 105 105 { 106 ( char*) "UDP_CHECKSUM_COMPUTING",106 (uint8_t *) "UDP_CHECKSUM_COMPUTING", 107 107 22 108 108 }, 109 109 { 110 ( char*) "UDP_AUTOBINDING",110 (uint8_t *) "UDP_AUTOBINDING", 111 111 15 112 112 } … … 114 114 measured_string_t *configuration; 115 115 size_t count = sizeof(names) / sizeof(measured_string_t); 116 char*data;116 uint8_t *data; 117 117 int rc; 118 118 … … 283 283 /* Find the destination socket */ 284 284 socket = socket_port_find(&udp_globals.sockets, 285 ntohs(header->destination_port),SOCKET_MAP_KEY_LISTENING, 0);285 ntohs(header->destination_port), (uint8_t *) SOCKET_MAP_KEY_LISTENING, 0); 286 286 if (!socket) { 287 287 if (tl_prepare_icmp_packet(udp_globals.net_phone, … … 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 = 0; 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, * call);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
ra97ea0f r6610565b 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
ra97ea0f r6610565b 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.
