Changeset 46d4d9f in mainline for uspace/lib
- Timestamp:
- 2010-11-20T17:04:59Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dd5046dd
- Parents:
- fdbc3ff
- Location:
- uspace/lib
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/net/packet.c
rfdbc3ff r46d4d9f 62 62 63 63 /** Type definition of the packet map page. */ 64 typedef packet_t packet_map_t[PACKET_MAP_SIZE];64 typedef packet_t *packet_map_t[PACKET_MAP_SIZE]; 65 65 66 66 /** Packet map. … … 104 104 * @return NULL if the mapping does not exist. 105 105 */ 106 packet_t pm_find(packet_id_t packet_id)106 packet_t *pm_find(packet_id_t packet_id) 107 107 { 108 108 packet_map_t *map; 109 packet_t packet;109 packet_t *packet; 110 110 111 111 if (!packet_id) … … 135 135 * @return ENOMEM if there is not enough memory left. 136 136 */ 137 int pm_add(packet_t packet)137 int pm_add(packet_t *packet) 138 138 { 139 139 packet_map_t *map; … … 178 178 int index; 179 179 packet_map_t *map; 180 packet_t packet;180 packet_t *packet; 181 181 182 182 fibril_rwlock_write_lock(&pm_globals.lock); … … 209 209 * @return EINVAL if the packet is not valid. 210 210 */ 211 int pq_add(packet_t * first, packet_tpacket, size_t order, size_t metric)212 { 213 packet_t item;211 int pq_add(packet_t **first, packet_t *packet, size_t order, size_t metric) 212 { 213 packet_t *item; 214 214 215 215 if (!first || !packet_is_valid(packet)) … … 253 253 * @return NULL if the packet is not found. 254 254 */ 255 packet_t pq_find(packet_tpacket, size_t order)256 { 257 packet_t item;255 packet_t *pq_find(packet_t *packet, size_t order) 256 { 257 packet_t *item; 258 258 259 259 if (!packet_is_valid(packet)) … … 278 278 * @return EINVAL if etiher of the packets is invalid. 279 279 */ 280 int pq_insert_after(packet_t packet, packet_tnew_packet)281 { 282 packet_t item;280 int pq_insert_after(packet_t *packet, packet_t *new_packet) 281 { 282 packet_t *item; 283 283 284 284 if (!packet_is_valid(packet) || !packet_is_valid(new_packet)) … … 303 303 * @return NULL if the packet is not valid. 304 304 */ 305 packet_t pq_detach(packet_tpacket)306 { 307 packet_t next;308 packet_t previous;305 packet_t *pq_detach(packet_t *packet) 306 { 307 packet_t *next; 308 packet_t *previous; 309 309 310 310 if (!packet_is_valid(packet)) … … 331 331 * @return EINVAL if the packet is invalid. 332 332 */ 333 int pq_set_order(packet_t packet, size_t order, size_t metric)333 int pq_set_order(packet_t *packet, size_t order, size_t metric) 334 334 { 335 335 if (!packet_is_valid(packet)) … … 349 349 * @return EINVAL if the packet is invalid. 350 350 */ 351 int pq_get_order(packet_t packet, size_t *order, size_t *metric)351 int pq_get_order(packet_t *packet, size_t *order, size_t *metric) 352 352 { 353 353 if (!packet_is_valid(packet)) … … 372 372 * packets after its detachment. 373 373 */ 374 void pq_destroy(packet_t first, void (*packet_release)(packet_tpacket))375 { 376 packet_t actual;377 packet_t next;374 void pq_destroy(packet_t *first, void (*packet_release)(packet_t *packet)) 375 { 376 packet_t *actual; 377 packet_t *next; 378 378 379 379 actual = first; … … 395 395 * @return NULL if the packet is not valid. 396 396 */ 397 packet_t pq_next(packet_tpacket)397 packet_t *pq_next(packet_t *packet) 398 398 { 399 399 if (!packet_is_valid(packet)) … … 410 410 * @return NULL if the packet is not valid. 411 411 */ 412 packet_t pq_previous(packet_tpacket)412 packet_t *pq_previous(packet_t *packet) 413 413 { 414 414 if (!packet_is_valid(packet)) -
uspace/lib/c/include/net/packet.h
rfdbc3ff r46d4d9f 46 46 * @see packet 47 47 */ 48 typedef struct packet *packet_t;48 typedef struct packet packet_t; 49 49 50 50 /** Type definition of the packet dimension. … … 69 69 /*@{*/ 70 70 71 extern packet_t pm_find(packet_id_t);72 extern int pm_add(packet_t );71 extern packet_t *pm_find(packet_id_t); 72 extern int pm_add(packet_t *); 73 73 extern int pm_init(void); 74 74 extern void pm_destroy(void); 75 75 76 extern int pq_add(packet_t * , packet_t, size_t, size_t);77 extern packet_t pq_find(packet_t, size_t);78 extern int pq_insert_after(packet_t , packet_t);79 extern packet_t pq_detach(packet_t);80 extern int pq_set_order(packet_t , size_t, size_t);81 extern int pq_get_order(packet_t , size_t *, size_t *);82 extern void pq_destroy(packet_t , void (*)(packet_t));83 extern packet_t pq_next(packet_t);84 extern packet_t pq_previous(packet_t);76 extern int pq_add(packet_t **, packet_t *, size_t, size_t); 77 extern packet_t *pq_find(packet_t *, size_t); 78 extern int pq_insert_after(packet_t *, packet_t *); 79 extern packet_t *pq_detach(packet_t *); 80 extern int pq_set_order(packet_t *, size_t, size_t); 81 extern int pq_get_order(packet_t *, size_t *, size_t *); 82 extern void pq_destroy(packet_t *, void (*)(packet_t *)); 83 extern packet_t *pq_next(packet_t *); 84 extern packet_t *pq_previous(packet_t *); 85 85 86 86 /*@}*/ -
uspace/lib/c/include/net/packet_header.h
rfdbc3ff r46d4d9f 128 128 * @return False otherwise. 129 129 */ 130 static inline int packet_is_valid(const packet_t packet)130 static inline int packet_is_valid(const packet_t *packet) 131 131 { 132 132 return packet && (packet->magic_value == PACKET_MAGIC_VALUE); -
uspace/lib/net/generic/packet_client.c
rfdbc3ff r46d4d9f 57 57 * @return ENOMEM if there is not enough memory left. 58 58 */ 59 int packet_copy_data(packet_t packet, const void *data, size_t length)59 int packet_copy_data(packet_t *packet, const void *data, size_t length) 60 60 { 61 61 if (!packet_is_valid(packet)) … … 81 81 * @return NULL if there is not enough memory left. 82 82 */ 83 void *packet_prefix(packet_t packet, size_t length)83 void *packet_prefix(packet_t *packet, size_t length) 84 84 { 85 85 if ((!packet_is_valid(packet)) || 86 (packet->data_start - sizeof( struct packet) -86 (packet->data_start - sizeof(packet_t) - 87 87 2 * (packet->dest_addr - packet->src_addr) < length)) { 88 88 return NULL; … … 102 102 * @return NULL if there is not enough memory left. 103 103 */ 104 void *packet_suffix(packet_t packet, size_t length)104 void *packet_suffix(packet_t *packet, size_t length) 105 105 { 106 106 if ((!packet_is_valid(packet)) || … … 124 124 * @return ENOMEM if there is not enough memory left. 125 125 */ 126 int packet_trim(packet_t packet, size_t prefix, size_t suffix)126 int packet_trim(packet_t *packet, size_t prefix, size_t suffix) 127 127 { 128 128 if (!packet_is_valid(packet)) … … 143 143 * @return Zero if the packet is not valid. 144 144 */ 145 packet_id_t packet_get_id(const packet_t packet)145 packet_id_t packet_get_id(const packet_t *packet) 146 146 { 147 147 return packet_is_valid(packet) ? packet->packet_id : 0; … … 157 157 * @return EINVAL if the packet is not valid. 158 158 */ 159 int packet_get_addr(const packet_t packet, uint8_t **src, uint8_t **dest)159 int packet_get_addr(const packet_t *packet, uint8_t **src, uint8_t **dest) 160 160 { 161 161 if (!packet_is_valid(packet)) … … 177 177 * @return Zero if the packet is not valid. 178 178 */ 179 size_t packet_get_data_length(const packet_t packet)179 size_t packet_get_data_length(const packet_t *packet) 180 180 { 181 181 if (!packet_is_valid(packet)) … … 191 191 * @return NULL if the packet is not valid. 192 192 */ 193 void *packet_get_data(const packet_t packet)193 void *packet_get_data(const packet_t *packet) 194 194 { 195 195 if (!packet_is_valid(packet)) … … 210 210 */ 211 211 int 212 packet_set_addr(packet_t packet, const uint8_t *src, const uint8_t *dest,212 packet_set_addr(packet_t *packet, const uint8_t *src, const uint8_t *dest, 213 213 size_t addr_len) 214 214 { … … 257 257 * @return NULL on error. 258 258 */ 259 packet_t packet_get_copy(int phone, packet_tpacket)260 { 261 packet_t copy;259 packet_t *packet_get_copy(int phone, packet_t *packet) 260 { 261 packet_t *copy; 262 262 uint8_t * src = NULL; 263 263 uint8_t * dest = NULL; -
uspace/lib/net/generic/packet_remote.c
rfdbc3ff r46d4d9f 64 64 */ 65 65 static int 66 packet_return(int phone, packet_t * packet, packet_id_t packet_id, size_t size)66 packet_return(int phone, packet_t **packet, packet_id_t packet_id, size_t size) 67 67 { 68 68 ipc_call_t answer; … … 72 72 message = async_send_1(phone, NET_PACKET_GET, packet_id, &answer); 73 73 74 *packet = (packet_t ) as_get_mappable_page(size);74 *packet = (packet_t *) as_get_mappable_page(size); 75 75 rc = async_share_in_start_0_0(phone, *packet, size); 76 76 if (rc != EOK) { … … 107 107 * function. 108 108 */ 109 int packet_translate_remote(int phone, packet_t * packet, packet_id_t packet_id)109 int packet_translate_remote(int phone, packet_t **packet, packet_id_t packet_id) 110 110 { 111 111 int rc; … … 127 127 } 128 128 if ((*packet)->next) { 129 packet_t next;129 packet_t *next; 130 130 131 131 return packet_translate_remote(phone, &next, (*packet)->next); … … 148 148 * @return NULL on error. 149 149 */ 150 packet_t packet_get_4_remote(int phone, size_t max_content, size_t addr_len,150 packet_t *packet_get_4_remote(int phone, size_t max_content, size_t addr_len, 151 151 size_t max_prefix, size_t max_suffix) 152 152 { … … 161 161 162 162 163 packet_t packet = pm_find(packet_id);163 packet_t *packet = pm_find(packet_id); 164 164 if (!packet) { 165 165 rc = packet_return(phone, &packet, packet_id, size); … … 180 180 * @return NULL on error. 181 181 */ 182 packet_t packet_get_1_remote(int phone, size_t content)182 packet_t *packet_get_1_remote(int phone, size_t content) 183 183 { 184 184 ipcarg_t packet_id; … … 191 191 return NULL; 192 192 193 packet_t packet = pm_find(packet_id);193 packet_t *packet = pm_find(packet_id); 194 194 if (!packet) { 195 195 rc = packet_return(phone, &packet, packet_id, size); -
uspace/lib/net/il/il_interface.c
rfdbc3ff r46d4d9f 77 77 * 78 78 */ 79 int il_received_msg(int il_phone, device_id_t device_id, packet_t packet,79 int il_received_msg(int il_phone, device_id_t device_id, packet_t *packet, 80 80 services_t target) 81 81 { -
uspace/lib/net/il/ip_client.c
rfdbc3ff r46d4d9f 51 51 * @return Zero if there is no IP header. 52 52 */ 53 size_t ip_client_header_length(packet_t packet)53 size_t ip_client_header_length(packet_t *packet) 54 54 { 55 55 ip_header_t *header; … … 152 152 */ 153 153 int 154 ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl,154 ip_client_prepare_packet(packet_t *packet, ip_protocol_t protocol, ip_ttl_t ttl, 155 155 ip_tos_t tos, int dont_fragment, size_t ipopt_length) 156 156 { … … 208 208 */ 209 209 int 210 ip_client_process_packet(packet_t packet, ip_protocol_t *protocol,210 ip_client_process_packet(packet_t *packet, ip_protocol_t *protocol, 211 211 ip_ttl_t *ttl, ip_tos_t *tos, int *dont_fragment, size_t *ipopt_length) 212 212 { -
uspace/lib/net/il/ip_remote.c
rfdbc3ff r46d4d9f 204 204 */ 205 205 int ip_received_error_msg_remote(int ip_phone, device_id_t device_id, 206 packet_t packet, services_t target, services_t error)206 packet_t *packet, services_t target, services_t error) 207 207 { 208 208 return generic_received_msg_remote(ip_phone, NET_IP_RECEIVED_ERROR, … … 225 225 * function. 226 226 */ 227 int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t packet,227 int ip_send_msg_remote(int ip_phone, device_id_t device_id, packet_t *packet, 228 228 services_t sender, services_t error) 229 229 { -
uspace/lib/net/include/icmp_client.h
rfdbc3ff r46d4d9f 41 41 #include <net/packet.h> 42 42 43 extern int icmp_client_process_packet(packet_t , icmp_type_t *, icmp_code_t *,43 extern int icmp_client_process_packet(packet_t *, icmp_type_t *, icmp_code_t *, 44 44 icmp_param_t *, icmp_param_t *); 45 extern size_t icmp_client_header_length(packet_t );45 extern size_t icmp_client_header_length(packet_t *); 46 46 47 47 #endif -
uspace/lib/net/include/icmp_interface.h
rfdbc3ff r46d4d9f 51 51 52 52 extern int icmp_destination_unreachable_msg(int, icmp_code_t, icmp_param_t, 53 packet_t );54 extern int icmp_source_quench_msg(int, packet_t );55 extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t );56 extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t );53 packet_t *); 54 extern int icmp_source_quench_msg(int, packet_t *); 55 extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t *); 56 extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t *); 57 57 58 58 /*@}*/ -
uspace/lib/net/include/il_interface.h
rfdbc3ff r46d4d9f 51 51 52 52 extern int il_device_state_msg(int, device_id_t, device_state_t, services_t); 53 extern int il_received_msg(int, device_id_t, packet_t , services_t);53 extern int il_received_msg(int, device_id_t, packet_t *, services_t); 54 54 extern int il_mtu_changed_msg(int, device_id_t, size_t, services_t); 55 55 -
uspace/lib/net/include/ip_client.h
rfdbc3ff r46d4d9f 45 45 #include <ip_interface.h> 46 46 47 extern int ip_client_prepare_packet(packet_t , ip_protocol_t, ip_ttl_t, ip_tos_t,48 i nt, size_t);49 extern int ip_client_process_packet(packet_t , ip_protocol_t *, ip_ttl_t *,47 extern int ip_client_prepare_packet(packet_t *, ip_protocol_t, ip_ttl_t, 48 ip_tos_t, int, size_t); 49 extern int ip_client_process_packet(packet_t *, ip_protocol_t *, ip_ttl_t *, 50 50 ip_tos_t *, int *, size_t *); 51 extern size_t ip_client_header_length(packet_t );51 extern size_t ip_client_header_length(packet_t *); 52 52 extern int ip_client_set_pseudo_header_data_length(void *, size_t, size_t); 53 53 extern int ip_client_get_pseudo_header(ip_protocol_t, struct sockaddr *, -
uspace/lib/net/include/ip_interface.h
rfdbc3ff r46d4d9f 70 70 * @return EOK on success. 71 71 */ 72 typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t packet,72 typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t *packet, 73 73 services_t receiver, services_t error); 74 74 -
uspace/lib/net/include/ip_remote.h
rfdbc3ff r46d4d9f 45 45 extern int ip_set_gateway_req_remote(int, device_id_t, in_addr_t); 46 46 extern int ip_packet_size_req_remote(int, device_id_t, packet_dimension_t *); 47 extern int ip_received_error_msg_remote(int, device_id_t, packet_t , services_t,47 extern int ip_received_error_msg_remote(int, device_id_t, packet_t *, services_t, 48 48 services_t); 49 49 extern int ip_device_req_remote(int, device_id_t, services_t); 50 50 extern int ip_add_route_req_remote(int, device_id_t, in_addr_t, in_addr_t, 51 51 in_addr_t); 52 extern int ip_send_msg_remote(int, device_id_t, packet_t , services_t,52 extern int ip_send_msg_remote(int, device_id_t, packet_t *, services_t, 53 53 services_t); 54 54 extern int ip_get_route_req_remote(int, ip_protocol_t, const struct sockaddr *, -
uspace/lib/net/include/netif_local.h
rfdbc3ff r46d4d9f 111 111 * message implementation. 112 112 */ 113 extern int netif_send_message(device_id_t device_id, packet_t packet,113 extern int netif_send_message(device_id_t device_id, packet_t *packet, 114 114 services_t sender); 115 115 … … 198 198 char **); 199 199 extern int netif_probe_req_local(int, device_id_t, int, int); 200 extern int netif_send_msg_local(int, device_id_t, packet_t , services_t);200 extern int netif_send_msg_local(int, device_id_t, packet_t *, services_t); 201 201 extern int netif_start_req_local(int, device_id_t); 202 202 extern int netif_stop_req_local(int, device_id_t); … … 208 208 extern void null_device_stats(device_stats_t *); 209 209 extern void netif_pq_release(packet_id_t); 210 extern packet_t netif_packet_get_1(size_t);210 extern packet_t *netif_packet_get_1(size_t); 211 211 extern int netif_init_module(async_client_conn_t); 212 212 -
uspace/lib/net/include/netif_remote.h
rfdbc3ff r46d4d9f 44 44 char **); 45 45 extern int netif_probe_req_remote(int, device_id_t, int, int); 46 extern int netif_send_msg_remote(int, device_id_t, packet_t , services_t);46 extern int netif_send_msg_remote(int, device_id_t, packet_t *, services_t); 47 47 extern int netif_start_req_remote(int, device_id_t); 48 48 extern int netif_stop_req_remote(int, device_id_t); -
uspace/lib/net/include/nil_local.h
rfdbc3ff r46d4d9f 77 77 * received function. 78 78 */ 79 extern int nil_received_msg_local(int, device_id_t, packet_t , services_t);79 extern int nil_received_msg_local(int, device_id_t, packet_t *, services_t); 80 80 81 81 /** Message processing function. -
uspace/lib/net/include/nil_remote.h
rfdbc3ff r46d4d9f 39 39 40 40 extern int nil_device_state_msg_remote(int, device_id_t, int); 41 extern int nil_received_msg_remote(int, device_id_t, packet_t , services_t);41 extern int nil_received_msg_remote(int, device_id_t, packet_t *, services_t); 42 42 43 43 #endif -
uspace/lib/net/include/packet_client.h
rfdbc3ff r46d4d9f 99 99 packet_trim((packet), sizeof(prefix), sizeof(suffix)) 100 100 101 extern void *packet_prefix(packet_t , size_t);102 extern void *packet_suffix(packet_t , size_t);103 extern int packet_trim(packet_t , size_t, size_t);104 extern int packet_copy_data(packet_t , const void *, size_t);105 extern packet_id_t packet_get_id(const packet_t );106 extern size_t packet_get_data_length(const packet_t );107 extern void *packet_get_data(const packet_t );108 extern int packet_get_addr(const packet_t , uint8_t **, uint8_t **);109 extern int packet_set_addr(packet_t , const uint8_t *, const uint8_t *, size_t);110 extern packet_t packet_get_copy(int phone, packet_t packet);101 extern void *packet_prefix(packet_t *, size_t); 102 extern void *packet_suffix(packet_t *, size_t); 103 extern int packet_trim(packet_t *, size_t, size_t); 104 extern int packet_copy_data(packet_t *, const void *, size_t); 105 extern packet_id_t packet_get_id(const packet_t *); 106 extern size_t packet_get_data_length(const packet_t *); 107 extern void *packet_get_data(const packet_t *); 108 extern int packet_get_addr(const packet_t *, uint8_t **, uint8_t **); 109 extern int packet_set_addr(packet_t *, const uint8_t *, const uint8_t *, size_t); 110 extern packet_t *packet_get_copy(int, packet_t *); 111 111 112 112 /*@}*/ -
uspace/lib/net/include/packet_remote.h
rfdbc3ff r46d4d9f 37 37 #include <sys/types.h> 38 38 39 extern int packet_translate_remote(int, packet_t * , packet_id_t);40 extern packet_t packet_get_4_remote(int, size_t, size_t, size_t, size_t);41 extern packet_t packet_get_1_remote(int, size_t);39 extern int packet_translate_remote(int, packet_t **, packet_id_t); 40 extern packet_t *packet_get_4_remote(int, size_t, size_t, size_t, size_t); 41 extern packet_t *packet_get_1_remote(int, size_t); 42 42 extern void pq_release_remote(int, packet_id_t); 43 43 -
uspace/lib/net/include/socket_core.h
rfdbc3ff r46d4d9f 117 117 extern int socket_destroy(int, int, socket_cores_t *, socket_ports_t *, 118 118 void (*)(socket_core_t *)); 119 extern int socket_reply_packets(packet_t , size_t *);119 extern int socket_reply_packets(packet_t *, size_t *); 120 120 extern socket_core_t *socket_port_find(socket_ports_t *, int, const char *, 121 121 size_t); -
uspace/lib/net/include/tl_common.h
rfdbc3ff r46d4d9f 57 57 size_t); 58 58 extern int tl_set_address_port(struct sockaddr *, int, uint16_t); 59 extern int tl_prepare_icmp_packet(int, int, packet_t , services_t);60 extern int tl_socket_read_packet_data(int, packet_t * , size_t,59 extern int tl_prepare_icmp_packet(int, int, packet_t *, services_t); 60 extern int tl_socket_read_packet_data(int, packet_t **, size_t, 61 61 const packet_dimension_t *, const struct sockaddr *, socklen_t); 62 62 -
uspace/lib/net/include/tl_interface.h
rfdbc3ff r46d4d9f 52 52 /*@{*/ 53 53 54 extern int tl_received_msg(int, device_id_t, packet_t , services_t, services_t);54 extern int tl_received_msg(int, device_id_t, packet_t *, services_t, services_t); 55 55 56 56 /*@}*/ -
uspace/lib/net/netif/netif_local.c
rfdbc3ff r46d4d9f 92 92 */ 93 93 int netif_send_msg_local(int netif_phone, device_id_t device_id, 94 packet_t packet, services_t sender)94 packet_t *packet, services_t sender) 95 95 { 96 96 fibril_rwlock_write_lock(&netif_globals.lock); … … 307 307 * 308 308 */ 309 packet_t netif_packet_get_1(size_t content)309 packet_t *netif_packet_get_1(size_t content) 310 310 { 311 311 return packet_get_1_remote(netif_globals.net_phone, content); … … 361 361 size_t length; 362 362 device_stats_t stats; 363 packet_t packet;363 packet_t *packet; 364 364 measured_string_t address; 365 365 int rc; -
uspace/lib/net/netif/netif_remote.c
rfdbc3ff r46d4d9f 93 93 */ 94 94 int 95 netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet,95 netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t *packet, 96 96 services_t sender) 97 97 { -
uspace/lib/net/nil/nil_remote.c
rfdbc3ff r46d4d9f 74 74 */ 75 75 int nil_received_msg_remote(int nil_phone, device_id_t device_id, 76 packet_t packet, services_t target)76 packet_t *packet, services_t target) 77 77 { 78 78 return generic_received_msg_remote(nil_phone, NET_NIL_RECEIVED, -
uspace/lib/net/tl/icmp_client.c
rfdbc3ff r46d4d9f 61 61 */ 62 62 int 63 icmp_client_process_packet(packet_t packet, icmp_type_t *type,63 icmp_client_process_packet(packet_t *packet, icmp_type_t *type, 64 64 icmp_code_t *code, icmp_param_t *pointer, icmp_param_t *mtu) 65 65 { … … 94 94 * @return The ICMP header length in bytes. 95 95 */ 96 size_t icmp_client_header_length(packet_t packet)96 size_t icmp_client_header_length(packet_t *packet) 97 97 { 98 98 if (packet_get_data_length(packet) < sizeof(icmp_header_t)) -
uspace/lib/net/tl/icmp_remote.c
rfdbc3ff r46d4d9f 63 63 int 64 64 icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, 65 icmp_param_t mtu, packet_t packet)65 icmp_param_t mtu, packet_t *packet) 66 66 { 67 67 async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (ipcarg_t) code, … … 82 82 * @return ENOMEM if there is not enough memory left. 83 83 */ 84 int icmp_source_quench_msg(int icmp_phone, packet_t packet)84 int icmp_source_quench_msg(int icmp_phone, packet_t *packet) 85 85 { 86 86 async_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0, … … 102 102 * @return ENOMEM if there is not enough memory left. 103 103 */ 104 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet)104 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t *packet) 105 105 { 106 106 async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (ipcarg_t) code, … … 124 124 */ 125 125 int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code, 126 icmp_param_t pointer, packet_t packet)126 icmp_param_t pointer, packet_t *packet) 127 127 { 128 128 async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (ipcarg_t) code, -
uspace/lib/net/tl/socket_core.c
rfdbc3ff r46d4d9f 522 522 * function. 523 523 */ 524 int socket_reply_packets(packet_t packet, size_t *length)525 { 526 packet_t next_packet;524 int socket_reply_packets(packet_t *packet, size_t *length) 525 { 526 packet_t *next_packet; 527 527 size_t fragments; 528 528 size_t *lengths; -
uspace/lib/net/tl/tl_common.c
rfdbc3ff r46d4d9f 248 248 */ 249 249 int 250 tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet,250 tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t *packet, 251 251 services_t error) 252 252 { 253 packet_t next;253 packet_t *next; 254 254 uint8_t *src; 255 255 int length; … … 287 287 */ 288 288 int 289 tl_socket_read_packet_data(int packet_phone, packet_t * packet, size_t prefix,289 tl_socket_read_packet_data(int packet_phone, packet_t **packet, size_t prefix, 290 290 const packet_dimension_t *dimension, const struct sockaddr *addr, 291 291 socklen_t addrlen) -
uspace/lib/net/tl/tl_interface.c
rfdbc3ff r46d4d9f 58 58 */ 59 59 int 60 tl_received_msg(int tl_phone, device_id_t device_id, packet_t packet,60 tl_received_msg(int tl_phone, device_id_t device_id, packet_t *packet, 61 61 services_t target, services_t error) 62 62 { -
uspace/lib/packet/generic/packet_server.c
rfdbc3ff r46d4d9f 69 69 fibril_mutex_t lock; 70 70 /** Free packet queues. */ 71 packet_t free[FREE_QUEUES_COUNT];71 packet_t *free[FREE_QUEUES_COUNT]; 72 72 73 73 /** … … 103 103 }; 104 104 105 int packet_translate_local(int phone, packet_t * packet, packet_id_t packet_id)105 int packet_translate_local(int phone, packet_t **packet, packet_id_t packet_id) 106 106 { 107 107 if (!packet) … … 122 122 */ 123 123 static void 124 packet_init(packet_t packet, size_t addr_len, size_t max_prefix,124 packet_init(packet_t *packet, size_t addr_len, size_t max_prefix, 125 125 size_t max_content, size_t max_suffix) 126 126 { 127 127 // clear the packet content 128 bzero(((void *) packet) + sizeof( struct packet),129 packet->length - sizeof( struct packet));128 bzero(((void *) packet) + sizeof(packet_t), 129 packet->length - sizeof(packet_t)); 130 130 131 131 // clear the packet header … … 135 135 packet->next = 0; 136 136 packet->addr_len = 0; 137 packet->src_addr = sizeof( struct packet);137 packet->src_addr = sizeof(packet_t); 138 138 packet->dest_addr = packet->src_addr + addr_len; 139 139 packet->max_prefix = max_prefix; … … 157 157 * @return NULL if there is not enough memory left. 158 158 */ 159 static packet_t 159 static packet_t * 160 160 packet_create(size_t length, size_t addr_len, size_t max_prefix, 161 161 size_t max_content, size_t max_suffix) 162 162 { 163 packet_t packet;163 packet_t *packet; 164 164 int rc; 165 165 166 166 // already locked 167 packet = (packet_t ) mmap(NULL, length, PROTO_READ | PROTO_WRITE,167 packet = (packet_t *) mmap(NULL, length, PROTO_READ | PROTO_WRITE, 168 168 MAP_SHARED | MAP_ANONYMOUS, 0, 0); 169 169 if (packet == MAP_FAILED) … … 198 198 * @return NULL if there is not enough memory left. 199 199 */ 200 static packet_t 200 static packet_t * 201 201 packet_get_local(size_t addr_len, size_t max_prefix, size_t max_content, 202 202 size_t max_suffix) 203 203 { 204 size_t length = ALIGN_UP(sizeof( struct packet) + 2 * addr_len +204 size_t length = ALIGN_UP(sizeof(packet_t) + 2 * addr_len + 205 205 max_prefix + max_content + max_suffix, PAGE_SIZE); 206 206 207 207 fibril_mutex_lock(&ps_globals.lock); 208 208 209 packet_t packet;209 packet_t *packet; 210 210 unsigned int index; 211 211 … … 241 241 } 242 242 243 packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len,243 packet_t *packet_get_4_local(int phone, size_t max_content, size_t addr_len, 244 244 size_t max_prefix, size_t max_suffix) 245 245 { … … 247 247 } 248 248 249 packet_t packet_get_1_local(int phone, size_t content)249 packet_t *packet_get_1_local(int phone, size_t content) 250 250 { 251 251 return packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX, content, … … 260 260 * 261 261 */ 262 static void packet_release(packet_t packet)262 static void packet_release(packet_t *packet) 263 263 { 264 264 int index; … … 283 283 static int packet_release_wrapper(packet_id_t packet_id) 284 284 { 285 packet_t packet;285 packet_t *packet; 286 286 287 287 packet = pm_find(packet_id); … … 310 310 * async_share_in_finalize() function. 311 311 */ 312 static int packet_reply( const packet_tpacket)312 static int packet_reply(packet_t *packet) 313 313 { 314 314 ipc_callid_t callid; … … 351 351 int *answer_count) 352 352 { 353 packet_t packet;353 packet_t *packet; 354 354 355 355 *answer_count = 0; -
uspace/lib/packet/include/packet_local.h
rfdbc3ff r46d4d9f 43 43 /*@{*/ 44 44 45 extern int packet_translate_local(int, packet_t * , packet_id_t);46 extern packet_t packet_get_4_local(int, size_t, size_t, size_t, size_t);47 extern packet_t packet_get_1_local(int, size_t);45 extern int packet_translate_local(int, packet_t **, packet_id_t); 46 extern packet_t *packet_get_4_local(int, size_t, size_t, size_t, size_t); 47 extern packet_t *packet_get_1_local(int, size_t); 48 48 extern void pq_release_local(int, packet_id_t); 49 49
Note:
See TracChangeset
for help on using the changeset viewer.