Packet server implementation. More...
#include <align.h>
#include <assert.h>
#include <async.h>
#include <errno.h>
#include <fibril_synch.h>
#include <unistd.h>
#include <ipc/ipc.h>
#include <sys/mman.h>
#include "../../err.h"
#include "../../messages.h"
#include "packet.h"
#include "packet_client.h"
#include "packet_header.h"
#include "packet_messages.h"
#include "packet_server.h"
Defines | |
#define | FREE_QUEUES_COUNT 7 |
#define | DEFAULT_ADDR_LEN 32 |
The default address length reserved for new packets. | |
#define | DEFAULT_PREFIX 64 |
The default prefix reserved for new packets. | |
#define | DEFAULT_SUFFIX 64 |
The default suffix reserved for new packets. | |
Functions | |
int | packet_server_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count) |
Processes the packet server message. | |
Packet server support functions | |
packet_t | packet_get (size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix) |
Returns the packet of dimensions at least as given. | |
int | packet_release_wrapper (packet_id_t packet_id) |
Releases the packet queue. | |
void | packet_release (packet_t packet) |
Releases the packet and returns it to the appropriate free packet queue. | |
packet_t | packet_create (size_t length, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix) |
Creates a new packet of dimensions at least as given. | |
void | packet_init (packet_t packet, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix) |
Clears and initializes the packet according to the given dimensions. | |
int | packet_reply (const packet_t packet) |
Shares the packet memory block. | |
Packet client interface | |
int | packet_translate (int phone, packet_ref packet, packet_id_t packet_id) |
Translates the packet identifier to the packet reference. | |
packet_t | packet_get_4 (int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix) |
Obtains the packet of the given dimensions. | |
packet_t | packet_get_1 (int phone, size_t content) |
Obtains the packet of the given content size. | |
void | pq_release (int phone, packet_id_t packet_id) |
Releases the packet queue. | |
Variables | |
struct { | |
fibril_mutex_t lock | |
Safety lock. | |
packet_t free [FREE_QUEUES_COUNT] | |
Free packet queues. | |
size_t sizes [FREE_QUEUES_COUNT] | |
Packet length upper bounds of the free packet queues. | |
unsigned int count | |
Total packets allocated. | |
} | ps_globals |
Packet server global data. |
Packet server implementation.
unsigned int count |
Total packets allocated.
Referenced by dp_pkt2user(), eth_device_message(), inet_pton(), ip_netif_initialize(), main(), and socket_generate_new_id().
Free packet queues.
Referenced by accept(), add_module(), arp_clear_device(), arp_device_message(), arp_proto_create(), char_map_add_item(), create(), eth_device_message(), eth_register_message(), generic_get_addr_req(), generic_translate_req(), icmp_echo(), icmp_process_client_messages(), ip_get_route_req(), ip_netif_initialize(), ip_prepare_packet(), ip_register(), ip_send_route(), net_free_settings(), netif_probe_message(), nildummy_device_message(), parse_line(), recvfrom_core(), socket(), socket_bind_insert(), socket_get_sockets(), socket_port_add_core(), startup(), tcp_free_socket_data(), tcp_prepare_timeout(), tcp_process_client_messages(), tcp_process_listen(), tcp_process_packet(), tcp_release_after_timeout(), tcp_timeout(), udp_process_client_messages(), udp_process_packet(), and udp_sendto_message().
fibril_mutex_t lock |
Safety lock.