packet.c File Reference

Packet map and queue implementation. More...

#include <malloc.h>
#include <mem.h>
#include <fibril_synch.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <adt/generic_field.h>
#include <net/packet.h>
#include <net/packet_header.h>

Go to the source code of this file.

Packet management system interface

int pm_add (packet_t *packet)
 Adds the packet mapping.
void pm_destroy (void)
 Releases the packet map.
packet_tpm_find (packet_id_t packet_id)
 Finds the packet mapping.
int pm_init (void)
 Initializes the packet map.
int pq_add (packet_t **first, packet_t *packet, size_t order, size_t metric)
 Add packet to the sorted queue.
packet_tpq_detach (packet_t *packet)
 Detach the packet from the queue.
packet_tpq_find (packet_t *packet, size_t order)
 Finds the packet with the given order.
int pq_get_order (packet_t *packet, size_t *order, size_t *metric)
 Sets the packet order and metric attributes.
int pq_insert_after (packet_t *packet, packet_t *new_packet)
 Inserts packet after the given one.
packet_tpq_next (packet_t *packet)
 Returns the next packet in the queue.
packet_tpq_previous (packet_t *packet)
 Returns the previous packet in the queue.
int pq_set_order (packet_t *packet, size_t order, size_t metric)
 Sets the packet order and metric attributes.

Defines

#define PACKET_MAP_INDEX(packet_id)   (((packet_id) - 1) % PACKET_MAP_SIZE)
 Returns the packet index in the corresponding packet map page.
#define PACKET_MAP_PAGE(packet_id)   (((packet_id) - 1) / PACKET_MAP_SIZE)
 Returns the packet map page index.
#define PACKET_MAP_SIZE   100
 Packet map page size.

Typedefs

typedef packet_tpacket_map_t [PACKET_MAP_SIZE]
 Type definition of the packet map page.

Functions

 GENERIC_FIELD_DECLARE (gpm, packet_map_t)
 Packet map.
void pq_destroy (packet_t *first, void(*packet_release)(packet_t *packet))
 Releases the whole queue.

Variables

struct {
   fibril_rwlock_t   lock
 Safety lock.
   gpm_t   packet_map
 Packet map.
pm_globals
 Packet map global data.


Detailed Description

Packet map and queue implementation.

This file has to be compiled with both the packet server and the client.

Definition in file packet.c.


Generated on Thu Jun 2 07:45:53 2011 for HelenOS/USB by  doxygen 1.4.7