Changeset 4e5c7ba in mainline
- Timestamp:
- 2010-11-18T22:36:12Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f772bc55
- Parents:
- cb569e6
- Location:
- uspace/srv/net
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/il/arp/arp.c
rcb569e6 r4e5c7ba 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); … … 128 128 services_t protocol, measured_string_ref address) 129 129 { 130 arp_device_ refdevice;131 arp_proto_ refproto;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,176 static int arp_proto_create(arp_proto_t **proto, services_t service, 177 177 measured_string_ref 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; … … 215 215 services_t protocol, measured_string_ref address) 216 216 { 217 arp_device_ refdevice;218 arp_proto_ refproto;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;420 arp_header_t *header; 421 arp_device_t *device; 422 arp_proto_t *proto; 423 423 measured_string_ref hw_source; 424 424 uint8_t *src_hw; … … 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 + … … 527 527 measured_string_ref target) 528 528 { 529 arp_device_ refdevice;530 arp_proto_ refproto;529 arp_device_t *device; 530 arp_proto_t *proto; 531 531 measured_string_ref 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)); -
uspace/srv/net/il/arp/arp.h
rcb569e6 r4e5c7ba 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. -
uspace/srv/net/il/arp/arp_header.h
rcb569e6 r4e5c7ba 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
rcb569e6 r4e5c7ba 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 … … 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[] = { … … 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); … … 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 { … … 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 … … 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; … … 1557 1557 ip_header_ref 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; … … 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;1725 ip_route_t *route; 1726 1726 ip_header_ref header; 1727 1727 … … 1782 1782 in_addr_t *dest; 1783 1783 in_addr_t *src; 1784 ip_route_ refroute;1784 ip_route_t *route; 1785 1785 ipv4_pseudo_header_ref header_in; 1786 1786 -
uspace/srv/net/il/ip/ip.h
rcb569e6 r4e5c7ba 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. … … 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/nil/eth/eth.c
rcb569e6 r4e5c7ba 178 178 { 179 179 int index; 180 eth_proto_ refproto;180 eth_proto_t *proto; 181 181 182 182 fibril_rwlock_read_lock(ð_globals.protos_lock); … … 286 286 size_t mtu) 287 287 { 288 eth_device_ refdevice;288 eth_device_t *device; 289 289 int index; 290 290 measured_string_t names[2] = { … … 301 301 size_t count = sizeof(names) / sizeof(measured_string_t); 302 302 char *data; 303 eth_proto_ refproto;303 eth_proto_t *proto; 304 304 int rc; 305 305 … … 342 342 343 343 /* Create a new device */ 344 device = (eth_device_ ref) malloc(sizeof(eth_device_t));344 device = (eth_device_t *) malloc(sizeof(eth_device_t)); 345 345 if (!device) 346 346 return ENOMEM; … … 434 434 * @returns NULL if the packet address length is not big enough. 435 435 */ 436 static eth_proto_ refeth_process_packet(int flags, packet_t packet)437 { 438 eth_header_snap_ refheader;436 static eth_proto_t *eth_process_packet(int flags, packet_t packet) 437 { 438 eth_header_snap_t *header; 439 439 size_t length; 440 440 eth_type_t type; 441 441 size_t prefix; 442 442 size_t suffix; 443 eth_fcs_ reffcs;443 eth_fcs_t *fcs; 444 444 uint8_t *data; 445 445 int rc; … … 454 454 455 455 data = packet_get_data(packet); 456 header = (eth_header_snap_ ref) data;456 header = (eth_header_snap_t *) data; 457 457 type = ntohs(header->header.ethertype); 458 458 … … 461 461 prefix = sizeof(eth_header_t); 462 462 suffix = 0; 463 fcs = (eth_fcs_ ref) data + length - sizeof(eth_fcs_t);463 fcs = (eth_fcs_t *) data + length - sizeof(eth_fcs_t); 464 464 length -= sizeof(eth_fcs_t); 465 465 } else if(type <= ETH_MAX_CONTENT) { … … 487 487 488 488 suffix = (type < ETH_MIN_CONTENT) ? ETH_MIN_CONTENT - type : 0U; 489 fcs = (eth_fcs_ ref) data + prefix + type + suffix;489 fcs = (eth_fcs_t *) data + prefix + type + suffix; 490 490 suffix += length - prefix - type; 491 491 length = prefix + type + suffix; … … 516 516 packet_t packet, services_t target) 517 517 { 518 eth_proto_ refproto;518 eth_proto_t *proto; 519 519 packet_t next; 520 eth_device_ refdevice;520 eth_device_t *device; 521 521 int flags; 522 522 … … 564 564 size_t *prefix, size_t *content, size_t *suffix) 565 565 { 566 eth_device_ refdevice;566 eth_device_t *device; 567 567 568 568 if (!addr_len || !prefix || !content || !suffix) … … 598 598 measured_string_ref *address) 599 599 { 600 eth_device_ refdevice;600 eth_device_t *device; 601 601 602 602 if (!address) … … 631 631 static int eth_register_message(services_t service, int phone) 632 632 { 633 eth_proto_ refproto;633 eth_proto_t *proto; 634 634 int protocol; 635 635 int index; … … 646 646 return EOK; 647 647 } else { 648 proto = (eth_proto_ ref) malloc(sizeof(eth_proto_t));648 proto = (eth_proto_t *) malloc(sizeof(eth_proto_t)); 649 649 if (!proto) { 650 650 fibril_rwlock_write_unlock(ð_globals.protos_lock); … … 688 688 size_t mtu) 689 689 { 690 eth_header_snap_ refheader;691 eth_header_lsap_ refheader_lsap;692 eth_header_ refheader_dix;693 eth_fcs_ reffcs;690 eth_header_snap_t *header; 691 eth_header_lsap_t *header_lsap; 692 eth_header_t *header_dix; 693 eth_fcs_t *fcs; 694 694 uint8_t *src; 695 695 uint8_t *dest; … … 697 697 int i; 698 698 void *padding; 699 eth_preamble_ refpreamble;699 eth_preamble_t *preamble; 700 700 701 701 i = packet_get_addr(packet, &src, &dest); … … 795 795 services_t sender) 796 796 { 797 eth_device_ refdevice;797 eth_device_t *device; 798 798 packet_t next; 799 799 packet_t tmp; -
uspace/srv/net/nil/eth/eth.h
rcb569e6 r4e5c7ba 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. -
uspace/srv/net/nil/eth/eth_header.h
rcb569e6 r4e5c7ba 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
rcb569e6 r4e5c7ba 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; … … 250 250 measured_string_ref *address) 251 251 { 252 nildummy_device_ refdevice;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); -
uspace/srv/net/nil/nildummy/nildummy.h
rcb569e6 r4e5c7ba 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. -
uspace/srv/net/tl/icmp/icmp.c
rcb569e6 r4e5c7ba 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; … … 483 483 { 484 484 int reply_key; 485 icmp_reply_ refreply;485 icmp_reply_t *reply; 486 486 487 487 /* Compute the reply key */ -
uspace/srv/net/tl/icmp/icmp.h
rcb569e6 r4e5c7ba 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
rcb569e6 r4e5c7ba 166 166 167 167 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);168 static void tcp_prepare_operation_header(socket_core_ref, tcp_socket_data_t *, 169 tcp_header_t *, int synchronize, int); 170 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);171 tcp_socket_data_t *, size_t, tcp_socket_state_t, suseconds_t, int); 172 172 static void tcp_free_socket_data(socket_core_ref); 173 173 … … 179 179 static int tcp_connect_core(socket_core_ref, socket_cores_ref, 180 180 struct sockaddr *, socklen_t); 181 static int tcp_queue_prepare_packet(socket_core_ref, tcp_socket_data_ ref,181 static int tcp_queue_prepare_packet(socket_core_ref, tcp_socket_data_t *, 182 182 packet_t, size_t); 183 static int tcp_queue_packet(socket_core_ref, tcp_socket_data_ ref, packet_t,183 static int tcp_queue_packet(socket_core_ref, tcp_socket_data_t *, packet_t, 184 184 size_t); 185 static packet_t tcp_get_packets_to_send(socket_core_ref, tcp_socket_data_ ref);185 static packet_t tcp_get_packets_to_send(socket_core_ref, tcp_socket_data_t *); 186 186 static void tcp_send_packets(device_id_t, packet_t); 187 187 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,188 static void tcp_process_acknowledgement(socket_core_ref, tcp_socket_data_t *, 189 tcp_header_t *); 190 static packet_t tcp_send_prepare_packet(socket_core_ref, tcp_socket_data_t *, 191 191 packet_t, size_t, size_t); 192 static packet_t tcp_prepare_copy(socket_core_ref, tcp_socket_data_ ref, packet_t,192 static packet_t tcp_prepare_copy(socket_core_ref, tcp_socket_data_t *, packet_t, 193 193 size_t, size_t); 194 /* static */ void tcp_retransmit_packet(socket_core_ref, tcp_socket_data_ ref,194 /* static */ void tcp_retransmit_packet(socket_core_ref, tcp_socket_data_t *, 195 195 size_t); 196 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,197 tcp_socket_data_t *, int, int); 198 static void tcp_refresh_socket_data(tcp_socket_data_t *); 199 200 static void tcp_initialize_socket_data(tcp_socket_data_t *); 201 202 static int tcp_process_listen(socket_core_ref, tcp_socket_data_t *, 203 tcp_header_t *, packet_t, struct sockaddr *, struct sockaddr *, size_t); 204 static int tcp_process_syn_sent(socket_core_ref, tcp_socket_data_t *, 205 tcp_header_t *, packet_t); 206 static int tcp_process_syn_received(socket_core_ref, tcp_socket_data_t *, 207 tcp_header_t *, packet_t); 208 static int tcp_process_established(socket_core_ref, tcp_socket_data_t *, 209 tcp_header_t *, packet_t, int, size_t); 210 static int tcp_queue_received_packet(socket_core_ref, tcp_socket_data_t *, 211 211 packet_t, int, size_t); 212 212 … … 290 290 size_t offset; 291 291 int result; 292 tcp_header_ refheader;292 tcp_header_t *header; 293 293 socket_core_ref socket; 294 tcp_socket_data_ refsocket_data;294 tcp_socket_data_t *socket_data; 295 295 packet_t next_packet; 296 296 size_t total_length; … … 343 343 344 344 /* Get tcp header */ 345 header = (tcp_header_ ref) packet_get_data(packet);345 header = (tcp_header_t *) packet_get_data(packet); 346 346 if (!header) 347 347 return tcp_release_and_return(packet, NO_DATA); … … 380 380 381 381 printf("socket id %d\n", socket->socket_id); 382 socket_data = (tcp_socket_data_ ref) socket->specific_data;382 socket_data = (tcp_socket_data_t *) socket->specific_data; 383 383 assert(socket_data); 384 384 … … 497 497 } 498 498 499 int tcp_process_established(socket_core_ref socket, tcp_socket_data_ ref500 socket_data, tcp_header_ refheader, packet_t packet, int fragments,499 int tcp_process_established(socket_core_ref socket, tcp_socket_data_t * 500 socket_data, tcp_header_t *header, packet_t packet, int fragments, 501 501 size_t total_length) 502 502 { … … 806 806 807 807 int tcp_queue_received_packet(socket_core_ref socket, 808 tcp_socket_data_ refsocket_data, packet_t packet, int fragments,808 tcp_socket_data_t *socket_data, packet_t packet, int fragments, 809 809 size_t total_length) 810 810 { … … 842 842 } 843 843 844 int tcp_process_syn_sent(socket_core_ref socket, tcp_socket_data_ ref845 socket_data, tcp_header_ refheader, packet_t packet)844 int tcp_process_syn_sent(socket_core_ref socket, tcp_socket_data_t * 845 socket_data, tcp_header_t *header, packet_t packet) 846 846 { 847 847 packet_t next_packet; … … 901 901 902 902 int tcp_process_listen(socket_core_ref listening_socket, 903 tcp_socket_data_ ref listening_socket_data, tcp_header_refheader,903 tcp_socket_data_t *listening_socket_data, tcp_header_t *header, 904 904 packet_t packet, struct sockaddr *src, struct sockaddr *dest, 905 905 size_t addrlen) … … 907 907 packet_t next_packet; 908 908 socket_core_ref socket; 909 tcp_socket_data_ refsocket_data;909 tcp_socket_data_t *socket_data; 910 910 int socket_id; 911 911 int listening_socket_id = listening_socket->socket_id; … … 922 922 return tcp_release_and_return(packet, EINVAL); 923 923 924 socket_data = (tcp_socket_data_ ref) malloc(sizeof(*socket_data));924 socket_data = (tcp_socket_data_t *) malloc(sizeof(*socket_data)); 925 925 if (!socket_data) 926 926 return tcp_release_and_return(packet, ENOMEM); … … 979 979 } 980 980 listening_socket_data = 981 (tcp_socket_data_ ref) listening_socket->specific_data;981 (tcp_socket_data_t *) listening_socket->specific_data; 982 982 assert(listening_socket_data); 983 983 … … 991 991 return ENOTSOCK; 992 992 } 993 socket_data = (tcp_socket_data_ ref) socket->specific_data;993 socket_data = (tcp_socket_data_t *) socket->specific_data; 994 994 assert(socket_data); 995 995 … … 1061 1061 1062 1062 int tcp_process_syn_received(socket_core_ref socket, 1063 tcp_socket_data_ ref socket_data, tcp_header_refheader, packet_t packet)1063 tcp_socket_data_t *socket_data, tcp_header_t *header, packet_t packet) 1064 1064 { 1065 1065 socket_core_ref listening_socket; 1066 tcp_socket_data_ reflistening_socket_data;1066 tcp_socket_data_t *listening_socket_data; 1067 1067 int rc; 1068 1068 … … 1086 1086 if (listening_socket) { 1087 1087 listening_socket_data = 1088 (tcp_socket_data_ ref) listening_socket->specific_data;1088 (tcp_socket_data_t *) listening_socket->specific_data; 1089 1089 assert(listening_socket_data); 1090 1090 … … 1128 1128 1129 1129 void tcp_process_acknowledgement(socket_core_ref socket, 1130 tcp_socket_data_ ref socket_data, tcp_header_refheader)1130 tcp_socket_data_t *socket_data, tcp_header_t *header) 1131 1131 { 1132 1132 size_t number; … … 1265 1265 } 1266 1266 1267 void tcp_refresh_socket_data(tcp_socket_data_ refsocket_data)1267 void tcp_refresh_socket_data(tcp_socket_data_t *socket_data) 1268 1268 { 1269 1269 assert(socket_data); … … 1281 1281 } 1282 1282 1283 void tcp_initialize_socket_data(tcp_socket_data_ refsocket_data)1283 void tcp_initialize_socket_data(tcp_socket_data_t *socket_data) 1284 1284 { 1285 1285 assert(socket_data); … … 1304 1304 ipc_call_t answer; 1305 1305 int answer_count; 1306 tcp_socket_data_ refsocket_data;1306 tcp_socket_data_t *socket_data; 1307 1307 socket_core_ref socket; 1308 1308 packet_dimension_ref packet_dimension; … … 1336 1336 case NET_SOCKET: 1337 1337 socket_data = 1338 (tcp_socket_data_ ref) malloc(sizeof(*socket_data));1338 (tcp_socket_data_t *) malloc(sizeof(*socket_data)); 1339 1339 if (!socket_data) { 1340 1340 res = ENOMEM; … … 1383 1383 SOCKET_GET_SOCKET_ID(call)); 1384 1384 if (socket) { 1385 socket_data = (tcp_socket_data_ ref)1385 socket_data = (tcp_socket_data_t *) 1386 1386 socket->specific_data; 1387 1387 assert(socket_data); … … 1543 1543 int keep_write_lock = false; 1544 1544 socket_core_ref socket; 1545 tcp_socket_data_ refsocket_data;1545 tcp_socket_data_t *socket_data; 1546 1546 1547 1547 assert(timeout); … … 1561 1561 goto out; 1562 1562 1563 socket_data = (tcp_socket_data_ ref) socket->specific_data;1563 socket_data = (tcp_socket_data_t *) socket->specific_data; 1564 1564 assert(socket_data); 1565 1565 if (socket_data->local_sockets != timeout->local_sockets) … … 1619 1619 tcp_timeout_ref timeout = data; 1620 1620 socket_core_ref socket; 1621 tcp_socket_data_ refsocket_data;1621 tcp_socket_data_t *socket_data; 1622 1622 fibril_rwlock_t *local_lock; 1623 1623 … … 1635 1635 1636 1636 if (socket && (socket->socket_id == timeout->socket_id)) { 1637 socket_data = (tcp_socket_data_ ref) socket->specific_data;1637 socket_data = (tcp_socket_data_t *) socket->specific_data; 1638 1638 assert(socket_data); 1639 1639 if (socket_data->local_sockets == timeout->local_sockets) { … … 1656 1656 } 1657 1657 1658 void tcp_retransmit_packet(socket_core_ref socket, tcp_socket_data_ ref1658 void tcp_retransmit_packet(socket_core_ref socket, tcp_socket_data_t * 1659 1659 socket_data, size_t sequence_number) 1660 1660 { … … 1687 1687 { 1688 1688 socket_core_ref socket; 1689 tcp_socket_data_ refsocket_data;1689 tcp_socket_data_t *socket_data; 1690 1690 1691 1691 assert(local_sockets); … … 1700 1700 1701 1701 /* Get the socket specific data */ 1702 socket_data = (tcp_socket_data_ ref) socket->specific_data;1702 socket_data = (tcp_socket_data_t *) socket->specific_data; 1703 1703 assert(socket_data); 1704 1704 … … 1740 1740 struct sockaddr *addr, socklen_t addrlen) 1741 1741 { 1742 tcp_socket_data_ refsocket_data;1742 tcp_socket_data_t *socket_data; 1743 1743 packet_t packet; 1744 1744 int rc; … … 1749 1749 1750 1750 /* Get the socket specific data */ 1751 socket_data = (tcp_socket_data_ ref) socket->specific_data;1751 socket_data = (tcp_socket_data_t *) socket->specific_data; 1752 1752 assert(socket_data); 1753 1753 assert(socket->specific_data == socket_data); … … 1829 1829 1830 1830 int tcp_queue_prepare_packet(socket_core_ref socket, 1831 tcp_socket_data_ refsocket_data, packet_t packet, size_t data_length)1832 { 1833 tcp_header_ refheader;1831 tcp_socket_data_t *socket_data, packet_t packet, size_t data_length) 1832 { 1833 tcp_header_t *header; 1834 1834 int rc; 1835 1835 … … 1839 1839 1840 1840 /* Get TCP header */ 1841 header = (tcp_header_ ref) packet_get_data(packet);1841 header = (tcp_header_t *) packet_get_data(packet); 1842 1842 if (!header) 1843 1843 return NO_DATA; … … 1859 1859 } 1860 1860 1861 int tcp_queue_packet(socket_core_ref socket, tcp_socket_data_ refsocket_data,1861 int tcp_queue_packet(socket_core_ref socket, tcp_socket_data_t *socket_data, 1862 1862 packet_t packet, size_t data_length) 1863 1863 { … … 1881 1881 } 1882 1882 1883 packet_t tcp_get_packets_to_send(socket_core_ref socket, tcp_socket_data_ ref1883 packet_t tcp_get_packets_to_send(socket_core_ref socket, tcp_socket_data_t * 1884 1884 socket_data) 1885 1885 { … … 1941 1941 } 1942 1942 1943 packet_t tcp_send_prepare_packet(socket_core_ref socket, tcp_socket_data_ ref1943 packet_t tcp_send_prepare_packet(socket_core_ref socket, tcp_socket_data_t * 1944 1944 socket_data, packet_t packet, size_t data_length, size_t sequence_number) 1945 1945 { 1946 tcp_header_ refheader;1946 tcp_header_t *header; 1947 1947 uint32_t checksum; 1948 1948 int rc; … … 1961 1961 1962 1962 /* Get the header */ 1963 header = (tcp_header_ ref) packet_get_data(packet);1963 header = (tcp_header_t *) packet_get_data(packet); 1964 1964 if (!header) { 1965 1965 pq_release_remote(tcp_globals.net_phone, packet_get_id(packet)); … … 2002 2002 } 2003 2003 2004 packet_t tcp_prepare_copy(socket_core_ref socket, tcp_socket_data_ ref2004 packet_t tcp_prepare_copy(socket_core_ref socket, tcp_socket_data_t * 2005 2005 socket_data, packet_t packet, size_t data_length, size_t sequence_number) 2006 2006 { … … 2033 2033 2034 2034 void tcp_prepare_operation_header(socket_core_ref socket, 2035 tcp_socket_data_ ref socket_data, tcp_header_refheader, int synchronize,2035 tcp_socket_data_t *socket_data, tcp_header_t *header, int synchronize, 2036 2036 int finalize) 2037 2037 { … … 2050 2050 2051 2051 int tcp_prepare_timeout(int (*timeout_function)(void *tcp_timeout_t), 2052 socket_core_ref socket, tcp_socket_data_ refsocket_data,2052 socket_core_ref socket, tcp_socket_data_t *socket_data, 2053 2053 size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout, 2054 2054 int globals_read_only) … … 2100 2100 { 2101 2101 socket_core_ref socket; 2102 tcp_socket_data_ refsocket_data;2102 tcp_socket_data_t *socket_data; 2103 2103 int packet_id; 2104 2104 packet_t packet; … … 2117 2117 return NO_DATA; 2118 2118 2119 socket_data = (tcp_socket_data_ ref) socket->specific_data;2119 socket_data = (tcp_socket_data_t *) socket->specific_data; 2120 2120 2121 2121 /* Check state */ … … 2158 2158 { 2159 2159 socket_core_ref socket; 2160 tcp_socket_data_ refsocket_data;2160 tcp_socket_data_t *socket_data; 2161 2161 packet_dimension_ref packet_dimension; 2162 2162 packet_t packet; 2163 2163 size_t total_length; 2164 tcp_header_ refheader;2164 tcp_header_t *header; 2165 2165 int index; 2166 2166 int result; … … 2179 2179 return NO_DATA; 2180 2180 2181 socket_data = (tcp_socket_data_ ref) socket->specific_data;2181 socket_data = (tcp_socket_data_t *) socket->specific_data; 2182 2182 2183 2183 /* Check state */ … … 2233 2233 { 2234 2234 socket_core_ref socket; 2235 tcp_socket_data_ refsocket_data;2235 tcp_socket_data_t *socket_data; 2236 2236 packet_t packet; 2237 2237 int rc; … … 2243 2243 2244 2244 /* Get the socket specific data */ 2245 socket_data = (tcp_socket_data_ ref) socket->specific_data;2245 socket_data = (tcp_socket_data_t *) socket->specific_data; 2246 2246 assert(socket_data); 2247 2247 … … 2299 2299 2300 2300 int tcp_create_notification_packet(packet_t *packet, socket_core_ref socket, 2301 tcp_socket_data_ refsocket_data, int synchronize, int finalize)2301 tcp_socket_data_t *socket_data, int synchronize, int finalize) 2302 2302 { 2303 2303 packet_dimension_ref packet_dimension; 2304 tcp_header_ refheader;2304 tcp_header_t *header; 2305 2305 int rc; 2306 2306 … … 2337 2337 socket_core_ref accepted; 2338 2338 socket_core_ref socket; 2339 tcp_socket_data_ refsocket_data;2339 tcp_socket_data_t *socket_data; 2340 2340 packet_dimension_ref packet_dimension; 2341 2341 int rc; … … 2351 2351 2352 2352 /* Get the socket specific data */ 2353 socket_data = (tcp_socket_data_ ref) socket->specific_data;2353 socket_data = (tcp_socket_data_t *) socket->specific_data; 2354 2354 assert(socket_data); 2355 2355 … … 2369 2369 2370 2370 /* Get the socket specific data */ 2371 socket_data = (tcp_socket_data_ ref) accepted->specific_data;2371 socket_data = (tcp_socket_data_t *) accepted->specific_data; 2372 2372 assert(socket_data); 2373 2373 /* TODO can it be in another state? */ … … 2407 2407 void tcp_free_socket_data(socket_core_ref socket) 2408 2408 { 2409 tcp_socket_data_ refsocket_data;2409 tcp_socket_data_t *socket_data; 2410 2410 2411 2411 assert(socket); … … 2414 2414 2415 2415 /* Get the socket specific data */ 2416 socket_data = (tcp_socket_data_ ref) socket->specific_data;2416 socket_data = (tcp_socket_data_t *) socket->specific_data; 2417 2417 assert(socket_data); 2418 2418 -
uspace/srv/net/tl/tcp/tcp.h
rcb569e6 r4e5c7ba 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. -
uspace/srv/net/tl/tcp/tcp_header.h
rcb569e6 r4e5c7ba 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
rcb569e6 r4e5c7ba 223 223 size_t offset; 224 224 int result; 225 udp_header_ refheader;225 udp_header_t *header; 226 226 socket_core_ref socket; 227 227 packet_t next_packet; … … 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); … … 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; … … 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 */ -
uspace/srv/net/tl/udp/udp_header.h
rcb569e6 r4e5c7ba 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.