Ignore:
Timestamp:
2010-11-02T18:29:01Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4f35b9ff
Parents:
76e1121f (diff), 28f4adb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/net/packet_header.h

    r76e1121f r4687a26c  
    2727 */
    2828
    29 /** @addtogroup packet
     29/** @addtogroup libc
    3030 *  @{
    3131 */
    3232
    3333/** @file
    34  *  Packet header.
     34 * Packet header.
    3535 */
    3636
    37 #ifndef __NET_PACKET_HEADER_H__
    38 #define __NET_PACKET_HEADER_H__
     37#ifndef LIBC_PACKET_HEADER_H_
     38#define LIBC_PACKET_HEADER_H_
    3939
    40 #include <packet/packet.h>
     40#include <net/packet.h>
    4141
    4242/** Returns the actual packet data length.
    43  *  @param[in] header The packet header.
     43 * @param[in] header    The packet header.
    4444 */
    45 #define PACKET_DATA_LENGTH(header)              ((header)->data_end - (header)->data_start)
     45#define PACKET_DATA_LENGTH(header) \
     46        ((header)->data_end - (header)->data_start)
    4647
    4748/** Returns the maximum packet address length.
    48  *  @param[in] header The packet header.
     49 * @param[in] header    The packet header.
    4950 */
    50 #define PACKET_MAX_ADDRESS_LENGTH(header)               ((header)->dest_addr - (header)->src_addr)
     51#define PACKET_MAX_ADDRESS_LENGTH(header) \
     52        ((header)->dest_addr - (header)->src_addr)
    5153
    5254/** Returns the minimum packet suffix.
    53  *  @param[in] header The packet header.
     55 *  @param[in] header   The packet header.
    5456 */
    55 #define PACKET_MIN_SUFFIX(header)               ((header)->length - (header)->data_start - (header)->max_content)
     57#define PACKET_MIN_SUFFIX(header) \
     58        ((header)->length - (header)->data_start - (header)->max_content)
    5659
    57 /** Packet integrity check magic value.
    58  */
     60/** Packet integrity check magic value. */
    5961#define PACKET_MAGIC_VALUE      0x11227788
    6062
    61 /** Packet header.
    62  */
    63 struct packet{
    64         /** Packet identifier.
    65          */
     63/** Packet header. */
     64struct packet {
     65        /** Packet identifier. */
    6666        packet_id_t packet_id;
    67         /** Packet queue sorting value.
    68          *  The packet queue is sorted the ascending order.
     67
     68        /**
     69         * Packet queue sorting value.
     70         * The packet queue is sorted the ascending order.
    6971         */
    7072        size_t order;
    71         /** Packet metric.
    72         */
     73
     74        /** Packet metric. */
    7375        size_t metric;
    74         /** Previous packet in the queue.
    75          */
     76        /** Previous packet in the queue. */
    7677        packet_id_t previous;
    77         /** Next packet in the queue.
    78          */
     78        /** Next packet in the queue. */
    7979        packet_id_t next;
    80         /** Total length of the packet.
    81          *  Contains the header, the addresses and the data of the packet.
    82          *  Corresponds to the mapped sharable memory block.
     80
     81        /**
     82         * Total length of the packet.
     83         * Contains the header, the addresses and the data of the packet.
     84         * Corresponds to the mapped sharable memory block.
    8385         */
    8486        size_t length;
    85         /** Stored source and destination addresses length.
    86         */
     87
     88        /** Stored source and destination addresses length. */
    8789        size_t addr_len;
    88         /** Souce address offset in bytes from the beginning of the packet header.
     90
     91        /**
     92         * Souce address offset in bytes from the beginning of the packet
     93         * header.
    8994         */
    9095        size_t src_addr;
    91         /** Destination address offset in bytes from the beginning of the packet header.
     96
     97        /**
     98         * Destination address offset in bytes from the beginning of the packet
     99         * header.
    92100         */
    93101        size_t dest_addr;
    94         /** Reserved data prefix length in bytes.
    95         */
     102
     103        /** Reserved data prefix length in bytes. */
    96104        size_t max_prefix;
    97         /** Reserved content length in bytes.
    98          */
     105        /** Reserved content length in bytes. */
    99106        size_t max_content;
    100         /** Actual data start offset in bytes from the beginning of the packet header.
     107
     108        /**
     109         * Actual data start offset in bytes from the beginning of the packet
     110         * header.
    101111         */
    102112        size_t data_start;
    103         /** Actual data end offset in bytes from the beginning of the packet header.
     113
     114        /**
     115         * Actual data end offset in bytes from the beginning of the packet
     116         * header.
    104117         */
    105118        size_t data_end;
    106         /** Integrity check magic value.
    107         */
     119
     120        /** Integrity check magic value. */
    108121        int magic_value;
    109122};
    110123
    111124/** Returns whether the packet is valid.
    112  *  @param[in] packet The packet to be checked.
    113  *  @returns true if the packet is not NULL and the magic value is correct.
    114  *  @returns false otherwise.
     125 * @param[in] packet    The packet to be checked.
     126 * @returns             True if the packet is not NULL and the magic value is
     127 *                      correct.
     128 * @returns             False otherwise.
    115129 */
    116 static inline int packet_is_valid(const packet_t packet){
     130static inline int packet_is_valid(const packet_t packet)
     131{
    117132        return packet && (packet->magic_value == PACKET_MAGIC_VALUE);
    118133}
Note: See TracChangeset for help on using the changeset viewer.