Changeset 14f1db0 in mainline for uspace/lib/net/il/ip_remote.c
- Timestamp:
- 2010-04-09T12:54:57Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1caa3c2
- Parents:
- 24ab58b3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/il/ip_remote.c
r24ab58b3 r14f1db0 33 33 /** @file 34 34 * 35 * IP interface implementation for standaloneremote modules.35 * IP interface implementation for remote modules. 36 36 * 37 37 * @see ip_interface.h … … 50 50 #include <il_messages.h> 51 51 #include <ip_messages.h> 52 53 int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, 54 in_addr_t netmask, in_addr_t gateway) 52 #include <ip_remote.h> 53 54 /** Add a route to the device routing table. 55 * 56 * The target network is routed using this device. 57 * 58 * @param[in] ip_phone The IP module phone used for (semi)remote calls. 59 * @param[in] device_id The device identifier. 60 * @param[in] address The target network address. 61 * @param[in] netmask The target network mask. 62 * @param[in] gateway The target network gateway. Not used if zero. 63 * 64 */ 65 int ip_add_route_req_remote(int ip_phone, device_id_t device_id, 66 in_addr_t address, in_addr_t netmask, in_addr_t gateway) 55 67 { 56 68 return (int) async_req_4_0(ip_phone, NET_IP_ADD_ROUTE, … … 71 83 } 72 84 73 int ip_device_req(int ip_phone, device_id_t device_id, services_t service) 74 { 75 return generic_device_req(ip_phone, NET_IL_DEVICE, device_id, 0, service); 76 } 77 78 int ip_get_route_req(int ip_phone, ip_protocol_t protocol, 85 /** Register the new device. 86 * 87 * Register itself as the ip packet receiver. 88 * If the device uses ARP registers also the new ARP device. 89 * 90 * @param[in] ip_phone The IP module phone used for (semi)remote calls. 91 * @param[in] device_id The new device identifier. 92 * @param[in] netif The underlying device network interface layer service. 93 * 94 * @return EOK on success. 95 * @return ENOMEM if there is not enough memory left. 96 * @return EINVAL if the device configuration is invalid. 97 * @return ENOTSUP if the device uses IPv6. 98 * @return ENOTSUP if the device uses DHCP. 99 * @return Other error codes as defined for the net_get_device_conf_req() 100 * function. 101 * @return Other error codes as defined for the arp_device_req() function. 102 * 103 */ 104 int ip_device_req_remote(int ip_phone, device_id_t device_id, 105 services_t service) 106 { 107 return generic_device_req_remote(ip_phone, NET_IL_DEVICE, device_id, 0, 108 service); 109 } 110 111 /** Return the device identifier and the IP pseudo header based on the destination address. 112 * 113 * @param[in] ip_phone The IP module phone used for (semi)remote calls. 114 * @param[in] protocol The transport protocol. 115 * @param[in] destination The destination address. 116 * @param[in] addrlen The destination address length. 117 * @param[out] device_id The device identifier. 118 * @param[out] header The constructed IP pseudo header. 119 * @param[out] headerlen The IP pseudo header length. 120 * 121 */ 122 int ip_get_route_req_remote(int ip_phone, ip_protocol_t protocol, 79 123 const struct sockaddr *destination, socklen_t addrlen, 80 device_id_t *device_id, ip_pseudo_header_ref*header, size_t *headerlen)124 device_id_t *device_id, void **header, size_t *headerlen) 81 125 { 82 126 if ((!destination) || (addrlen == 0)) … … 95 139 && (async_data_read_start(ip_phone, headerlen, sizeof(*headerlen)) == EOK) 96 140 && (*headerlen > 0)) { 97 *header = (ip_pseudo_header_ref)malloc(*headerlen);141 *header = malloc(*headerlen); 98 142 if (*header) { 99 143 if (async_data_read_start(ip_phone, *header, *headerlen) != EOK) … … 113 157 } 114 158 115 int ip_packet_size_req(int ip_phone, device_id_t device_id, 159 /** Return the device packet dimension for sending. 160 * 161 * @param[in] ip_phone The IP module phone used for (semi)remote calls. 162 * @param[in] device_id The device identifier. 163 * @param[out] packet_dimension The packet dimension. 164 * 165 * @return EOK on success. 166 * @return ENOENT if there is no such device. 167 * @return Other error codes as defined for the 168 * generic_packet_size_req_remote() function. 169 * 170 */ 171 int ip_packet_size_req_remote(int ip_phone, device_id_t device_id, 116 172 packet_dimension_ref packet_dimension) 117 173 { 118 return generic_packet_size_req (ip_phone, NET_IL_PACKET_SPACE, device_id,174 return generic_packet_size_req_remote(ip_phone, NET_IL_PACKET_SPACE, device_id, 119 175 packet_dimension); 120 176 } 121 177 122 int ip_received_error_msg(int ip_phone, device_id_t device_id, 178 /** Notify the IP module about the received error notification packet. 179 * 180 * @param[in] ip_phone The IP module phone used for (semi)remote calls. 181 * @param[in] device_id The device identifier. 182 * @param[in] packet The received packet or the received packet queue. 183 * @param[in] target The target internetwork module service to be 184 * delivered to. 185 * @param[in] error The packet error reporting service. Prefixes the 186 * received packet. 187 * 188 * @return EOK on success. 189 * 190 */ 191 int ip_received_error_msg_remote(int ip_phone, device_id_t device_id, 123 192 packet_t packet, services_t target, services_t error) 124 193 { 125 return generic_received_msg(ip_phone, NET_IP_RECEIVED_ERROR, device_id, 126 packet_get_id(packet), target, error); 127 } 128 129 int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, 194 return generic_received_msg_remote(ip_phone, NET_IP_RECEIVED_ERROR, 195 device_id, packet_get_id(packet), target, error); 196 } 197 198 /** Send the packet queue. 199 * 200 * The packets may get fragmented if needed. 201 * 202 * @param[in] ip_phone The IP module phone used for (semi)remote calls. 203 * @param[in] device_id The device identifier. 204 * @param[in] packet The packet fragments as a packet queue. All the 205 * packets have to have the same destination address. 206 * @param[in] sender The sending module service. 207 * @param[in] error The packet error reporting service. Prefixes the 208 * received packet. 209 * 210 * @return EOK on success. 211 * @return Other error codes as defined for the generic_send_msg() function. 212 * 213 */ 214 int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t packet, 130 215 services_t sender, services_t error) 131 216 { 132 return generic_send_msg (ip_phone, NET_IL_SEND, device_id,217 return generic_send_msg_remote(ip_phone, NET_IL_SEND, device_id, 133 218 packet_get_id(packet), sender, error); 134 219 } 135 220 136 int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway) 221 /** Set the default gateway. 222 * 223 * This gateway is used if no other route is found. 224 * 225 * @param[in] ip_phone The IP module phone used for (semi)remote calls. 226 * @param[in] device_id The device identifier. 227 * @param[in] gateway The default gateway. 228 * 229 */ 230 int ip_set_gateway_req_remote(int ip_phone, device_id_t device_id, 231 in_addr_t gateway) 137 232 { 138 233 return (int) async_req_2_0(ip_phone, NET_IP_SET_GATEWAY,
Note:
See TracChangeset
for help on using the changeset viewer.