Changeset a7811f17 in mainline for uspace/srv
- Timestamp:
- 2010-11-19T21:28:02Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a9c6b966
- Parents:
- 45f04f8 (diff), aaa3f33a (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
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/netif/dp8390/dp8390_module.c
r45f04f8 ra7811f17 157 157 } 158 158 159 int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){ 159 int netif_get_device_stats(device_id_t device_id, device_stats_t *stats) 160 { 160 161 netif_device_t * device; 161 162 eth_stat_t * de_stat; … … 185 186 } 186 187 187 int netif_get_addr_message(device_id_t device_id, measured_string_ refaddress){188 int netif_get_addr_message(device_id_t device_id, measured_string_t *address){ 188 189 netif_device_t * device; 189 190 int rc; -
uspace/srv/net/il/arp/arp.c
r45f04f8 ra7811f17 83 83 * @param[in] device The device specific data. 84 84 */ 85 static void arp_clear_device(arp_device_ refdevice)85 static void arp_clear_device(arp_device_t *device) 86 86 { 87 87 int count; 88 arp_proto_ refproto;88 arp_proto_t *proto; 89 89 90 90 for (count = arp_protos_count(&device->protos) - 1; count >= 0; … … 105 105 { 106 106 int count; 107 arp_device_ refdevice;107 arp_device_t *device; 108 108 109 109 fibril_rwlock_write_lock(&arp_globals.lock); … … 126 126 127 127 static int arp_clear_address_req(int arp_phone, device_id_t device_id, 128 services_t protocol, measured_string_ refaddress)129 { 130 arp_device_ refdevice;131 arp_proto_ refproto;128 services_t protocol, measured_string_t *address) 129 { 130 arp_device_t *device; 131 arp_proto_t *proto; 132 132 133 133 fibril_rwlock_write_lock(&arp_globals.lock); … … 150 150 static int arp_clear_device_req(int arp_phone, device_id_t device_id) 151 151 { 152 arp_device_ refdevice;152 arp_device_t *device; 153 153 154 154 fibril_rwlock_write_lock(&arp_globals.lock); … … 174 174 * @returns ENOMEM if there is not enough memory left. 175 175 */ 176 static int arp_proto_create(arp_proto_ ref*proto, services_t service,177 measured_string_ refaddress)176 static int arp_proto_create(arp_proto_t **proto, services_t service, 177 measured_string_t *address) 178 178 { 179 179 int rc; 180 180 181 *proto = (arp_proto_ ref) malloc(sizeof(arp_proto_t));181 *proto = (arp_proto_t *) malloc(sizeof(arp_proto_t)); 182 182 if (!*proto) 183 183 return ENOMEM; … … 213 213 */ 214 214 static int arp_device_message(device_id_t device_id, services_t service, 215 services_t protocol, measured_string_ refaddress)216 { 217 arp_device_ refdevice;218 arp_proto_ refproto;215 services_t protocol, measured_string_t *address) 216 { 217 arp_device_t *device; 218 arp_proto_t *proto; 219 219 hw_type_t hardware; 220 220 int index; … … 260 260 261 261 /* Create a new device */ 262 device = (arp_device_ ref) malloc(sizeof(arp_device_t));262 device = (arp_device_t *) malloc(sizeof(arp_device_t)); 263 263 if (!device) { 264 264 fibril_rwlock_write_unlock(&arp_globals.lock); … … 381 381 static int arp_mtu_changed_message(device_id_t device_id, size_t mtu) 382 382 { 383 arp_device_ refdevice;383 arp_device_t *device; 384 384 385 385 fibril_rwlock_write_lock(&arp_globals.lock); … … 418 418 { 419 419 size_t length; 420 arp_header_ refheader;421 arp_device_ refdevice;422 arp_proto_ refproto;423 measured_string_ refhw_source;420 arp_header_t *header; 421 arp_device_t *device; 422 arp_proto_t *proto; 423 measured_string_t *hw_source; 424 424 uint8_t *src_hw; 425 425 uint8_t *src_proto; … … 436 436 return ENOENT; 437 437 438 header = (arp_header_ ref) packet_get_data(packet);438 header = (arp_header_t *) packet_get_data(packet); 439 439 if ((ntohs(header->hardware) != device->hardware) || 440 440 (length < sizeof(arp_header_t) + header->hardware_length * 2U + … … 523 523 * @returns NULL if the hardware address is not found in the cache. 524 524 */ 525 static measured_string_ ref525 static measured_string_t * 526 526 arp_translate_message(device_id_t device_id, services_t protocol, 527 measured_string_ reftarget)528 { 529 arp_device_ refdevice;530 arp_proto_ refproto;531 measured_string_ refaddr;527 measured_string_t *target) 528 { 529 arp_device_t *device; 530 arp_proto_t *proto; 531 measured_string_t *addr; 532 532 size_t length; 533 533 packet_t packet; 534 arp_header_ refheader;534 arp_header_t *header; 535 535 536 536 if (!target) … … 561 561 return NULL; 562 562 563 header = (arp_header_ ref) packet_suffix(packet, length);563 header = (arp_header_t *) packet_suffix(packet, length); 564 564 if (!header) { 565 565 pq_release_remote(arp_globals.net_phone, packet_get_id(packet)); … … 612 612 ipc_call_t *answer, int *answer_count) 613 613 { 614 measured_string_ refaddress;615 measured_string_ reftranslation;614 measured_string_t *address; 615 measured_string_t *translation; 616 616 char *data; 617 617 packet_t packet; -
uspace/srv/net/il/arp/arp.h
r45f04f8 ra7811f17 55 55 typedef struct arp_device arp_device_t; 56 56 57 /** Type definition of the ARP device specific data pointer.58 * @see arp_device59 */60 typedef arp_device_t *arp_device_ref;61 62 57 /** Type definition of the ARP global data. 63 58 * @see arp_globals … … 69 64 */ 70 65 typedef struct arp_proto arp_proto_t; 71 72 /** Type definition of the ARP protocol specific data pointer.73 * @see arp_proto74 */75 typedef arp_proto_t *arp_proto_ref;76 66 77 67 /** ARP address map. … … 99 89 struct arp_device { 100 90 /** Actual device hardware address. */ 101 measured_string_ refaddr;91 measured_string_t * addr; 102 92 /** Actual device hardware address data. */ 103 93 char *addr_data; 104 94 /** Broadcast device hardware address. */ 105 measured_string_ refbroadcast_addr;95 measured_string_t * broadcast_addr; 106 96 /** Broadcast device hardware address data. */ 107 97 char *broadcast_data; … … 145 135 struct arp_proto { 146 136 /** Actual device protocol address. */ 147 measured_string_ refaddr;137 measured_string_t *addr; 148 138 /** Actual device protocol address data. */ 149 139 char *addr_data; -
uspace/srv/net/il/arp/arp_header.h
r45f04f8 ra7811f17 46 46 typedef struct arp_header arp_header_t; 47 47 48 /** Type definition of an ARP protocol header pointer.49 * @see arp_header50 */51 typedef arp_header_t *arp_header_ref;52 53 48 /** ARP protocol header. */ 54 49 struct arp_header { -
uspace/srv/net/il/ip/ip.c
r45f04f8 ra7811f17 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; -
uspace/srv/net/il/ip/ip.h
r45f04f8 ra7811f17 59 59 typedef struct ip_netif ip_netif_t; 60 60 61 /** Type definition of the IP network interface specific data pointer.62 * @see ip_netif63 */64 typedef ip_netif_t *ip_netif_ref;65 66 61 /** Type definition of the IP protocol specific data. 67 62 * @see ip_proto … … 69 64 typedef struct ip_proto ip_proto_t; 70 65 71 /** Type definition of the IP protocol specific data pointer.72 * @see ip_proto73 */74 typedef ip_proto_t *ip_proto_ref;75 76 66 /** Type definition of the IP route specific data. 77 67 * @see ip_route 78 68 */ 79 69 typedef struct ip_route ip_route_t; 80 81 /** Type definition of the IP route specific data pointer.82 * @see ip_route83 */84 typedef ip_route_t *ip_route_ref;85 70 86 71 /** IP network interfaces. … … 104 89 struct ip_netif { 105 90 /** ARP module. Assigned if using ARP. */ 106 module_ refarp;91 module_t *arp; 107 92 /** Broadcast address. */ 108 93 in_addr_t broadcast; … … 146 131 in_addr_t gateway; 147 132 /** Parent netif. */ 148 ip_netif_ refnetif;133 ip_netif_t *netif; 149 134 /** Target network mask. */ 150 135 in_addr_t netmask; -
uspace/srv/net/net/net.c
r45f04f8 ra7811f17 88 88 * 89 89 */ 90 int add_configuration(measured_strings_ refconfiguration, const char *name,90 int add_configuration(measured_strings_t *configuration, const char *name, 91 91 const char *value) 92 92 { 93 93 int rc; 94 94 95 measured_string_ refsetting =95 measured_string_t *setting = 96 96 measured_string_create_bulk(value, 0); 97 97 if (!setting) … … 117 117 } 118 118 119 static int parse_line(measured_strings_ refconfiguration, char *line)119 static int parse_line(measured_strings_t *configuration, char *line) 120 120 { 121 121 int rc; … … 163 163 164 164 /* Create a bulk measured string till the end */ 165 measured_string_ refsetting =165 measured_string_t *setting = 166 166 measured_string_create_bulk(value, 0); 167 167 if (!setting) … … 179 179 180 180 static int read_configuration_file(const char *directory, const char *filename, 181 measured_strings_ refconfiguration)181 measured_strings_t *configuration) 182 182 { 183 183 printf("%s: Reading configuration file %s/%s\n", NAME, directory, filename); … … 356 356 * 357 357 */ 358 static int net_get_conf(measured_strings_ refnetif_conf,359 measured_string_ refconfiguration, size_t count, char **data)358 static int net_get_conf(measured_strings_t *netif_conf, 359 measured_string_t *configuration, size_t count, char **data) 360 360 { 361 361 if (data) … … 364 364 size_t index; 365 365 for (index = 0; index < count; index++) { 366 measured_string_ refsetting =366 measured_string_t *setting = 367 367 measured_strings_find(netif_conf, configuration[index].value, 0); 368 368 if (!setting) … … 382 382 } 383 383 384 int net_get_conf_req(int net_phone, measured_string_ ref*configuration,384 int net_get_conf_req(int net_phone, measured_string_t **configuration, 385 385 size_t count, char **data) 386 386 { … … 392 392 393 393 int net_get_device_conf_req(int net_phone, device_id_t device_id, 394 measured_string_ ref*configuration, size_t count, char **data)394 measured_string_t **configuration, size_t count, char **data) 395 395 { 396 396 if ((!configuration) || (count == 0)) … … 404 404 } 405 405 406 void net_free_settings(measured_string_ refsettings, char *data)406 void net_free_settings(measured_string_t *settings, char *data) 407 407 { 408 408 } … … 429 429 430 430 /* Mandatory netif */ 431 measured_string_ refsetting =431 measured_string_t *setting = 432 432 measured_strings_find(&netif->configuration, CONF_NETIF, 0); 433 433 … … 550 550 551 551 /* Mandatory name */ 552 measured_string_ refsetting =552 measured_string_t *setting = 553 553 measured_strings_find(&netif->configuration, CONF_NAME, 0); 554 554 if (!setting) { … … 620 620 int *answer_count) 621 621 { 622 measured_string_ refstrings;622 measured_string_t *strings; 623 623 char *data; 624 624 int rc; -
uspace/srv/net/net/net.h
r45f04f8 ra7811f17 103 103 104 104 /** Serving network interface driver module index. */ 105 module_ refdriver;105 module_t *driver; 106 106 107 device_id_t id; 108 module_ ref il;/**< Serving internet layer module index. */109 char *name; 110 module_ ref 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 char *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_ ref, const char *, const char *);135 extern int add_configuration(measured_strings_t *, const char *, const char *); 136 136 extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *); 137 137 extern int net_initialize_build(async_client_conn_t); -
uspace/srv/net/netif/lo/lo.c
r45f04f8 ra7811f17 70 70 } 71 71 72 int netif_get_addr_message(device_id_t device_id, measured_string_ refaddress)72 int netif_get_addr_message(device_id_t device_id, measured_string_t *address) 73 73 { 74 74 if (!address) … … 81 81 } 82 82 83 int netif_get_device_stats(device_id_t device_id, device_stats_ refstats)83 int netif_get_device_stats(device_id_t device_id, device_stats_t *stats) 84 84 { 85 85 netif_device_t *device; … … 93 93 return rc; 94 94 95 memcpy(stats, (device_stats_ ref) device->specific,95 memcpy(stats, (device_stats_t *) device->specific, 96 96 sizeof(device_stats_t)); 97 97 … … 145 145 } 146 146 147 null_device_stats((device_stats_ ref) (*device)->specific);147 null_device_stats((device_stats_t *) (*device)->specific); 148 148 (*device)->device_id = device_id; 149 149 (*device)->nil_phone = -1; … … 204 204 next = packet; 205 205 do { 206 ((device_stats_ ref) device->specific)->send_packets++;207 ((device_stats_ ref) device->specific)->receive_packets++;206 ((device_stats_t *) device->specific)->send_packets++; 207 ((device_stats_t *) device->specific)->receive_packets++; 208 208 length = packet_get_data_length(next); 209 ((device_stats_ ref) device->specific)->send_bytes += length;210 ((device_stats_ ref) device->specific)->receive_bytes += length;209 ((device_stats_t *) device->specific)->send_bytes += length; 210 ((device_stats_t *) device->specific)->receive_bytes += length; 211 211 next = pq_next(next); 212 212 } while(next); -
uspace/srv/net/nil/eth/eth.c
r45f04f8 ra7811f17 156 156 typedef enum eth_addr_type eth_addr_type_t; 157 157 158 /** Type definition of the ethernet address type pointer.159 * @see eth_addr_type160 */161 typedef eth_addr_type_t *eth_addr_type_ref;162 163 158 /** Ethernet address type. */ 164 159 enum eth_addr_type { … … 178 173 { 179 174 int index; 180 eth_proto_ refproto;175 eth_proto_t *proto; 181 176 182 177 fibril_rwlock_read_lock(ð_globals.protos_lock); … … 286 281 size_t mtu) 287 282 { 288 eth_device_ refdevice;283 eth_device_t *device; 289 284 int index; 290 285 measured_string_t names[2] = { … … 298 293 } 299 294 }; 300 measured_string_ refconfiguration;295 measured_string_t *configuration; 301 296 size_t count = sizeof(names) / sizeof(measured_string_t); 302 297 char *data; 303 eth_proto_ refproto;298 eth_proto_t *proto; 304 299 int rc; 305 300 … … 342 337 343 338 /* Create a new device */ 344 device = (eth_device_ ref) malloc(sizeof(eth_device_t));339 device = (eth_device_t *) malloc(sizeof(eth_device_t)); 345 340 if (!device) 346 341 return ENOMEM; … … 434 429 * @returns NULL if the packet address length is not big enough. 435 430 */ 436 static eth_proto_ refeth_process_packet(int flags, packet_t packet)437 { 438 eth_header_snap_ refheader;431 static eth_proto_t *eth_process_packet(int flags, packet_t packet) 432 { 433 eth_header_snap_t *header; 439 434 size_t length; 440 435 eth_type_t type; 441 436 size_t prefix; 442 437 size_t suffix; 443 eth_fcs_ reffcs;438 eth_fcs_t *fcs; 444 439 uint8_t *data; 445 440 int rc; … … 454 449 455 450 data = packet_get_data(packet); 456 header = (eth_header_snap_ ref) data;451 header = (eth_header_snap_t *) data; 457 452 type = ntohs(header->header.ethertype); 458 453 … … 461 456 prefix = sizeof(eth_header_t); 462 457 suffix = 0; 463 fcs = (eth_fcs_ ref) data + length - sizeof(eth_fcs_t);458 fcs = (eth_fcs_t *) data + length - sizeof(eth_fcs_t); 464 459 length -= sizeof(eth_fcs_t); 465 460 } else if(type <= ETH_MAX_CONTENT) { … … 487 482 488 483 suffix = (type < ETH_MIN_CONTENT) ? ETH_MIN_CONTENT - type : 0U; 489 fcs = (eth_fcs_ ref) data + prefix + type + suffix;484 fcs = (eth_fcs_t *) data + prefix + type + suffix; 490 485 suffix += length - prefix - type; 491 486 length = prefix + type + suffix; … … 516 511 packet_t packet, services_t target) 517 512 { 518 eth_proto_ refproto;513 eth_proto_t *proto; 519 514 packet_t next; 520 eth_device_ refdevice;515 eth_device_t *device; 521 516 int flags; 522 517 … … 564 559 size_t *prefix, size_t *content, size_t *suffix) 565 560 { 566 eth_device_ refdevice;561 eth_device_t *device; 567 562 568 563 if (!addr_len || !prefix || !content || !suffix) … … 596 591 */ 597 592 static int eth_addr_message(device_id_t device_id, eth_addr_type_t type, 598 measured_string_ ref*address)599 { 600 eth_device_ refdevice;593 measured_string_t **address) 594 { 595 eth_device_t *device; 601 596 602 597 if (!address) … … 631 626 static int eth_register_message(services_t service, int phone) 632 627 { 633 eth_proto_ refproto;628 eth_proto_t *proto; 634 629 int protocol; 635 630 int index; … … 646 641 return EOK; 647 642 } else { 648 proto = (eth_proto_ ref) malloc(sizeof(eth_proto_t));643 proto = (eth_proto_t *) malloc(sizeof(eth_proto_t)); 649 644 if (!proto) { 650 645 fibril_rwlock_write_unlock(ð_globals.protos_lock); … … 688 683 size_t mtu) 689 684 { 690 eth_header_snap_ refheader;691 eth_header_lsap_ refheader_lsap;692 eth_header_ refheader_dix;693 eth_fcs_ reffcs;685 eth_header_snap_t *header; 686 eth_header_lsap_t *header_lsap; 687 eth_header_t *header_dix; 688 eth_fcs_t *fcs; 694 689 uint8_t *src; 695 690 uint8_t *dest; … … 697 692 int i; 698 693 void *padding; 699 eth_preamble_ refpreamble;694 eth_preamble_t *preamble; 700 695 701 696 i = packet_get_addr(packet, &src, &dest); … … 795 790 services_t sender) 796 791 { 797 eth_device_ refdevice;792 eth_device_t *device; 798 793 packet_t next; 799 794 packet_t tmp; … … 845 840 ipc_call_t *call, ipc_call_t *answer, int *answer_count) 846 841 { 847 measured_string_ refaddress;842 measured_string_t *address; 848 843 packet_t packet; 849 844 size_t addrlen; -
uspace/srv/net/nil/eth/eth.h
r45f04f8 ra7811f17 54 54 typedef struct eth_device eth_device_t; 55 55 56 /** Type definition of the Ethernet device specific data pointer.57 * @see eth_device58 */59 typedef eth_device_t *eth_device_ref;60 61 56 /** Type definition of the Ethernet protocol specific data. 62 57 * @see eth_proto 63 58 */ 64 59 typedef struct eth_proto eth_proto_t; 65 66 /** Type definition of the Ethernet protocol specific data pointer.67 * @see eth_proto68 */69 typedef eth_proto_t *eth_proto_ref;70 60 71 61 /** Ethernet device map. … … 100 90 101 91 /** Actual device hardware address. */ 102 measured_string_ refaddr;92 measured_string_t *addr; 103 93 /** Actual device hardware address data. */ 104 94 char *addr_data; … … 133 123 134 124 /** Broadcast device hardware address. */ 135 measured_string_ refbroadcast_addr;125 measured_string_t *broadcast_addr; 136 126 }; 137 127 -
uspace/srv/net/nil/eth/eth_header.h
r45f04f8 ra7811f17 58 58 typedef struct eth_header_snap eth_header_snap_t; 59 59 60 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions61 * pointer.62 *63 * @see eth_header_snap64 */65 typedef eth_header_snap_t *eth_header_snap_ref;66 67 60 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions. 68 61 * @see eth_header_lsap 69 62 */ 70 63 typedef struct eth_header_lsap eth_header_lsap_t; 71 72 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 extension pointer.73 * @see eth_header_lsap74 */75 typedef eth_header_lsap_t *eth_header_lsap_ref;76 64 77 65 /** Type definition of the Ethernet header LSAP extension. … … 80 68 typedef struct eth_ieee_lsap eth_ieee_lsap_t; 81 69 82 /** Type definition of the Ethernet header LSAP extension pointer.83 * @see eth_ieee_lsap84 */85 typedef eth_ieee_lsap_t *eth_ieee_lsap_ref;86 87 70 /** Type definition of the Ethernet header SNAP extension. 88 71 * @see eth_snap 89 72 */ 90 73 typedef struct eth_snap eth_snap_t; 91 92 /** Type definition of the Ethernet header SNAP extension pointer.93 * @see eth_snap94 */95 typedef eth_snap_t *eth_snap_ref;96 74 97 75 /** Type definition of the Ethernet header preamble. … … 100 78 typedef struct eth_preamble eth_preamble_t; 101 79 102 /** Type definition of the Ethernet header preamble pointer.103 * @see eth_preamble104 */105 typedef eth_preamble_t *eth_preamble_ref;106 107 80 /** Type definition of the Ethernet header. 108 81 * @see eth_header 109 82 */ 110 83 typedef struct eth_header eth_header_t; 111 112 /** Type definition of the Ethernet header pointer.113 * @see eth_header114 */115 typedef eth_header_t *eth_header_ref;116 84 117 85 /** Ethernet header Link Service Access Point extension. */ … … 219 187 typedef uint32_t eth_fcs_t; 220 188 221 /** Ethernet Frame Check Sequence pointer. */222 typedef eth_fcs_t *eth_fcs_ref;223 224 189 #endif 225 190 -
uspace/srv/net/nil/nildummy/nildummy.c
r45f04f8 ra7811f17 153 153 size_t mtu) 154 154 { 155 nildummy_device_ refdevice;155 nildummy_device_t *device; 156 156 int index; 157 157 int rc; … … 192 192 193 193 /* Create a new device */ 194 device = (nildummy_device_ ref) malloc(sizeof(nildummy_device_t));194 device = (nildummy_device_t *) malloc(sizeof(nildummy_device_t)); 195 195 if (!device) 196 196 return ENOMEM; … … 248 248 */ 249 249 static int nildummy_addr_message(device_id_t device_id, 250 measured_string_ ref*address)251 { 252 nildummy_device_ refdevice;250 measured_string_t **address) 251 { 252 nildummy_device_t *device; 253 253 254 254 if (!address) … … 282 282 size_t *prefix, size_t *content, size_t *suffix) 283 283 { 284 nildummy_device_ refdevice;284 nildummy_device_t *device; 285 285 286 286 if (!addr_len || !prefix || !content || !suffix) … … 357 357 services_t sender) 358 358 { 359 nildummy_device_ refdevice;359 nildummy_device_t *device; 360 360 361 361 fibril_rwlock_read_lock(&nildummy_globals.devices_lock); … … 377 377 ipc_call_t *call, ipc_call_t *answer, int *answer_count) 378 378 { 379 measured_string_ refaddress;379 measured_string_t *address; 380 380 packet_t packet; 381 381 size_t addrlen; -
uspace/srv/net/nil/nildummy/nildummy.h
r45f04f8 ra7811f17 54 54 typedef struct nildummy_device nildummy_device_t; 55 55 56 /** Type definition of the dummy nil device specific data pointer.57 * @see nildummy_device58 */59 typedef nildummy_device_t *nildummy_device_ref;60 61 56 /** Type definition of the dummy nil protocol specific data. 62 57 * @see nildummy_proto 63 58 */ 64 59 typedef struct nildummy_proto nildummy_proto_t; 65 66 /** Type definition of the dummy nil protocol specific data pointer.67 * @see nildummy_proto68 */69 typedef nildummy_proto_t *nildummy_proto_ref;70 60 71 61 /** Dummy nil device map. … … 86 76 size_t mtu; 87 77 /** Actual device hardware address. */ 88 measured_string_ refaddr;78 measured_string_t *addr; 89 79 /** Actual device hardware address data. */ 90 80 char *addr_data; -
uspace/srv/net/tl/icmp/icmp.c
r45f04f8 ra7811f17 156 156 */ 157 157 static int icmp_send_packet(icmp_type_t type, icmp_code_t code, packet_t packet, 158 icmp_header_ refheader, services_t error, ip_ttl_t ttl, ip_tos_t tos,158 icmp_header_t *header, services_t error, ip_ttl_t ttl, ip_tos_t tos, 159 159 int dont_fragment) 160 160 { … … 189 189 * @returns NULL on errors. 190 190 */ 191 static icmp_header_ reficmp_prepare_packet(packet_t packet)192 { 193 icmp_header_ refheader;191 static icmp_header_t *icmp_prepare_packet(packet_t packet) 192 { 193 icmp_header_t *header; 194 194 size_t header_length; 195 195 size_t total_length; … … 247 247 const struct sockaddr * addr, socklen_t addrlen) 248 248 { 249 icmp_header_ refheader;249 icmp_header_t *header; 250 250 packet_t packet; 251 251 size_t length; 252 252 uint8_t *data; 253 icmp_reply_ refreply;253 icmp_reply_t *reply; 254 254 int reply_key; 255 255 int index; … … 342 342 icmp_code_t code, icmp_param_t mtu, packet_t packet) 343 343 { 344 icmp_header_ refheader;344 icmp_header_t *header; 345 345 346 346 header = icmp_prepare_packet(packet); … … 357 357 static int icmp_source_quench_msg_local(int icmp_phone, packet_t packet) 358 358 { 359 icmp_header_ refheader;359 icmp_header_t *header; 360 360 361 361 header = icmp_prepare_packet(packet); … … 370 370 packet_t packet) 371 371 { 372 icmp_header_ refheader;372 icmp_header_t *header; 373 373 374 374 header = icmp_prepare_packet(packet); … … 383 383 icmp_param_t pointer, packet_t packet) 384 384 { 385 icmp_header_ refheader;385 icmp_header_t *header; 386 386 387 387 header = icmp_prepare_packet(packet); … … 413 413 } 414 414 }; 415 measured_string_ refconfiguration;415 measured_string_t *configuration; 416 416 size_t count = sizeof(names) / sizeof(measured_string_t); 417 417 char *data; … … 479 479 * @param[in] code The received reply message code. 480 480 */ 481 static void icmp_process_echo_reply(packet_t packet, icmp_header_ refheader,481 static void icmp_process_echo_reply(packet_t packet, icmp_header_t *header, 482 482 icmp_type_t type, icmp_code_t code) 483 483 { 484 484 int reply_key; 485 icmp_reply_ refreply;485 icmp_reply_t *reply; 486 486 487 487 /* Compute the reply key */ … … 525 525 int result; 526 526 void *data; 527 icmp_header_ refheader;527 icmp_header_t *header; 528 528 icmp_type_t type; 529 529 icmp_code_t code; … … 567 567 568 568 /* Get ICMP header */ 569 header = (icmp_header_ ref) data;569 header = (icmp_header_t *) data; 570 570 571 571 if (header->checksum) { … … 735 735 * @returns ENOTCONN if no free identifier have been found. 736 736 */ 737 static int icmp_bind_free_id(icmp_echo_ refecho_data)737 static int icmp_bind_free_id(icmp_echo_t *echo_data) 738 738 { 739 739 icmp_param_t index; … … 791 791 struct sockaddr *addr; 792 792 ipc_callid_t data_callid; 793 icmp_echo_ refecho_data;793 icmp_echo_t *echo_data; 794 794 int rc = EOK; 795 795 … … 800 800 answer_count = 0; 801 801 802 echo_data = (icmp_echo_ ref) malloc(sizeof(*echo_data));802 echo_data = (icmp_echo_t *) malloc(sizeof(*echo_data)); 803 803 if (!echo_data) 804 804 return ENOMEM; -
uspace/srv/net/tl/icmp/icmp.h
r45f04f8 ra7811f17 49 49 */ 50 50 typedef struct icmp_reply icmp_reply_t; 51 52 /** Type definition of the ICMP reply data pointer.53 * @see icmp_reply54 */55 typedef icmp_reply_t *icmp_reply_ref;56 51 57 52 /** Type definition of the ICMP global data. -
uspace/srv/net/tl/tcp/tcp.c
r45f04f8 ra7811f17 127 127 typedef struct tcp_timeout tcp_timeout_t; 128 128 129 /** Type definition of the TCP timeout pointer.130 * @see tcp_timeout131 */132 typedef tcp_timeout_t *tcp_timeout_ref;133 134 129 /** TCP reply timeout data. 135 130 * Used as a timeouting fibril argument. … … 144 139 145 140 /** Local sockets. */ 146 socket_cores_ reflocal_sockets;141 socket_cores_t *local_sockets; 147 142 148 143 /** Socket identifier. */ … … 166 161 167 162 static int tcp_release_and_return(packet_t, int); 168 static void tcp_prepare_operation_header(socket_core_ ref, tcp_socket_data_ref,169 tcp_header_ ref, int synchronize, int);170 static int tcp_prepare_timeout(int (*)(void *), socket_core_ ref,171 tcp_socket_data_ ref, size_t, tcp_socket_state_t, suseconds_t, int);172 static void tcp_free_socket_data(socket_core_ ref);163 static void tcp_prepare_operation_header(socket_core_t *, tcp_socket_data_t *, 164 tcp_header_t *, int synchronize, int); 165 static int tcp_prepare_timeout(int (*)(void *), socket_core_t *, 166 tcp_socket_data_t *, size_t, tcp_socket_state_t, suseconds_t, int); 167 static void tcp_free_socket_data(socket_core_t *); 173 168 174 169 static int tcp_timeout(void *); … … 177 172 178 173 static int tcp_process_packet(device_id_t, packet_t, services_t); 179 static int tcp_connect_core(socket_core_ ref, socket_cores_ref,174 static int tcp_connect_core(socket_core_t *, socket_cores_t *, 180 175 struct sockaddr *, socklen_t); 181 static int tcp_queue_prepare_packet(socket_core_ ref, tcp_socket_data_ref,176 static int tcp_queue_prepare_packet(socket_core_t *, tcp_socket_data_t *, 182 177 packet_t, size_t); 183 static int tcp_queue_packet(socket_core_ ref, tcp_socket_data_ref, packet_t,178 static int tcp_queue_packet(socket_core_t *, tcp_socket_data_t *, packet_t, 184 179 size_t); 185 static packet_t tcp_get_packets_to_send(socket_core_ ref, tcp_socket_data_ref);180 static packet_t tcp_get_packets_to_send(socket_core_t *, tcp_socket_data_t *); 186 181 static void tcp_send_packets(device_id_t, packet_t); 187 182 188 static void tcp_process_acknowledgement(socket_core_ ref, tcp_socket_data_ref,189 tcp_header_ ref);190 static packet_t tcp_send_prepare_packet(socket_core_ ref, tcp_socket_data_ref,183 static void tcp_process_acknowledgement(socket_core_t *, tcp_socket_data_t *, 184 tcp_header_t *); 185 static packet_t tcp_send_prepare_packet(socket_core_t *, tcp_socket_data_t *, 191 186 packet_t, size_t, size_t); 192 static packet_t tcp_prepare_copy(socket_core_ ref, tcp_socket_data_ref, packet_t,187 static packet_t tcp_prepare_copy(socket_core_t *, tcp_socket_data_t *, packet_t, 193 188 size_t, size_t); 194 /* static */ void tcp_retransmit_packet(socket_core_ ref, tcp_socket_data_ref,189 /* static */ void tcp_retransmit_packet(socket_core_t *, tcp_socket_data_t *, 195 190 size_t); 196 static int tcp_create_notification_packet(packet_t *, socket_core_ ref,197 tcp_socket_data_ ref, int, int);198 static void tcp_refresh_socket_data(tcp_socket_data_ ref);199 200 static void tcp_initialize_socket_data(tcp_socket_data_ ref);201 202 static int tcp_process_listen(socket_core_ ref, tcp_socket_data_ref,203 tcp_header_ ref, packet_t, struct sockaddr *, struct sockaddr *, size_t);204 static int tcp_process_syn_sent(socket_core_ ref, tcp_socket_data_ref,205 tcp_header_ ref, packet_t);206 static int tcp_process_syn_received(socket_core_ ref, tcp_socket_data_ref,207 tcp_header_ ref, packet_t);208 static int tcp_process_established(socket_core_ ref, tcp_socket_data_ref,209 tcp_header_ ref, packet_t, int, size_t);210 static int tcp_queue_received_packet(socket_core_ ref, tcp_socket_data_ref,191 static int tcp_create_notification_packet(packet_t *, socket_core_t *, 192 tcp_socket_data_t *, int, int); 193 static void tcp_refresh_socket_data(tcp_socket_data_t *); 194 195 static void tcp_initialize_socket_data(tcp_socket_data_t *); 196 197 static int tcp_process_listen(socket_core_t *, tcp_socket_data_t *, 198 tcp_header_t *, packet_t, struct sockaddr *, struct sockaddr *, size_t); 199 static int tcp_process_syn_sent(socket_core_t *, tcp_socket_data_t *, 200 tcp_header_t *, packet_t); 201 static int tcp_process_syn_received(socket_core_t *, tcp_socket_data_t *, 202 tcp_header_t *, packet_t); 203 static int tcp_process_established(socket_core_t *, tcp_socket_data_t *, 204 tcp_header_t *, packet_t, int, size_t); 205 static int tcp_queue_received_packet(socket_core_t *, tcp_socket_data_t *, 211 206 packet_t, int, size_t); 212 207 … … 214 209 static int tcp_process_client_messages(ipc_callid_t, ipc_call_t); 215 210 216 static int tcp_listen_message(socket_cores_ ref, int, int);217 static int tcp_connect_message(socket_cores_ ref, int, struct sockaddr *,211 static int tcp_listen_message(socket_cores_t *, int, int); 212 static int tcp_connect_message(socket_cores_t *, int, struct sockaddr *, 218 213 socklen_t); 219 static int tcp_recvfrom_message(socket_cores_ ref, int, int, size_t *);220 static int tcp_send_message(socket_cores_ ref, int, int, size_t *, int);221 static int tcp_accept_message(socket_cores_ ref, int, int, size_t *, size_t *);222 static int tcp_close_message(socket_cores_ ref, int);214 static int tcp_recvfrom_message(socket_cores_t *, int, int, size_t *); 215 static int tcp_send_message(socket_cores_t *, int, int, size_t *, int); 216 static int tcp_accept_message(socket_cores_t *, int, int, size_t *, size_t *); 217 static int tcp_close_message(socket_cores_t *, int); 223 218 224 219 /** TCP global data. */ … … 290 285 size_t offset; 291 286 int result; 292 tcp_header_ refheader;293 socket_core_ refsocket;294 tcp_socket_data_ refsocket_data;287 tcp_header_t *header; 288 socket_core_t *socket; 289 tcp_socket_data_t *socket_data; 295 290 packet_t next_packet; 296 291 size_t total_length; … … 343 338 344 339 /* Get tcp header */ 345 header = (tcp_header_ ref) packet_get_data(packet);340 header = (tcp_header_t *) packet_get_data(packet); 346 341 if (!header) 347 342 return tcp_release_and_return(packet, NO_DATA); … … 380 375 381 376 printf("socket id %d\n", socket->socket_id); 382 socket_data = (tcp_socket_data_ ref) socket->specific_data;377 socket_data = (tcp_socket_data_t *) socket->specific_data; 383 378 assert(socket_data); 384 379 … … 497 492 } 498 493 499 int tcp_process_established(socket_core_ ref socket, tcp_socket_data_ref500 socket_data, tcp_header_ refheader, packet_t packet, int fragments,494 int tcp_process_established(socket_core_t *socket, tcp_socket_data_t * 495 socket_data, tcp_header_t *header, packet_t packet, int fragments, 501 496 size_t total_length) 502 497 { … … 805 800 } 806 801 807 int tcp_queue_received_packet(socket_core_ refsocket,808 tcp_socket_data_ refsocket_data, packet_t packet, int fragments,802 int tcp_queue_received_packet(socket_core_t *socket, 803 tcp_socket_data_t *socket_data, packet_t packet, int fragments, 809 804 size_t total_length) 810 805 { 811 packet_dimension_ refpacket_dimension;806 packet_dimension_t *packet_dimension; 812 807 int rc; 813 808 … … 842 837 } 843 838 844 int tcp_process_syn_sent(socket_core_ ref socket, tcp_socket_data_ref845 socket_data, tcp_header_ refheader, packet_t packet)839 int tcp_process_syn_sent(socket_core_t *socket, tcp_socket_data_t * 840 socket_data, tcp_header_t *header, packet_t packet) 846 841 { 847 842 packet_t next_packet; … … 900 895 } 901 896 902 int tcp_process_listen(socket_core_ reflistening_socket,903 tcp_socket_data_ ref listening_socket_data, tcp_header_refheader,897 int tcp_process_listen(socket_core_t *listening_socket, 898 tcp_socket_data_t *listening_socket_data, tcp_header_t *header, 904 899 packet_t packet, struct sockaddr *src, struct sockaddr *dest, 905 900 size_t addrlen) 906 901 { 907 902 packet_t next_packet; 908 socket_core_ refsocket;909 tcp_socket_data_ refsocket_data;903 socket_core_t *socket; 904 tcp_socket_data_t *socket_data; 910 905 int socket_id; 911 906 int listening_socket_id = listening_socket->socket_id; … … 922 917 return tcp_release_and_return(packet, EINVAL); 923 918 924 socket_data = (tcp_socket_data_ ref) malloc(sizeof(*socket_data));919 socket_data = (tcp_socket_data_t *) malloc(sizeof(*socket_data)); 925 920 if (!socket_data) 926 921 return tcp_release_and_return(packet, ENOMEM); … … 979 974 } 980 975 listening_socket_data = 981 (tcp_socket_data_ ref) listening_socket->specific_data;976 (tcp_socket_data_t *) listening_socket->specific_data; 982 977 assert(listening_socket_data); 983 978 … … 991 986 return ENOTSOCK; 992 987 } 993 socket_data = (tcp_socket_data_ ref) socket->specific_data;988 socket_data = (tcp_socket_data_t *) socket->specific_data; 994 989 assert(socket_data); 995 990 … … 1060 1055 } 1061 1056 1062 int tcp_process_syn_received(socket_core_ refsocket,1063 tcp_socket_data_ ref socket_data, tcp_header_refheader, packet_t packet)1064 { 1065 socket_core_ reflistening_socket;1066 tcp_socket_data_ reflistening_socket_data;1057 int tcp_process_syn_received(socket_core_t *socket, 1058 tcp_socket_data_t *socket_data, tcp_header_t *header, packet_t packet) 1059 { 1060 socket_core_t *listening_socket; 1061 tcp_socket_data_t *listening_socket_data; 1067 1062 int rc; 1068 1063 … … 1086 1081 if (listening_socket) { 1087 1082 listening_socket_data = 1088 (tcp_socket_data_ ref) listening_socket->specific_data;1083 (tcp_socket_data_t *) listening_socket->specific_data; 1089 1084 assert(listening_socket_data); 1090 1085 … … 1127 1122 } 1128 1123 1129 void tcp_process_acknowledgement(socket_core_ refsocket,1130 tcp_socket_data_ ref socket_data, tcp_header_refheader)1124 void tcp_process_acknowledgement(socket_core_t *socket, 1125 tcp_socket_data_t *socket_data, tcp_header_t *header) 1131 1126 { 1132 1127 size_t number; … … 1265 1260 } 1266 1261 1267 void tcp_refresh_socket_data(tcp_socket_data_ refsocket_data)1262 void tcp_refresh_socket_data(tcp_socket_data_t *socket_data) 1268 1263 { 1269 1264 assert(socket_data); … … 1281 1276 } 1282 1277 1283 void tcp_initialize_socket_data(tcp_socket_data_ refsocket_data)1278 void tcp_initialize_socket_data(tcp_socket_data_t *socket_data) 1284 1279 { 1285 1280 assert(socket_data); … … 1304 1299 ipc_call_t answer; 1305 1300 int answer_count; 1306 tcp_socket_data_ refsocket_data;1307 socket_core_ refsocket;1308 packet_dimension_ refpacket_dimension;1301 tcp_socket_data_t *socket_data; 1302 socket_core_t *socket; 1303 packet_dimension_t *packet_dimension; 1309 1304 1310 1305 /* … … 1336 1331 case NET_SOCKET: 1337 1332 socket_data = 1338 (tcp_socket_data_ ref) malloc(sizeof(*socket_data));1333 (tcp_socket_data_t *) malloc(sizeof(*socket_data)); 1339 1334 if (!socket_data) { 1340 1335 res = ENOMEM; … … 1383 1378 SOCKET_GET_SOCKET_ID(call)); 1384 1379 if (socket) { 1385 socket_data = (tcp_socket_data_ ref)1380 socket_data = (tcp_socket_data_t *) 1386 1381 socket->specific_data; 1387 1382 assert(socket_data); … … 1540 1535 int tcp_timeout(void *data) 1541 1536 { 1542 tcp_timeout_ reftimeout = data;1537 tcp_timeout_t *timeout = data; 1543 1538 int keep_write_lock = false; 1544 socket_core_ refsocket;1545 tcp_socket_data_ refsocket_data;1539 socket_core_t *socket; 1540 tcp_socket_data_t *socket_data; 1546 1541 1547 1542 assert(timeout); … … 1561 1556 goto out; 1562 1557 1563 socket_data = (tcp_socket_data_ ref) socket->specific_data;1558 socket_data = (tcp_socket_data_t *) socket->specific_data; 1564 1559 assert(socket_data); 1565 1560 if (socket_data->local_sockets != timeout->local_sockets) … … 1617 1612 int tcp_release_after_timeout(void *data) 1618 1613 { 1619 tcp_timeout_ reftimeout = data;1620 socket_core_ refsocket;1621 tcp_socket_data_ refsocket_data;1614 tcp_timeout_t *timeout = data; 1615 socket_core_t *socket; 1616 tcp_socket_data_t *socket_data; 1622 1617 fibril_rwlock_t *local_lock; 1623 1618 … … 1635 1630 1636 1631 if (socket && (socket->socket_id == timeout->socket_id)) { 1637 socket_data = (tcp_socket_data_ ref) socket->specific_data;1632 socket_data = (tcp_socket_data_t *) socket->specific_data; 1638 1633 assert(socket_data); 1639 1634 if (socket_data->local_sockets == timeout->local_sockets) { … … 1656 1651 } 1657 1652 1658 void tcp_retransmit_packet(socket_core_ ref socket, tcp_socket_data_ref1653 void tcp_retransmit_packet(socket_core_t *socket, tcp_socket_data_t * 1659 1654 socket_data, size_t sequence_number) 1660 1655 { … … 1683 1678 } 1684 1679 1685 int tcp_listen_message(socket_cores_ reflocal_sockets, int socket_id,1680 int tcp_listen_message(socket_cores_t *local_sockets, int socket_id, 1686 1681 int backlog) 1687 1682 { 1688 socket_core_ refsocket;1689 tcp_socket_data_ refsocket_data;1683 socket_core_t *socket; 1684 tcp_socket_data_t *socket_data; 1690 1685 1691 1686 assert(local_sockets); … … 1700 1695 1701 1696 /* Get the socket specific data */ 1702 socket_data = (tcp_socket_data_ ref) socket->specific_data;1697 socket_data = (tcp_socket_data_t *) socket->specific_data; 1703 1698 assert(socket_data); 1704 1699 … … 1709 1704 } 1710 1705 1711 int tcp_connect_message(socket_cores_ reflocal_sockets, int socket_id,1706 int tcp_connect_message(socket_cores_t *local_sockets, int socket_id, 1712 1707 struct sockaddr *addr, socklen_t addrlen) 1713 1708 { 1714 socket_core_ refsocket;1709 socket_core_t *socket; 1715 1710 int rc; 1716 1711 … … 1737 1732 } 1738 1733 1739 int tcp_connect_core(socket_core_ ref socket, socket_cores_reflocal_sockets,1734 int tcp_connect_core(socket_core_t *socket, socket_cores_t *local_sockets, 1740 1735 struct sockaddr *addr, socklen_t addrlen) 1741 1736 { 1742 tcp_socket_data_ refsocket_data;1737 tcp_socket_data_t *socket_data; 1743 1738 packet_t packet; 1744 1739 int rc; … … 1749 1744 1750 1745 /* Get the socket specific data */ 1751 socket_data = (tcp_socket_data_ ref) socket->specific_data;1746 socket_data = (tcp_socket_data_t *) socket->specific_data; 1752 1747 assert(socket_data); 1753 1748 assert(socket->specific_data == socket_data); … … 1828 1823 } 1829 1824 1830 int tcp_queue_prepare_packet(socket_core_ refsocket,1831 tcp_socket_data_ refsocket_data, packet_t packet, size_t data_length)1832 { 1833 tcp_header_ refheader;1825 int tcp_queue_prepare_packet(socket_core_t *socket, 1826 tcp_socket_data_t *socket_data, packet_t packet, size_t data_length) 1827 { 1828 tcp_header_t *header; 1834 1829 int rc; 1835 1830 … … 1839 1834 1840 1835 /* Get TCP header */ 1841 header = (tcp_header_ ref) packet_get_data(packet);1836 header = (tcp_header_t *) packet_get_data(packet); 1842 1837 if (!header) 1843 1838 return NO_DATA; … … 1859 1854 } 1860 1855 1861 int tcp_queue_packet(socket_core_ ref socket, tcp_socket_data_refsocket_data,1856 int tcp_queue_packet(socket_core_t *socket, tcp_socket_data_t *socket_data, 1862 1857 packet_t packet, size_t data_length) 1863 1858 { … … 1881 1876 } 1882 1877 1883 packet_t tcp_get_packets_to_send(socket_core_ ref socket, tcp_socket_data_ref1878 packet_t tcp_get_packets_to_send(socket_core_t *socket, tcp_socket_data_t * 1884 1879 socket_data) 1885 1880 { … … 1941 1936 } 1942 1937 1943 packet_t tcp_send_prepare_packet(socket_core_ ref socket, tcp_socket_data_ref1938 packet_t tcp_send_prepare_packet(socket_core_t *socket, tcp_socket_data_t * 1944 1939 socket_data, packet_t packet, size_t data_length, size_t sequence_number) 1945 1940 { 1946 tcp_header_ refheader;1941 tcp_header_t *header; 1947 1942 uint32_t checksum; 1948 1943 int rc; … … 1961 1956 1962 1957 /* Get the header */ 1963 header = (tcp_header_ ref) packet_get_data(packet);1958 header = (tcp_header_t *) packet_get_data(packet); 1964 1959 if (!header) { 1965 1960 pq_release_remote(tcp_globals.net_phone, packet_get_id(packet)); … … 2002 1997 } 2003 1998 2004 packet_t tcp_prepare_copy(socket_core_ ref socket, tcp_socket_data_ref1999 packet_t tcp_prepare_copy(socket_core_t *socket, tcp_socket_data_t * 2005 2000 socket_data, packet_t packet, size_t data_length, size_t sequence_number) 2006 2001 { … … 2032 2027 } 2033 2028 2034 void tcp_prepare_operation_header(socket_core_ refsocket,2035 tcp_socket_data_ ref socket_data, tcp_header_refheader, int synchronize,2029 void tcp_prepare_operation_header(socket_core_t *socket, 2030 tcp_socket_data_t *socket_data, tcp_header_t *header, int synchronize, 2036 2031 int finalize) 2037 2032 { … … 2050 2045 2051 2046 int tcp_prepare_timeout(int (*timeout_function)(void *tcp_timeout_t), 2052 socket_core_ ref socket, tcp_socket_data_refsocket_data,2047 socket_core_t *socket, tcp_socket_data_t *socket_data, 2053 2048 size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout, 2054 2049 int globals_read_only) 2055 2050 { 2056 tcp_timeout_ refoperation_timeout;2051 tcp_timeout_t *operation_timeout; 2057 2052 fid_t fibril; 2058 2053 … … 2096 2091 } 2097 2092 2098 int tcp_recvfrom_message(socket_cores_ reflocal_sockets, int socket_id,2093 int tcp_recvfrom_message(socket_cores_t *local_sockets, int socket_id, 2099 2094 int flags, size_t *addrlen) 2100 2095 { 2101 socket_core_ refsocket;2102 tcp_socket_data_ refsocket_data;2096 socket_core_t *socket; 2097 tcp_socket_data_t *socket_data; 2103 2098 int packet_id; 2104 2099 packet_t packet; … … 2117 2112 return NO_DATA; 2118 2113 2119 socket_data = (tcp_socket_data_ ref) socket->specific_data;2114 socket_data = (tcp_socket_data_t *) socket->specific_data; 2120 2115 2121 2116 /* Check state */ … … 2154 2149 } 2155 2150 2156 int tcp_send_message(socket_cores_ reflocal_sockets, int socket_id,2151 int tcp_send_message(socket_cores_t *local_sockets, int socket_id, 2157 2152 int fragments, size_t *data_fragment_size, int flags) 2158 2153 { 2159 socket_core_ refsocket;2160 tcp_socket_data_ refsocket_data;2161 packet_dimension_ refpacket_dimension;2154 socket_core_t *socket; 2155 tcp_socket_data_t *socket_data; 2156 packet_dimension_t *packet_dimension; 2162 2157 packet_t packet; 2163 2158 size_t total_length; 2164 tcp_header_ refheader;2159 tcp_header_t *header; 2165 2160 int index; 2166 2161 int result; … … 2179 2174 return NO_DATA; 2180 2175 2181 socket_data = (tcp_socket_data_ ref) socket->specific_data;2176 socket_data = (tcp_socket_data_t *) socket->specific_data; 2182 2177 2183 2178 /* Check state */ … … 2230 2225 2231 2226 int 2232 tcp_close_message(socket_cores_ reflocal_sockets, int socket_id)2233 { 2234 socket_core_ refsocket;2235 tcp_socket_data_ refsocket_data;2227 tcp_close_message(socket_cores_t *local_sockets, int socket_id) 2228 { 2229 socket_core_t *socket; 2230 tcp_socket_data_t *socket_data; 2236 2231 packet_t packet; 2237 2232 int rc; … … 2243 2238 2244 2239 /* Get the socket specific data */ 2245 socket_data = (tcp_socket_data_ ref) socket->specific_data;2240 socket_data = (tcp_socket_data_t *) socket->specific_data; 2246 2241 assert(socket_data); 2247 2242 … … 2298 2293 } 2299 2294 2300 int tcp_create_notification_packet(packet_t *packet, socket_core_ refsocket,2301 tcp_socket_data_ refsocket_data, int synchronize, int finalize)2302 { 2303 packet_dimension_ refpacket_dimension;2304 tcp_header_ refheader;2295 int tcp_create_notification_packet(packet_t *packet, socket_core_t *socket, 2296 tcp_socket_data_t *socket_data, int synchronize, int finalize) 2297 { 2298 packet_dimension_t *packet_dimension; 2299 tcp_header_t *header; 2305 2300 int rc; 2306 2301 … … 2332 2327 } 2333 2328 2334 int tcp_accept_message(socket_cores_ reflocal_sockets, int socket_id,2329 int tcp_accept_message(socket_cores_t *local_sockets, int socket_id, 2335 2330 int new_socket_id, size_t *data_fragment_size, size_t *addrlen) 2336 2331 { 2337 socket_core_ refaccepted;2338 socket_core_ refsocket;2339 tcp_socket_data_ refsocket_data;2340 packet_dimension_ refpacket_dimension;2332 socket_core_t *accepted; 2333 socket_core_t *socket; 2334 tcp_socket_data_t *socket_data; 2335 packet_dimension_t *packet_dimension; 2341 2336 int rc; 2342 2337 … … 2351 2346 2352 2347 /* Get the socket specific data */ 2353 socket_data = (tcp_socket_data_ ref) socket->specific_data;2348 socket_data = (tcp_socket_data_t *) socket->specific_data; 2354 2349 assert(socket_data); 2355 2350 … … 2369 2364 2370 2365 /* Get the socket specific data */ 2371 socket_data = (tcp_socket_data_ ref) accepted->specific_data;2366 socket_data = (tcp_socket_data_t *) accepted->specific_data; 2372 2367 assert(socket_data); 2373 2368 /* TODO can it be in another state? */ … … 2405 2400 } 2406 2401 2407 void tcp_free_socket_data(socket_core_ refsocket)2408 { 2409 tcp_socket_data_ refsocket_data;2402 void tcp_free_socket_data(socket_core_t *socket) 2403 { 2404 tcp_socket_data_t *socket_data; 2410 2405 2411 2406 assert(socket); … … 2414 2409 2415 2410 /* Get the socket specific data */ 2416 socket_data = (tcp_socket_data_ ref) socket->specific_data;2411 socket_data = (tcp_socket_data_t *) socket->specific_data; 2417 2412 assert(socket_data); 2418 2413 -
uspace/srv/net/tl/tcp/tcp.h
r45f04f8 ra7811f17 55 55 typedef struct tcp_socket_data tcp_socket_data_t; 56 56 57 /** Type definition of the TCP socket specific data pointer.58 * @see tcp_socket_data59 */60 typedef tcp_socket_data_t *tcp_socket_data_ref;61 62 57 /** Type definition of the TCP operation data. 63 58 * @see tcp_operation 64 59 */ 65 60 typedef struct tcp_operation tcp_operation_t; 66 67 /** Type definition of the TCP operation data pointer.68 * @see tcp_operation69 */70 typedef tcp_operation_t *tcp_operation_ref;71 61 72 62 /** TCP socket state type definition. … … 272 262 uint16_t dest_port; 273 263 /** Parent local sockets. */ 274 socket_cores_ reflocal_sockets;264 socket_cores_t *local_sockets; 275 265 276 266 /** Local sockets safety lock. -
uspace/srv/net/tl/tcp/tcp_header.h
r45f04f8 ra7811f17 59 59 typedef struct tcp_header tcp_header_t; 60 60 61 /** Type definition of the transmission datagram header pointer.62 * @see tcp_header63 */64 typedef tcp_header_t *tcp_header_ref;65 66 61 /** Type definition of the transmission datagram header option. 67 62 * @see tcp_option … … 69 64 typedef struct tcp_option tcp_option_t; 70 65 71 /** Type definition of the transmission datagram header option pointer.72 * @see tcp_option73 */74 typedef tcp_option_t *tcp_option_ref;75 76 66 /** Type definition of the Maximum segment size TCP option. */ 77 67 typedef struct tcp_max_segment_size_option tcp_max_segment_size_option_t; 78 79 /** Type definition of the Maximum segment size TCP option pointer.80 * @see tcp_max_segment_size_option81 */82 typedef tcp_max_segment_size_option_t *tcp_max_segment_size_option_ref;83 68 84 69 /** Transmission datagram header. */ -
uspace/srv/net/tl/udp/udp.c
r45f04f8 ra7811f17 112 112 } 113 113 }; 114 measured_string_ refconfiguration;114 measured_string_t *configuration; 115 115 size_t count = sizeof(names) / sizeof(measured_string_t); 116 116 char *data; … … 223 223 size_t offset; 224 224 int result; 225 udp_header_ refheader;226 socket_core_ refsocket;225 udp_header_t *header; 226 socket_core_t *socket; 227 227 packet_t next_packet; 228 228 size_t total_length; … … 235 235 struct sockaddr *src; 236 236 struct sockaddr *dest; 237 packet_dimension_ refpacket_dimension;237 packet_dimension_t *packet_dimension; 238 238 int rc; 239 239 … … 277 277 278 278 /* Get UDP header */ 279 header = (udp_header_ ref) packet_get_data(packet);279 header = (udp_header_t *) packet_get_data(packet); 280 280 if (!header) 281 281 return udp_release_and_return(packet, NO_DATA); … … 453 453 * function. 454 454 */ 455 static int udp_sendto_message(socket_cores_ reflocal_sockets, int socket_id,455 static int udp_sendto_message(socket_cores_t *local_sockets, int socket_id, 456 456 const struct sockaddr *addr, socklen_t addrlen, int fragments, 457 457 size_t *data_fragment_size, int flags) 458 458 { 459 socket_core_ refsocket;459 socket_core_t *socket; 460 460 packet_t packet; 461 461 packet_t next_packet; 462 udp_header_ refheader;462 udp_header_t *header; 463 463 int index; 464 464 size_t total_length; … … 469 469 size_t headerlen; 470 470 device_id_t device_id; 471 packet_dimension_ refpacket_dimension;471 packet_dimension_t *packet_dimension; 472 472 int rc; 473 473 … … 609 609 * function. 610 610 */ 611 static int udp_recvfrom_message(socket_cores_ reflocal_sockets, int socket_id,611 static int udp_recvfrom_message(socket_cores_t *local_sockets, int socket_id, 612 612 int flags, size_t *addrlen) 613 613 { 614 socket_core_ refsocket;614 socket_core_t *socket; 615 615 int packet_id; 616 616 packet_t packet; 617 udp_header_ refheader;617 udp_header_t *header; 618 618 struct sockaddr *addr; 619 619 size_t length; … … 644 644 return udp_release_and_return(packet, NO_DATA); 645 645 } 646 header = (udp_header_ ref) data;646 header = (udp_header_t *) data; 647 647 648 648 /* Set the source address port */ … … 714 714 ipc_call_t answer; 715 715 int answer_count; 716 packet_dimension_ refpacket_dimension;716 packet_dimension_t *packet_dimension; 717 717 718 718 /* -
uspace/srv/net/tl/udp/udp_header.h
r45f04f8 ra7811f17 49 49 typedef struct udp_header udp_header_t; 50 50 51 /** Type definition of the user datagram header pointer.52 * @see udp_header53 */54 typedef udp_header_t *udp_header_ref;55 56 51 /** User datagram header. */ 57 52 struct udp_header {
Note:
See TracChangeset
for help on using the changeset viewer.