Changeset 1affcdf3 in mainline for uspace/lib/net
- Timestamp:
- 2011-06-10T19:33:41Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1878386
- Parents:
- 13ecdac9 (diff), 79a141a (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/lib/net
- Files:
-
- 12 edited
-
generic/generic.c (modified) (8 diffs)
-
generic/packet_remote.c (modified) (7 diffs)
-
il/arp_remote.c (modified) (5 diffs)
-
il/il_skel.c (modified) (2 diffs)
-
il/ip_client.c (modified) (3 diffs)
-
il/ip_remote.c (modified) (4 diffs)
-
include/ip_header.h (modified) (5 diffs)
-
netif/netif_remote.c (modified) (5 diffs)
-
netif/netif_skel.c (modified) (3 diffs)
-
nil/nil_skel.c (modified) (2 diffs)
-
tl/icmp_remote.c (modified) (5 diffs)
-
tl/tl_skel.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/generic/generic.c
r13ecdac9 r1affcdf3 37 37 #include <generic.h> 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <ipc/services.h> 40 41 #include <net/device.h> … … 56 57 int state, services_t target) 57 58 { 58 async_ msg_3(phone, (sysarg_t) message, (sysarg_t) device_id,59 async_obsolete_msg_3(phone, (sysarg_t) message, (sysarg_t) device_id, 59 60 (sysarg_t) state, target); 60 61 … … 78 79 int arg2, services_t service) 79 80 { 80 return (int) async_ req_3_0(phone, (sysarg_t) message,81 return (int) async_obsolete_req_3_0(phone, (sysarg_t) message, 81 82 (sysarg_t) device_id, (sysarg_t) arg2, (sysarg_t) service); 82 83 } … … 107 108 108 109 /* Request the address */ 109 message_id = async_ send_1(phone, (sysarg_t) message,110 message_id = async_obsolete_send_1(phone, (sysarg_t) message, 110 111 (sysarg_t) device_id, NULL); 111 112 string = measured_strings_return(phone, address, data, 1); … … 145 146 sysarg_t suffix; 146 147 147 sysarg_t result = async_ req_1_4(phone, (sysarg_t) message,148 sysarg_t result = async_obsolete_req_1_4(phone, (sysarg_t) message, 148 149 (sysarg_t) device_id, &addr_len, &prefix, &content, &suffix); 149 150 … … 172 173 { 173 174 if (error) { 174 async_ msg_4(phone, (sysarg_t) message, (sysarg_t) device_id,175 async_obsolete_msg_4(phone, (sysarg_t) message, (sysarg_t) device_id, 175 176 (sysarg_t) packet_id, (sysarg_t) target, (sysarg_t) error); 176 177 } else { 177 async_ msg_3(phone, (sysarg_t) message, (sysarg_t) device_id,178 async_obsolete_msg_3(phone, (sysarg_t) message, (sysarg_t) device_id, 178 179 (sysarg_t) packet_id, (sysarg_t) target); 179 180 } … … 198 199 { 199 200 if (error) { 200 async_ msg_4(phone, (sysarg_t) message, (sysarg_t) device_id,201 async_obsolete_msg_4(phone, (sysarg_t) message, (sysarg_t) device_id, 201 202 (sysarg_t) packet_id, (sysarg_t) sender, (sysarg_t) error); 202 203 } else { 203 async_ msg_3(phone, (sysarg_t) message, (sysarg_t) device_id,204 async_obsolete_msg_3(phone, (sysarg_t) message, (sysarg_t) device_id, 204 205 (sysarg_t) packet_id, (sysarg_t) sender); 205 206 } … … 243 244 244 245 /* Request the translation */ 245 message_id = async_ send_3(phone, (sysarg_t) message,246 message_id = async_obsolete_send_3(phone, (sysarg_t) message, 246 247 (sysarg_t) device_id, (sysarg_t) count, (sysarg_t) service, NULL); 247 248 measured_strings_send(phone, configuration, count); -
uspace/lib/net/generic/packet_remote.c
r13ecdac9 r1affcdf3 37 37 38 38 #include <async.h> 39 #include <async_obsolete.h> 39 40 #include <errno.h> 40 41 #include <ipc/packet.h> … … 59 60 * @return EOK on success. 60 61 * @return Other error codes as defined for the pm_add() function. 61 * @return Other error codes as defined for the async_ share_in_start() function.62 * @return Other error codes as defined for the async_obsolete_share_in_start() function. 62 63 * 63 64 */ … … 69 70 int rc; 70 71 71 message = async_ send_1(phone, NET_PACKET_GET, packet_id, &answer);72 message = async_obsolete_send_1(phone, NET_PACKET_GET, packet_id, &answer); 72 73 73 74 *packet = (packet_t *) as_get_mappable_page(size); 74 rc = async_ share_in_start_0_0(phone, *packet, size);75 rc = async_obsolete_share_in_start_0_0(phone, *packet, size); 75 76 if (rc != EOK) { 76 77 munmap(*packet, size); … … 117 118 sysarg_t size; 118 119 119 rc = async_ req_1_1(phone, NET_PACKET_GET_SIZE, packet_id,120 rc = async_obsolete_req_1_1(phone, NET_PACKET_GET_SIZE, packet_id, 120 121 &size); 121 122 if (rc != EOK) … … 154 155 int rc; 155 156 156 rc = async_ req_4_2(phone, NET_PACKET_CREATE_4, max_content, addr_len,157 rc = async_obsolete_req_4_2(phone, NET_PACKET_CREATE_4, max_content, addr_len, 157 158 max_prefix, max_suffix, &packet_id, &size); 158 159 if (rc != EOK) … … 185 186 int rc; 186 187 187 rc = async_ req_1_2(phone, NET_PACKET_CREATE_1, content, &packet_id,188 rc = async_obsolete_req_1_2(phone, NET_PACKET_CREATE_1, content, &packet_id, 188 189 &size); 189 190 if (rc != EOK) … … 212 213 void pq_release_remote(int phone, packet_id_t packet_id) 213 214 { 214 async_ msg_1(phone, NET_PACKET_RELEASE, packet_id);215 async_obsolete_msg_1(phone, NET_PACKET_RELEASE, packet_id); 215 216 } 216 217 -
uspace/lib/net/il/arp_remote.c
r13ecdac9 r1affcdf3 40 40 41 41 #include <async.h> 42 #include <async_obsolete.h> 42 43 #include <errno.h> 43 44 #include <ipc/services.h> … … 68 69 int arp_clean_cache_req(int arp_phone) 69 70 { 70 return (int) async_ req_0_0(arp_phone, NET_ARP_CLEAN_CACHE);71 return (int) async_obsolete_req_0_0(arp_phone, NET_ARP_CLEAN_CACHE); 71 72 } 72 73 … … 87 88 sysarg_t result; 88 89 89 message_id = async_ send_2(arp_phone, NET_ARP_CLEAR_ADDRESS,90 message_id = async_obsolete_send_2(arp_phone, NET_ARP_CLEAR_ADDRESS, 90 91 (sysarg_t) device_id, protocol, NULL); 91 92 measured_strings_send(arp_phone, address, 1); … … 104 105 int arp_clear_device_req(int arp_phone, device_id_t device_id) 105 106 { 106 return (int) async_ req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE,107 return (int) async_obsolete_req_1_0(arp_phone, NET_ARP_CLEAR_DEVICE, 107 108 (sysarg_t) device_id); 108 109 } … … 137 138 sysarg_t result; 138 139 139 message_id = async_ send_3(arp_phone, NET_ARP_DEVICE,140 message_id = async_obsolete_send_3(arp_phone, NET_ARP_DEVICE, 140 141 (sysarg_t) device_id, protocol, netif, NULL); 141 142 measured_strings_send(arp_phone, address, 1); -
uspace/lib/net/il/il_skel.c
r13ecdac9 r1affcdf3 42 42 #include <net/modules.h> 43 43 44 // FIXME: remove this header 45 #include <kernel/ipc/ipc_methods.h> 46 44 47 /** Default thread for new connections. 45 48 * … … 75 78 * result. 76 79 */ 77 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || 78 (res == EHANGUP)) 80 if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP)) 79 81 return; 80 82 -
uspace/lib/net/il/ip_client.c
r13ecdac9 r1affcdf3 181 181 /* Set the header */ 182 182 header = (ip_header_t *) data; 183 header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) +184 ipopt_length);183 SET_IP_HEADER_LENGTH(header, 184 (IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + ipopt_length))); 185 185 header->ttl = (ttl ? ttl : IPDEFTTL); 186 186 header->tos = tos; … … 188 188 189 189 if (dont_fragment) 190 header->flags = IPFLAG_DONT_FRAGMENT;190 SET_IP_HEADER_FLAGS(header, IPFLAG_DONT_FRAGMENT); 191 191 192 192 return EOK; … … 227 227 *tos = header->tos; 228 228 if (dont_fragment) 229 *dont_fragment = header->flags& IPFLAG_DONT_FRAGMENT;229 *dont_fragment = GET_IP_HEADER_FLAGS(header) & IPFLAG_DONT_FRAGMENT; 230 230 if (ipopt_length) { 231 231 *ipopt_length = IP_HEADER_LENGTH(header) - sizeof(ip_header_t); -
uspace/lib/net/il/ip_remote.c
r13ecdac9 r1affcdf3 44 44 #include <packet_client.h> 45 45 #include <generic.h> 46 46 #include <async_obsolete.h> 47 47 #include <ipc/services.h> 48 48 #include <ipc/il.h> … … 66 66 in_addr_t address, in_addr_t netmask, in_addr_t gateway) 67 67 { 68 return (int) async_ req_4_0(ip_phone, NET_IP_ADD_ROUTE,68 return (int) async_obsolete_req_4_0(ip_phone, NET_IP_ADD_ROUTE, 69 69 (sysarg_t) device_id, (sysarg_t) gateway.s_addr, 70 70 (sysarg_t) address.s_addr, (sysarg_t) netmask.s_addr); … … 150 150 151 151 ipc_call_t answer; 152 aid_t message_id = async_ send_1(ip_phone, NET_IP_GET_ROUTE,152 aid_t message_id = async_obsolete_send_1(ip_phone, NET_IP_GET_ROUTE, 153 153 (sysarg_t) protocol, &answer); 154 154 155 if ((async_ data_write_start(ip_phone, destination, addrlen) == EOK) &&156 (async_ data_read_start(ip_phone, headerlen,155 if ((async_obsolete_data_write_start(ip_phone, destination, addrlen) == EOK) && 156 (async_obsolete_data_read_start(ip_phone, headerlen, 157 157 sizeof(*headerlen)) == EOK) && (*headerlen > 0)) { 158 158 *header = malloc(*headerlen); 159 159 if (*header) { 160 if (async_ data_read_start(ip_phone, *header,160 if (async_obsolete_data_read_start(ip_phone, *header, 161 161 *headerlen) != EOK) 162 162 free(*header); … … 243 243 in_addr_t gateway) 244 244 { 245 return (int) async_ req_2_0(ip_phone, NET_IP_SET_GATEWAY,245 return (int) async_obsolete_req_2_0(ip_phone, NET_IP_SET_GATEWAY, 246 246 (sysarg_t) device_id, (sysarg_t) gateway.s_addr); 247 247 } -
uspace/lib/net/include/ip_header.h
r13ecdac9 r1affcdf3 64 64 */ 65 65 #define IP_FRAGMENT_OFFSET(header) \ 66 ((( (header)->fragment_offset_high<< 8) + \66 (((GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) << 8) + \ 67 67 (header)->fragment_offset_low) * 8U) 68 68 … … 83 83 */ 84 84 #define IP_HEADER_LENGTH(header) \ 85 ( (header)->header_length* 4U)85 (GET_IP_HEADER_LENGTH(header) * 4U) 86 86 87 87 /** Returns the actual IP packet total length. … … 143 143 */ 144 144 struct ip_header { 145 #ifdef ARCH_IS_BIG_ENDIAN 146 uint8_t version : 4; 147 uint8_t header_length : 4; 148 #else 149 uint8_t header_length : 4; 150 uint8_t version : 4; 151 #endif 145 uint8_t vhl; /* version, header_length */ 146 147 #define GET_IP_HEADER_VERSION(header) \ 148 (((header)->vhl & 0xf0) >> 4) 149 #define SET_IP_HEADER_VERSION(header, version) \ 150 ((header)->vhl = \ 151 ((version & 0x0f) << 4) | ((header)->vhl & 0x0f)) 152 153 #define GET_IP_HEADER_LENGTH(header) \ 154 ((header)->vhl & 0x0f) 155 #define SET_IP_HEADER_LENGTH(header, length) \ 156 ((header)->vhl = \ 157 (length & 0x0f) | ((header)->vhl & 0xf0)) 152 158 153 159 uint8_t tos; … … 155 161 uint16_t identification; 156 162 157 #ifdef ARCH_IS_BIG_ENDIAN 158 uint8_t flags : 3; 159 uint8_t fragment_offset_high : 5; 160 #else 161 uint8_t fragment_offset_high : 5; 162 uint8_t flags : 3; 163 #endif 163 uint8_t ffoh; /* flags, fragment_offset_high */ 164 165 #define GET_IP_HEADER_FLAGS(header) \ 166 (((header)->ffoh & 0xe0) >> 5) 167 #define SET_IP_HEADER_FLAGS(header, flags) \ 168 ((header)->ffoh = \ 169 ((flags & 0x07) << 5) | ((header)->ffoh & 0x1f)) 170 171 #define GET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header) \ 172 ((header)->ffoh & 0x1f) 173 #define SET_IP_HEADER_FRAGMENT_OFFSET_HIGH(header, fragment_offset_high) \ 174 ((header)->ffoh = \ 175 (fragment_offset_high & 0x1f) | ((header)->ffoh & 0xe0)) 164 176 165 177 uint8_t fragment_offset_low; … … 181 193 uint8_t pointer; 182 194 183 #ifdef ARCH_IS_BIG_ENDIAN 184 uint8_t overflow : 4; 185 uint8_t flags : 4; 186 #else 187 uint8_t flags : 4; 188 uint8_t overflow : 4; 189 #endif 195 uint8_t of; /* overflow, flags */ 196 197 #define GET_IP_OPTION_OVERFLOW(option) \ 198 (((option)->of & 0xf0) >> 4) 199 #define SET_IP_OPTION_OVERFLOW(option, overflow) \ 200 ((option)->of = \ 201 ((overflow & 0x0f) << 4) | ((option)->of & 0x0f)) 202 203 #define GET_IP_OPTION_FLAGS(option) \ 204 ((option)->of & 0x0f) 205 #define SET_IP_OPTION_FLAGS(option, flags) \ 206 ((option)->of = \ 207 (flags & 0x0f) | ((option)->of & 0xf0)) 208 190 209 } __attribute__ ((packed)); 191 210 -
uspace/lib/net/netif/netif_remote.c
r13ecdac9 r1affcdf3 38 38 #include <packet_client.h> 39 39 #include <generic.h> 40 40 #include <async_obsolete.h> 41 41 #include <ipc/services.h> 42 42 #include <ipc/netif.h> … … 82 82 int netif_probe_req(int netif_phone, device_id_t device_id, int irq, void *io) 83 83 { 84 return async_ req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq,84 return async_obsolete_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, 85 85 (sysarg_t) io); 86 86 } … … 119 119 int netif_start_req(int netif_phone, device_id_t device_id) 120 120 { 121 return async_ req_1_0(netif_phone, NET_NETIF_START, device_id);121 return async_obsolete_req_1_0(netif_phone, NET_NETIF_START, device_id); 122 122 } 123 123 … … 136 136 int netif_stop_req(int netif_phone, device_id_t device_id) 137 137 { 138 return async_ req_1_0(netif_phone, NET_NETIF_STOP, device_id);138 return async_obsolete_req_1_0(netif_phone, NET_NETIF_STOP, device_id); 139 139 } 140 140 … … 154 154 return EBADMEM; 155 155 156 aid_t message_id = async_ send_1(netif_phone, NET_NETIF_STATS,156 aid_t message_id = async_obsolete_send_1(netif_phone, NET_NETIF_STATS, 157 157 (sysarg_t) device_id, NULL); 158 async_ data_read_start(netif_phone, stats, sizeof(*stats));158 async_obsolete_data_read_start(netif_phone, stats, sizeof(*stats)); 159 159 160 160 sysarg_t result; -
uspace/lib/net/netif/netif_skel.c
r13ecdac9 r1affcdf3 54 54 #include <nil_remote.h> 55 55 56 // FIXME: remove this header 57 #include <kernel/ipc/ipc_methods.h> 58 56 59 DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t); 57 60 … … 288 291 *count = 0; 289 292 293 if (!IPC_GET_IMETHOD(*call)) 294 return EOK; 295 290 296 switch (IPC_GET_IMETHOD(*call)) { 291 case IPC_M_PHONE_HUNGUP:292 return EOK;293 294 297 case NET_NETIF_PROBE: 295 298 return netif_probe_req_local(0, IPC_GET_DEVICE(*call), … … 385 388 386 389 /* End if said to either by the message or the processing result */ 387 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || 388 (res == EHANGUP)) 390 if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP)) 389 391 return; 390 392 -
uspace/lib/net/nil/nil_skel.c
r13ecdac9 r1affcdf3 42 42 #include <net/modules.h> 43 43 44 // FIXME: remove this header 45 #include <kernel/ipc/ipc_methods.h> 46 44 47 /** Default thread for new connections. 45 48 * … … 75 78 * result. 76 79 */ 77 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || 78 (res == EHANGUP)) 80 if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP)) 79 81 return; 80 82 -
uspace/lib/net/tl/icmp_remote.c
r13ecdac9 r1affcdf3 41 41 42 42 #include <async.h> 43 #include <async_obsolete.h> 43 44 #include <errno.h> 44 45 #include <ipc/services.h> … … 64 65 icmp_param_t mtu, packet_t *packet) 65 66 { 66 async_ msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (sysarg_t) code,67 async_obsolete_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (sysarg_t) code, 67 68 (sysarg_t) packet_get_id(packet), (sysarg_t) mtu); 68 69 return EOK; … … 83 84 int icmp_source_quench_msg(int icmp_phone, packet_t *packet) 84 85 { 85 async_ msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0,86 async_obsolete_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0, 86 87 (sysarg_t) packet_get_id(packet)); 87 88 return EOK; … … 103 104 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t *packet) 104 105 { 105 async_ msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (sysarg_t) code,106 async_obsolete_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (sysarg_t) code, 106 107 (sysarg_t) packet_get_id(packet)); 107 108 return EOK; … … 125 126 icmp_param_t pointer, packet_t *packet) 126 127 { 127 async_ msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (sysarg_t) code,128 async_obsolete_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (sysarg_t) code, 128 129 (sysarg_t) packet_get_id(packet), (sysarg_t) pointer); 129 130 return EOK; -
uspace/lib/net/tl/tl_skel.c
r13ecdac9 r1affcdf3 42 42 #include <net/modules.h> 43 43 44 // FIXME: remove this header 45 #include <kernel/ipc/ipc_methods.h> 46 44 47 /** Default thread for new connections. 45 48 * … … 77 80 * result. 78 81 */ 79 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) || 80 (res == EHANGUP)) 82 if ((!IPC_GET_IMETHOD(call)) || (res == EHANGUP)) 81 83 return; 82 84
Note:
See TracChangeset
for help on using the changeset viewer.
