Changes in uspace/srv/net/il/ip/ip.c [02314f8:4eca056] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/il/ip/ip.c
r02314f8 r4eca056 144 144 static int ip_get_icmp_phone(void) 145 145 { 146 ip_proto_ refproto;146 ip_proto_t *proto; 147 147 int phone; 148 148 … … 170 170 * @returns Other error codes as defined for the packet_set_addr(). 171 171 */ 172 static int ip_prepare_icmp(packet_t packet, ip_header_ refheader)172 static int ip_prepare_icmp(packet_t packet, ip_header_t *header) 173 173 { 174 174 packet_t next; … … 187 187 188 188 // get header 189 header = (ip_header_ ref) packet_get_data(packet);189 header = (ip_header_t *) packet_get_data(packet); 190 190 if (!header) 191 191 return EINVAL; … … 234 234 static int 235 235 ip_prepare_icmp_and_get_phone(services_t error, packet_t packet, 236 ip_header_ refheader)236 ip_header_t *header) 237 237 { 238 238 int phone; … … 308 308 * nil_packet_size_req() function. 309 309 */ 310 static int ip_netif_initialize(ip_netif_ refip_netif)310 static int ip_netif_initialize(ip_netif_t *ip_netif) 311 311 { 312 312 measured_string_t names[] = { … … 344 344 } 345 345 }; 346 measured_string_ refconfiguration;346 measured_string_t *configuration; 347 347 size_t count = sizeof(names) / sizeof(measured_string_t); 348 348 char *data; 349 349 measured_string_t address; 350 ip_route_ refroute;350 ip_route_t *route; 351 351 in_addr_t gateway; 352 352 int index; … … 378 378 return ENOTSUP; 379 379 } else if (ip_netif->ipv == IPV4) { 380 route = (ip_route_ ref) malloc(sizeof(ip_route_t));380 route = (ip_route_t *) malloc(sizeof(ip_route_t)); 381 381 if (!route) { 382 382 net_free_settings(configuration, data); … … 491 491 static int ip_mtu_changed_message(device_id_t device_id, size_t mtu) 492 492 { 493 ip_netif_ refnetif;493 ip_netif_t *netif; 494 494 495 495 fibril_rwlock_write_lock(&ip_globals.netifs_lock); … … 516 516 static int ip_device_state_message(device_id_t device_id, device_state_t state) 517 517 { 518 ip_netif_ refnetif;518 ip_netif_t *netif; 519 519 520 520 fibril_rwlock_write_lock(&ip_globals.netifs_lock); … … 542 542 * @returns NULL on error. 543 543 */ 544 static ip_header_ ref545 ip_create_middle_header(packet_t packet, ip_header_ reflast)546 { 547 ip_header_ refmiddle;548 549 middle = (ip_header_ ref) packet_suffix(packet, IP_HEADER_LENGTH(last));544 static ip_header_t * 545 ip_create_middle_header(packet_t packet, ip_header_t *last) 546 { 547 ip_header_t *middle; 548 549 middle = (ip_header_t *) packet_suffix(packet, IP_HEADER_LENGTH(last)); 550 550 if (!middle) 551 551 return NULL; … … 562 562 * @param[in] first The original header to be copied. 563 563 */ 564 static void ip_create_last_header(ip_header_ ref last, ip_header_reffirst)565 { 566 ip_option_ refoption;564 static void ip_create_last_header(ip_header_t *last, ip_header_t *first) 565 { 566 ip_option_t *option; 567 567 size_t next; 568 568 size_t length; … … 575 575 // process all ip options 576 576 while (next < first->header_length) { 577 option = (ip_option_ ref) (((uint8_t *) first) + next);577 option = (ip_option_t *) (((uint8_t *) first) + next); 578 578 // skip end or noop 579 579 if ((option->type == IPOPT_END) || … … 623 623 static int 624 624 ip_prepare_packet(in_addr_t *source, in_addr_t dest, packet_t packet, 625 measured_string_ refdestination)625 measured_string_t *destination) 626 626 { 627 627 size_t length; 628 ip_header_ refheader;629 ip_header_ reflast_header;630 ip_header_ refmiddle_header;628 ip_header_t *header; 629 ip_header_t *last_header; 630 ip_header_t *middle_header; 631 631 packet_t next; 632 632 int rc; … … 636 636 return EINVAL; 637 637 638 header = (ip_header_ ref) packet_get_data(packet);638 header = (ip_header_t *) packet_get_data(packet); 639 639 if (destination) { 640 640 rc = packet_set_addr(packet, NULL, (uint8_t *) destination->value, … … 660 660 661 661 if (pq_next(packet)) { 662 last_header = (ip_header_ ref) malloc(IP_HEADER_LENGTH(header));662 last_header = (ip_header_t *) malloc(IP_HEADER_LENGTH(header)); 663 663 if (!last_header) 664 664 return ENOMEM; … … 666 666 next = pq_next(packet); 667 667 while (pq_next(next)) { 668 middle_header = (ip_header_ ref) packet_prefix(next,668 middle_header = (ip_header_t *) packet_prefix(next, 669 669 IP_HEADER_LENGTH(last_header)); 670 670 if (!middle_header) { … … 698 698 } 699 699 700 middle_header = (ip_header_ ref) packet_prefix(next,700 middle_header = (ip_header_t *) packet_prefix(next, 701 701 IP_HEADER_LENGTH(last_header)); 702 702 if (!middle_header) { … … 755 755 static int 756 756 ip_fragment_packet_data(packet_t packet, packet_t new_packet, 757 ip_header_ ref header, ip_header_refnew_header, size_t length,757 ip_header_t *header, ip_header_t *new_header, size_t length, 758 758 const struct sockaddr *src, const struct sockaddr *dest, socklen_t addrlen) 759 759 { … … 820 820 { 821 821 packet_t new_packet; 822 ip_header_ refheader;823 ip_header_ refmiddle_header;824 ip_header_ reflast_header;822 ip_header_t *header; 823 ip_header_t *middle_header; 824 ip_header_t *last_header; 825 825 struct sockaddr *src; 826 826 struct sockaddr *dest; … … 838 838 839 839 // get header 840 header = (ip_header_ ref) packet_get_data(packet);840 header = (ip_header_t *) packet_get_data(packet); 841 841 if (!header) 842 842 return EINVAL; … … 853 853 854 854 // allocate as much as originally 855 last_header = (ip_header_ ref) packet_suffix(new_packet,855 last_header = (ip_header_t *) packet_suffix(new_packet, 856 856 IP_HEADER_LENGTH(header)); 857 857 if (!last_header) … … 993 993 */ 994 994 static int 995 ip_send_route(packet_t packet, ip_netif_ ref netif, ip_route_refroute,995 ip_send_route(packet_t packet, ip_netif_t *netif, ip_route_t *route, 996 996 in_addr_t *src, in_addr_t dest, services_t error) 997 997 { 998 998 measured_string_t destination; 999 measured_string_ reftranslation;999 measured_string_t *translation; 1000 1000 char *data; 1001 1001 int phone; … … 1065 1065 * @returns NULL if no route was found. 1066 1066 */ 1067 static ip_route_ ref1068 ip_netif_find_route(ip_netif_ refnetif, in_addr_t destination)1067 static ip_route_t * 1068 ip_netif_find_route(ip_netif_t *netif, in_addr_t destination) 1069 1069 { 1070 1070 int index; 1071 ip_route_ refroute;1071 ip_route_t *route; 1072 1072 1073 1073 if (!netif) … … 1093 1093 * @returns NULL if no route was found. 1094 1094 */ 1095 static ip_route_ refip_find_route(in_addr_t destination) {1095 static ip_route_t *ip_find_route(in_addr_t destination) { 1096 1096 int index; 1097 ip_route_ refroute;1098 ip_netif_ refnetif;1097 ip_route_t *route; 1098 ip_netif_t *netif; 1099 1099 1100 1100 // start with the last netif - the newest one … … 1119 1119 * @returns NULL if no IP address was found. 1120 1120 */ 1121 static in_addr_t *ip_netif_address(ip_netif_ refnetif)1122 { 1123 ip_route_ refroute;1121 static in_addr_t *ip_netif_address(ip_netif_t *netif) 1122 { 1123 ip_route_t *route; 1124 1124 1125 1125 route = ip_routes_get_index(&netif->routes, 0); … … 1147 1147 tl_received_msg_t received_msg) 1148 1148 { 1149 ip_proto_ refproto;1149 ip_proto_t *proto; 1150 1150 int index; 1151 1151 … … 1153 1153 return EINVAL; 1154 1154 1155 proto = (ip_proto_ ref) malloc(sizeof(ip_protos_t));1155 proto = (ip_proto_t *) malloc(sizeof(ip_protos_t)); 1156 1156 if (!proto) 1157 1157 return ENOMEM; … … 1180 1180 ip_device_req_local(int il_phone, device_id_t device_id, services_t netif) 1181 1181 { 1182 ip_netif_ refip_netif;1183 ip_route_ refroute;1182 ip_netif_t *ip_netif; 1183 ip_route_t *route; 1184 1184 int index; 1185 1185 int rc; 1186 1186 1187 ip_netif = (ip_netif_ ref) malloc(sizeof(ip_netif_t));1187 ip_netif = (ip_netif_t *) malloc(sizeof(ip_netif_t)); 1188 1188 if (!ip_netif) 1189 1189 return ENOMEM; … … 1251 1251 { 1252 1252 int addrlen; 1253 ip_netif_ refnetif;1254 ip_route_ refroute;1253 ip_netif_t *netif; 1254 ip_route_t *route; 1255 1255 struct sockaddr *addr; 1256 1256 struct sockaddr_in *address_in; … … 1367 1367 size_t *content, size_t *suffix) 1368 1368 { 1369 ip_netif_ refnetif;1369 ip_netif_t *netif; 1370 1370 int index; 1371 1371 … … 1420 1420 * @returns The packet destination address. 1421 1421 */ 1422 static in_addr_t ip_get_destination(ip_header_ refheader)1422 static in_addr_t ip_get_destination(ip_header_t *header) 1423 1423 { 1424 1424 in_addr_t destination; … … 1451 1451 */ 1452 1452 static int 1453 ip_deliver_local(device_id_t device_id, packet_t packet, ip_header_ refheader,1453 ip_deliver_local(device_id_t device_id, packet_t packet, ip_header_t *header, 1454 1454 services_t error) 1455 1455 { 1456 ip_proto_ refproto;1456 ip_proto_t *proto; 1457 1457 int phone; 1458 1458 services_t service; … … 1555 1555 ip_process_packet(device_id_t device_id, packet_t packet) 1556 1556 { 1557 ip_header_ refheader;1557 ip_header_t *header; 1558 1558 in_addr_t dest; 1559 ip_route_ refroute;1559 ip_route_t *route; 1560 1560 int phone; 1561 1561 struct sockaddr *addr; … … 1564 1564 int rc; 1565 1565 1566 header = (ip_header_ ref) packet_get_data(packet);1566 header = (ip_header_t *) packet_get_data(packet); 1567 1567 if (!header) 1568 1568 return ip_release_and_return(packet, ENOMEM); … … 1647 1647 in_addr_t netmask, in_addr_t gateway) 1648 1648 { 1649 ip_route_ refroute;1650 ip_netif_ refnetif;1649 ip_route_t *route; 1650 ip_netif_t *netif; 1651 1651 int index; 1652 1652 … … 1659 1659 } 1660 1660 1661 route = (ip_route_ ref) malloc(sizeof(ip_route_t));1661 route = (ip_route_t *) malloc(sizeof(ip_route_t)); 1662 1662 if (!route) { 1663 1663 fibril_rwlock_write_unlock(&ip_globals.netifs_lock); … … 1681 1681 ip_set_gateway_req_local(int ip_phone, device_id_t device_id, in_addr_t gateway) 1682 1682 { 1683 ip_netif_ refnetif;1683 ip_netif_t *netif; 1684 1684 1685 1685 fibril_rwlock_write_lock(&ip_globals.netifs_lock); … … 1721 1721 icmp_type_t type; 1722 1722 icmp_code_t code; 1723 ip_netif_ refnetif;1723 ip_netif_t *netif; 1724 1724 measured_string_t address; 1725 ip_route_ refroute;1726 ip_header_ refheader;1725 ip_route_t *route; 1726 ip_header_t *header; 1727 1727 1728 1728 switch (error) { … … 1734 1734 1735 1735 data = packet_get_data(packet); 1736 header = (ip_header_ ref)(data + offset);1736 header = (ip_header_t *)(data + offset); 1737 1737 1738 1738 // destination host unreachable? … … 1782 1782 in_addr_t *dest; 1783 1783 in_addr_t *src; 1784 ip_route_ refroute;1785 ipv4_pseudo_header_ refheader_in;1784 ip_route_t *route; 1785 ipv4_pseudo_header_t *header_in; 1786 1786 1787 1787 if (!destination || (addrlen <= 0)) … … 1829 1829 1830 1830 *headerlen = sizeof(*header_in); 1831 header_in = (ipv4_pseudo_header_ ref) malloc(*headerlen);1831 header_in = (ipv4_pseudo_header_t *) malloc(*headerlen); 1832 1832 if (!header_in) 1833 1833 return ENOMEM;
Note:
See TracChangeset
for help on using the changeset viewer.