Changeset f4f866c in mainline for uspace/lib/net/tl/tl_common.c
- Timestamp:
- 2010-04-23T21:42:26Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6c39a907
- Parents:
- 38aaacc2 (diff), 80badbe (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/net/tl/tl_common.c
r38aaacc2 rf4f866c 42 42 #include <packet/packet.h> 43 43 #include <packet/packet_client.h> 44 #include <packet_remote.h> 44 45 #include <net_device.h> 45 46 #include <icmp_interface.h> … … 47 48 #include <in6.h> 48 49 #include <inet.h> 49 #include <ip_interface.h> 50 #include <ip_local.h> 51 #include <ip_remote.h> 50 52 #include <socket_codes.h> 51 53 #include <socket_errno.h> 54 #include <ip_interface.h> 55 #include <tl_interface.h> 52 56 #include <tl_common.h> 53 57 … … 82 86 } 83 87 84 int tl_get_ip_packet_dimension(int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension){ 88 /** Get IP packet dimensions. 89 * 90 * Try to search a cache and query the IP module if not found. 91 * The reply is cached then. 92 * 93 * @param[in] ip_phone The IP moduel phone for (semi)remote calls. 94 * @param[in] packet_dimensions The packet dimensions cache. 95 * @param[in] device_id The device identifier. 96 * @param[out] packet_dimension The IP packet dimensions. 97 * 98 * @return EOK on success. 99 * @return EBADMEM if the packet_dimension parameter is NULL. 100 * @return ENOMEM if there is not enough memory left. 101 * @return EINVAL if the packet_dimensions cache is not valid. 102 * @return Other codes as defined for the ip_packet_size_req() function. 103 * 104 */ 105 int tl_get_ip_packet_dimension(int ip_phone, 106 packet_dimensions_ref packet_dimensions, device_id_t device_id, 107 packet_dimension_ref *packet_dimension) 108 { 85 109 ERROR_DECLARE; 86 87 if (! packet_dimension){110 111 if (!packet_dimension) 88 112 return EBADMEM; 89 } 90 113 91 114 *packet_dimension = packet_dimensions_find(packet_dimensions, device_id); 92 if (! * packet_dimension){93 / / ask for and remember them if not found94 *packet_dimension = malloc(sizeof(** 95 if(! * packet_dimension){115 if (!*packet_dimension) { 116 /* Ask for and remember them if not found */ 117 *packet_dimension = malloc(sizeof(**packet_dimension)); 118 if(!*packet_dimension) 96 119 return ENOMEM; 97 } 98 if(ERROR_OCCURRED(ip_packet_size_req(ip_phone, device_id, * packet_dimension))){ 120 121 if (ERROR_OCCURRED(ip_packet_size_req(ip_phone, device_id, 122 *packet_dimension))) { 99 123 free(*packet_dimension); 100 124 return ERROR_CODE; 101 125 } 102 ERROR_CODE = packet_dimensions_add(packet_dimensions, device_id, * packet_dimension); 103 if(ERROR_CODE < 0){ 126 127 ERROR_CODE = packet_dimensions_add(packet_dimensions, device_id, 128 *packet_dimension); 129 if (ERROR_CODE < 0) { 104 130 free(*packet_dimension); 105 131 return ERROR_CODE; 106 132 } 107 133 } 134 108 135 return EOK; 109 136 } … … 169 196 // detach the first packet and release the others 170 197 next = pq_detach(packet); 171 if (next){172 pq_release (packet_phone, packet_get_id(next));173 }198 if (next) 199 pq_release_remote(packet_phone, packet_get_id(next)); 200 174 201 length = packet_get_addr(packet, &src, NULL); 175 202 if((length > 0) … … 180 207 return EOK; 181 208 }else{ 182 pq_release (packet_phone, packet_get_id(packet));209 pq_release_remote(packet_phone, packet_get_id(packet)); 183 210 } 184 211 return ENOENT; … … 200 227 } 201 228 // get a new packet 202 *packet = packet_get_4 (packet_phone, length, dimension->addr_len, prefix + dimension->prefix, dimension->suffix);229 *packet = packet_get_4_remote(packet_phone, length, dimension->addr_len, prefix + dimension->prefix, dimension->suffix); 203 230 if(! packet){ 204 231 return ENOMEM; … … 207 234 data = packet_suffix(*packet, length); 208 235 if(! data){ 209 pq_release (packet_phone, packet_get_id(*packet));236 pq_release_remote(packet_phone, packet_get_id(*packet)); 210 237 return ENOMEM; 211 238 } … … 214 241 // set the packet destination address 215 242 || ERROR_OCCURRED(packet_set_addr(*packet, NULL, (uint8_t *) addr, addrlen))){ 216 pq_release (packet_phone, packet_get_id(*packet));243 pq_release_remote(packet_phone, packet_get_id(*packet)); 217 244 return ERROR_CODE; 218 245 }
Note:
See TracChangeset
for help on using the changeset viewer.