/branches/network/uspace/srv/net/structures/packet/packet_remote.c |
---|
51,10 → 51,10 |
/** Obtains the packet from the packet server as the shared memory block. |
* Creates the local packet mapping as well. |
* @param phone The packet server module phone. Input parameter. |
* @param packet The packet reference pointer to store the received packet reference. Output parameter. |
* @param packet_id The packet identifier. Input parameter. |
* @param size The packet total size in bytes. Input parameter. |
* @param[in] phone The packet server module phone. |
* @param[out] packet The packet reference pointer to store the received packet reference. |
* @param[in] packet_id The packet identifier. |
* @param[in] size The packet total size in bytes. |
* @returns EOK on success. |
* @returns Other error codes as defined for the pm_add() function. |
* @returns Other error codes as defined for the ipc_share_in_start() function. |
/branches/network/uspace/srv/net/structures/packet/packet_server.h |
---|
45,10 → 45,10 |
#include <ipc/ipc.h> |
/** Processes the packet server message. |
* @param callid The message identifier. Input parameter. |
* @param call The message parameters. Input parameter. |
* @param answer The message answer parameters. Output parameter. |
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter. |
* @param[in] callid The message identifier. |
* @param[in] call The message parameters. |
* @param[out] answer The message answer parameters. |
* @param[out] answer_count The last parameter for the actual answer in the answer parameter. |
* @returns EOK on success. |
* @returns ENOMEM if there is not enough memory left. |
* @returns ENOENT if there is no such packet as in the packet message parameter.. |
/branches/network/uspace/srv/net/structures/packet/packet_header.h |
---|
40,17 → 40,17 |
#include "packet.h" |
/** Returns the actual packet data length. |
* @param header The packet header. Input parameter. |
* @param[in] header The packet header. |
*/ |
#define PACKET_DATA_LENGTH( header ) (( header )->data_end - ( header )->data_start ) |
/** Returns the maximum packet address length. |
* @param header The packet header. Input parameter. |
* @param[in] header The packet header. |
*/ |
#define PACKET_MAX_ADDRESS_LENGTH( header ) (( header )->dest_addr - ( header )->src_addr ) |
/** Returns the minimum packet suffix. |
* @param header The packet header. Input parameter. |
* @param[in] header The packet header. |
*/ |
#define PACKET_MIN_SUFFIX( header ) (( header )->length - ( header )->data_start - ( header )->max_content ) |
109,7 → 109,7 |
}; |
/** Returns whether the packet is valid. |
* @param packet The packet to be checked. Input parameter. |
* @param[in] packet The packet to be checked. |
* @returns true if the packet is not NULL and the magic value is correct. |
* @returns false otherwise. |
*/ |
/branches/network/uspace/srv/net/structures/packet/packet.c |
---|
56,12 → 56,12 |
#define PACKET_MAP_SIZE 100 |
/** Returns the packet map page index. |
* @param packet_id The packet identifier. |
* @param[in] packet_id The packet identifier. |
*/ |
#define PACKET_MAP_PAGE( packet_id ) ((( packet_id ) - 1 ) / PACKET_MAP_SIZE ) |
/** Returns the packet index in the corresponding packet map page. |
* @param packet_id The packet identifier. |
* @param[in] packet_id The packet identifier. |
*/ |
#define PACKET_MAP_INDEX( packet_id ) ((( packet_id ) - 1 ) % PACKET_MAP_SIZE ) |
79,7 → 79,7 |
GENERIC_FIELD_DECLARE( gpm, packet_map_t ); |
/** Releases the packet. |
* @param packet The packet to be released. Input parameter. |
* @param[in] packet The packet to be released. |
* @returns EOK on success. |
* @returns EINVAL if the packet is not valid. |
*/ |
/branches/network/uspace/srv/net/structures/packet/packet_client.h |
---|
52,8 → 52,8 |
/** Allocates the specified type right before the actual packet content and returns its pointer. |
* The wrapper of the packet_prepend() function. |
* @param packet The packet to be used. Input parameter. |
* @param type The type to be allocated at the beginning of the packet content. Input parameter. |
* @param[in] packet The packet to be used. |
* @param[in] type The type to be allocated at the beginning of the packet content. |
* @returns The typed pointer to the allocated memory. |
* @returns NULL if the packet is not valid. |
* @returns NULL if there is not enough memory left. |
62,8 → 62,8 |
/** Allocates the specified type right after the actual packet content and returns its pointer. |
* The wrapper of the packet_append() function. |
* @param packet The packet to be used. Input parameter. |
* @param type The type to be allocated at the end of the packet content. Input parameter. |
* @param[in] packet The packet to be used. |
* @param[in] type The type to be allocated at the end of the packet content. |
* @returns The typed pointer to the allocated memory. |
* @returns NULL if the packet is not valid. |
* @returns NULL if there is not enough memory left. |
72,9 → 72,9 |
/** Trims the actual packet content by the specified prefix and suffix types. |
* The wrapper of the packet_trim() function. |
* @param packet The packet to be trimmed. Input parameter. |
* @param prefix The type of the prefix to be removed from the beginning of the packet content. Input parameter. |
* @param suffix The type of the suffix to be removed from the end of the packet content. Input parameter. |
* @param[in] packet The packet to be trimmed. |
* @param[in] prefix The type of the prefix to be removed from the beginning of the packet content. |
* @param[in] suffix The type of the suffix to be removed from the end of the packet content. |
* @returns EOK on success. |
* @returns EINVAL if the packet is not valid. |
* @returns ENOMEM if there is not enough memory left. |
82,8 → 82,8 |
#define PACKET_TRIM( packet, prefix, suffix ) packet_trim(( packet ), sizeof( prefix ), sizeof( suffix )) |
/** Allocates the specified space right before the actual packet content and returns its pointer. |
* @param packet The packet to be used. Input parameter. |
* @param length The space length to be allocated at the beginning of the packet content. Input parameter. |
* @param[in] packet The packet to be used. |
* @param[in] length The space length to be allocated at the beginning of the packet content. |
* @returns The pointer to the allocated memory. |
* @returns NULL if there is not enough memory left. |
*/ |
90,8 → 90,8 |
void * packet_prefix( packet_t packet, size_t length ); |
/** Allocates the specified space right after the actual packet content and returns its pointer. |
* @param packet The packet to be used. Input parameter. |
* @param length The space length to be allocated at the end of the packet content. Input parameter. |
* @param[in] packet The packet to be used. |
* @param[in] length The space length to be allocated at the end of the packet content. |
* @returns The pointer to the allocated memory. |
* @returns NULL if there is not enough memory left. |
*/ |
98,9 → 98,9 |
void * packet_suffix( packet_t packet, size_t length ); |
/** Trims the actual packet content by the specified prefix and suffix lengths. |
* @param packet The packet to be trimmed. Input parameter. |
* @param prefix The prefix length to be removed from the beginning of the packet content. Input parameter. |
* @param suffix The suffix length to be removed from the end of the packet content. Input parameter. |
* @param[in] packet The packet to be trimmed. |
* @param[in] prefix The prefix length to be removed from the beginning of the packet content. |
* @param[in] suffix The suffix length to be removed from the end of the packet content. |
* @returns EOK on success. |
* @returns EINVAL if the packet is not valid. |
* @returns ENOMEM if there is not enough memory left. |
109,9 → 109,9 |
/** Copies the specified data to the beginning of the actual packet content. |
* Pushes the content end if needed. |
* @param packet The packet to be filled. Input parameter. |
* @param data The data to be copied. Input parameter. |
* @param length The length of the copied data. Input parameter. |
* @param[in] packet The packet to be filled. |
* @param[in] data The data to be copied. |
* @param[in] length The length of the copied data. |
* @returns EOK on success. |
* @returns EINVAL if the packet is not valid. |
* @returns ENOMEM if there is not enough memory left. |
119,7 → 119,7 |
int packet_copy_data( packet_t packet, const void * data, size_t length ); |
/** Returns the packet identifier. |
* @param packet The packet. Input parameter. |
* @param[in] packet The packet. |
* @returns The packet identifier. |
* @returns Zero (0) if the packet is not valid. |
*/ |
126,7 → 126,7 |
packet_id_t packet_get_id( const packet_t packet ); |
/** Returns the packet content length. |
* @param packet The packet. Input parameter. |
* @param[in] packet The packet. |
* @returns The packet content length in bytes. |
* @returns Zero (0) if the packet is not valid. |
*/ |
133,7 → 133,7 |
size_t packet_get_data_length( const packet_t packet ); |
/** Returns the pointer to the beginning of the packet content. |
* @param packet The packet. Input parameter. |
* @param[in] packet The packet. |
* @returns The pointer to the beginning of the packet content. |
* @returns NULL if the packet is not valid. |
*/ |
140,9 → 140,9 |
void * packet_get_data( const packet_t packet ); |
/** Returns the stored packet addresses and their length. |
* @param packet The packet. Input parameter. |
* @param src The source address. May be NULL if not desired. Output parameter. |
* @param dest The destination address. May be NULL if not desired. Output parameter. |
* @param[in] packet The packet. |
* @param[out] src The source address. May be NULL if not desired. |
* @param[out] dest The destination address. May be NULL if not desired. |
* @returns The stored addresses length. |
* @returns Zero (0) if the addresses are not present. |
* @returns EINVAL if the packet is not valid. |
150,10 → 150,10 |
int packet_get_addr( const packet_t packet, uint8_t ** src, uint8_t ** dest ); |
/** Sets the packet addresses. |
* @param packet The packet. Input parameter. |
* @param src The new source address. May be NULL. Input parameter. |
* @param dest The new destination address. May be NULL. Input parameter. |
* @param addr_len The addresses length. |
* @param[in] packet The packet. |
* @param[in] src The new source address. May be NULL. |
* @param[in] dest The new destination address. May be NULL. |
* @param[in] addr_len The addresses length. |
* @returns EOK on success. |
* @returns EINVAL if the packet is not valid. |
* @returns ENOMEM if there is not enough memory left. |
163,9 → 163,9 |
/** Translates the packet identifier to the packet reference. |
* Tries to find mapping first. |
* Contacts the packet server to share the packet if the mapping is not present. |
* @param phone The packet server module phone. Input parameter. |
* @param packet The packet reference. Output parameter. |
* @param packet_id The packet identifier. Input parameter. |
* @param[in] phone The packet server module phone. |
* @param[out] packet The packet reference. |
* @param[in] packet_id The packet identifier. |
* @returns EOK on success. |
* @returns EINVAL if the packet parameter is NULL. |
* @returns Other error codes as defined for the NET_PACKET_GET_SIZE message. |
175,11 → 175,11 |
/** Obtains the packet of the given dimensions. |
* Contacts the packet server to return the appropriate packet. |
* @param phone The packet server module phone. Input parameter. |
* @param addr_len The source and destination addresses maximal length in bytes. Input parameter. |
* @param max_prefix The maximal prefix length in bytes. Input parameter. |
* @param max_content The maximal content length in bytes. Input parameter. |
* @param max_suffix The maximal suffix length in bytes. Input parameter. |
* @param[in] phone The packet server module phone. |
* @param[in] addr_len The source and destination addresses maximal length in bytes. |
* @param[in] max_prefix The maximal prefix length in bytes. |
* @param[in] max_content The maximal content length in bytes. |
* @param[in] max_suffix The maximal suffix length in bytes. |
* @returns The packet reference. |
* @returns NULL on error. |
*/ |
187,8 → 187,8 |
/** Obtains the packet of the given content size. |
* Contacts the packet server to return the appropriate packet. |
* @param phone The packet server module phone. Input parameter. |
* @param content The maximal content length in bytes. Input parameter. |
* @param[in] phone The packet server module phone. |
* @param[in] content The maximal content length in bytes. |
* @returns The packet reference. |
* @returns NULL on error. |
*/ |
198,12 → 198,18 |
* All packets in the queue are marked as free for use. |
* The packet queue may be one packet only. |
* The module should not use the packets after this point until they are received or obtained again. |
* @param phone The packet server module phone. Input parameter. |
* @param packet_id The packet identifier. Input parameter. |
* @param[in] phone The packet server module phone. |
* @param[in] packet_id The packet identifier. |
*/ |
void pq_release( int phone, packet_id_t packet_id ); |
/** \todo |
/** Returns the packet copy. |
* Copies the addresses, data, order and metric values. |
* Does not copy the queue placement. |
* @param[in] phone The packet server module phone. |
* @param[in] packet The original packet. |
* @returns The packet copy. |
* @returns NULL on error. |
*/ |
packet_t packet_get_copy( int phone, packet_t packet ); |
/branches/network/uspace/srv/net/structures/packet/packet.h |
---|
57,7 → 57,7 |
/*@{*/ |
/** Finds the packet mapping. |
* @param packet_id The packet identifier to be found. Input parameter. |
* @param[in] packet_id The packet identifier to be found. |
* @returns The found packet reference. |
* @returns NULL if the mapping does not exist. |
*/ |
64,7 → 64,7 |
packet_t pm_find( packet_id_t packet_id ); |
/** Adds the packet mapping. |
* @param packet The packet to be remembered. Input parameter. |
* @param[in] packet The packet to be remembered. |
* @returns EOK on success. |
* @returns EINVAL if the packet is not valid. |
* @returns EINVAL if the packet map is not initialized. |
85,10 → 85,10 |
/** Add packet to the sorted queue. |
* The queue is sorted in the ascending order. |
* The packet is inserted right before the packets of the same order value. |
* @param first The first packet of the queue. May be NULL. Input parameter. |
* @param packet The packet to be added. Input parameter. |
* @param order The packet order value. Input parameter. |
* @param metric The metric value of the packet. Input parameter. |
* @param[in] first The first packet of the queue. May be NULL. |
* @param[in] packet The packet to be added. |
* @param[in] order The packet order value. |
* @param[in] metric The metric value of the packet. |
* @returns The first packet of the queue. The original first packet may be shifted by the new packet. |
* @returns NULL if the packet is not valid. |
*/ |
95,8 → 95,8 |
packet_t pq_add( packet_t first, packet_t packet, size_t order, size_t metric ); |
/** Finds the packet with the given order. |
* @param first The first packet of the queue. Input parameter. |
* @param order The packet order value. Input parameter. |
* @param[in] first The first packet of the queue. |
* @param[in] order The packet order value. |
* @returns The packet with the given order. |
* @returns NULL if the first packet is not valid. |
* @returns NULL if the packet is not found. |
104,8 → 104,8 |
packet_t pq_find( packet_t first, size_t order ); |
/** Inserts packet after the given one. |
* @param packet The packet in the queue. Input parameter. |
* @param new_packet The new packet to be inserted. Input parameter. |
* @param[in] packet The packet in the queue. |
* @param[in] new_packet The new packet to be inserted. |
* @returns EOK on success. |
* @returns EINVAL if etiher of the packets is invalid. |
*/ |
112,7 → 112,7 |
int pq_insert_after( packet_t packet, packet_t new_packet ); |
/** Detach the packet from the queue. |
* @param packet The packet to be detached. Input parameter. |
* @param[in] packet The packet to be detached. |
* @returns The next packet in the queue. If the packet is the first one of the queue, this becomes the new first one. |
* @returns NULL if there is no packet left. |
* @returns NULL if the packet is not valid. |
120,9 → 120,9 |
packet_t pq_detach( packet_t packet ); |
/** Sets the packet order and metric attributes. |
* @param packet The packet to be set. Input parameter. |
* @param order The packet order value. Input parameter. |
* @param metric The metric value of the packet. Input parameter. |
* @param[in] packet The packet to be set. |
* @param[in] order The packet order value. |
* @param[in] metric The metric value of the packet. |
* @returns EOK on success. |
* @returns EINVAL if the packet is invalid.. |
*/ |
129,9 → 129,9 |
int pq_set_order( packet_t packet, size_t order, size_t metric ); |
/** Sets the packet order and metric attributes. |
* @param packet The packet to be set. Input parameter. |
* @param order The packet order value. Output parameter. |
* @param metric The metric value of the packet. Ouput parameter. |
* @param[in] packet The packet to be set. |
* @param[out] order The packet order value. |
* @param[out] metric The metric value of the packet. |
* @returns EOK on success. |
* @returns EINVAL if the packet is invalid.. |
*/ |
139,13 → 139,13 |
/** Releases the whole queue. |
* Detaches all packets of the queue and calls the packet_release() for each of them. |
* @param first The first packet of the queue. Input parameter. |
* @param packet_release The releasing function called for each of the packets after its detachment. Input parameter. |
* @param[in] first The first packet of the queue. |
* @param[in] packet_release The releasing function called for each of the packets after its detachment. |
*/ |
void pq_destroy( packet_t first, void ( * packet_release )( packet_t packet )); |
/** Returns the next packet in the queue. |
* @param packet The packet queue member. Input parameter. |
* @param[in] packet The packet queue member. |
* @returns The next packet in the queue. |
* @returns NULL if there is no next packet. |
* @returns NULL if the packet is not valid. |
153,7 → 153,7 |
packet_t pq_next( packet_t packet ); |
/** Returns the previous packet in the queue. |
* @param packet The packet queue member. Input parameter. |
* @param[in] packet The packet queue member. |
* @returns The previous packet in the queue. |
* @returns NULL if there is no previous packet. |
* @returns NULL if the packet is not valid. |
/branches/network/uspace/srv/net/structures/packet/packet_server.c |
---|
105,10 → 105,10 |
* Tries to reuse free packets first. |
* Creates a new packet aligned to the memory page size if none available. |
* Locks the global data during its processing. |
* @param addr_len The source and destination addresses maximal length in bytes. Input parameter. |
* @param max_prefix The maximal prefix length in bytes. Input parameter. |
* @param max_content The maximal content length in bytes. Input parameter. |
* @param max_suffix The maximal suffix length in bytes. Input parameter. |
* @param[in] addr_len The source and destination addresses maximal length in bytes. |
* @param[in] max_prefix The maximal prefix length in bytes. |
* @param[in] max_content The maximal content length in bytes. |
* @param[in] max_suffix The maximal suffix length in bytes. |
* @returns The packet of dimensions at least as given. |
* @returns NULL if there is not enough memory left. |
*/ |
115,7 → 115,7 |
packet_t packet_get( size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix ); |
/** Releases the packet queue. |
* @param packet_id The first packet identifier. Input parameter. |
* @param[in] packet_id The first packet identifier. |
* @returns EOK on success. |
* @returns ENOENT if there is no such packet. |
*/ |
123,17 → 123,17 |
/** Releases the packet and returns it to the appropriate free packet queue. |
* Should be used only when the global data are locked. |
* @param packet The packet to be released. Input parameter. |
* @param[in] packet The packet to be released. |
*/ |
void packet_release( packet_t packet ); |
/** Creates a new packet of dimensions at least as given. |
* Should be used only when the global data are locked. |
* @param length The total length of the packet, including the header, the addresses and the data of the packet. Input parameter. |
* @param addr_len The source and destination addresses maximal length in bytes. Input parameter. |
* @param max_prefix The maximal prefix length in bytes. Input parameter. |
* @param max_content The maximal content length in bytes. Input parameter. |
* @param max_suffix The maximal suffix length in bytes. Input parameter. |
* @param[in] length The total length of the packet, including the header, the addresses and the data of the packet. |
* @param[in] addr_len The source and destination addresses maximal length in bytes. |
* @param[in] max_prefix The maximal prefix length in bytes. |
* @param[in] max_content The maximal content length in bytes. |
* @param[in] max_suffix The maximal suffix length in bytes. |
* @returns The packet of dimensions at least as given. |
* @returns NULL if there is not enough memory left. |
*/ |
140,16 → 140,16 |
packet_t packet_create( size_t length, 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. |
* @param packet The packet to be initialized. Input parameter. |
* @param addr_len The source and destination addresses maximal length in bytes. Input parameter. |
* @param max_prefix The maximal prefix length in bytes. Input parameter. |
* @param max_content The maximal content length in bytes. Input parameter. |
* @param max_suffix The maximal suffix length in bytes. Input parameter. |
* @param[in] packet The packet to be initialized. |
* @param[in] addr_len The source and destination addresses maximal length in bytes. |
* @param[in] max_prefix The maximal prefix length in bytes. |
* @param[in] max_content The maximal content length in bytes. |
* @param[in] max_suffix The maximal suffix length in bytes. |
*/ |
void packet_init( packet_t packet, size_t addr_len, size_t max_prefix, size_t max_content, size_t max_suffix ); |
/** Shares the packet memory block. |
* @param packet The packet to be shared. |
* @param[in] packet The packet to be shared. |
* @returns EOK on success. |
* @returns EINVAL if the packet is not valid. |
* @returns EINVAL if the calling module does not accept the memory. |