Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3911 → Rev 3912

/branches/network/uspace/srv/net/structures/packet/packet_header.h
1,5 → 1,5
/*
* Copyright (c) 2008 Lukas Mejdrech
* Copyright (c) 2009 Lukas Mejdrech
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
26,11 → 26,12
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup net
/** @addtogroup packet
* @{
*/
 
/** @file
* Packet header.
*/
 
#ifndef __NET_PACKET_HEADER_H__
40,27 → 41,73
 
#include "packet.h"
 
/** Packet integrity check magic value.
*/
#define PACKET_MAGIC_VALUE 0x11227788
 
/** Packet header.
*/
struct packet{
/** Packet identifier.
*/
packet_id_t packet_id;
//TODO packet owner not used
/** Packet owner.
*/
services_t owner;
//TODO needed packet mode?
/** Packet mode.
*/
packet_mode_t mode;
/** Packet queue sorting value.
* The packet queue is sorted the ascending order.
*/
int order;
/** Packet metric.
*/
size_t metric;
/** Previous packet in the queue.
*/
packet_id_t previous;
/** Next packet in the queue.
*/
packet_id_t next;
/** Total length of the packet.
* Contains the header, the addresses and the data of the packet.
* Corresponds to the mapped sharable memory block.
*/
size_t length;
/** Source and destination addresses length.
*/
size_t addr_len;
/** Souce address offset in bytes from the beginning of the packet header.
*/
size_t src_addr;
/** Destination address offset in bytes from the beginning of the packet header.
*/
size_t dest_addr;
/** Reserved data prefix length in bytes.
*/
size_t max_prefix;
/** Reserved content length in bytes.
*/
size_t max_content;
/** Actual data start offset in bytes from the beginning of the packet header.
*/
size_t data_start;
/** Actual data end offset in bytes from the beginning of the packet header.
*/
size_t data_end;
/** Integrity check magic value.
*/
int magic_value;
};
 
/** Returns whether the packet is valid.
* @param packet The packet to be checked. Input parameter.
* @returns true if the packet is not NULL and the magic value is correct.
* @returns false otherwise.
*/
static inline int packet_is_valid( const packet_t packet ){
return packet && ( packet->magic_value == PACKET_MAGIC_VALUE );
}