Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/udp/udp_header.h

    r457a6f5 raadf01e  
    2828
    2929/** @addtogroup udp
    30  * @{
     30 *  @{
    3131 */
    3232
    3333/** @file
    34  * UDP header definition.
    35  * Based on the RFC 768.
     34 *  UDP header definition.
     35 *  Based on the RFC~768.
    3636 */
    3737
    38 #ifndef NET_UDP_HEADER_H_
    39 #define NET_UDP_HEADER_H_
     38#ifndef __NET_UDP_HEADER_H__
     39#define __NET_UDP_HEADER_H__
    4040
    4141#include <sys/types.h>
    4242
    43 /** UDP header size in bytes. */
    44 #define UDP_HEADER_SIZE         sizeof(udp_header_t)
     43/** UDP header size in bytes.
     44 */
     45#define UDP_HEADER_SIZE                 sizeof(udp_header_t)
    4546
    4647/** Type definition of the user datagram header.
    47  * @see udp_header
     48 *  @see udp_header
    4849 */
    49 typedef struct udp_header udp_header_t;
     50typedef struct udp_header       udp_header_t;
    5051
    5152/** Type definition of the user datagram header pointer.
    52  * @see udp_header
     53 *  @see udp_header
    5354 */
    54 typedef udp_header_t *udp_header_ref;
     55typedef udp_header_t *          udp_header_ref;
    5556
    56 /** User datagram header. */
    57 struct udp_header {
     57/** User datagram header.
     58 */
     59struct udp_header{
     60        /** Source Port is an optional field, when meaningful, it indicates the port of the sending process, and may be assumed to be the port to which a reply should be addressed in the absence of any other information.
     61         *  If not used, a value of zero is inserted.
     62         */
    5863        uint16_t source_port;
     64        /** Destination port has a meaning within the context of a particular internet destination address.
     65         */
    5966        uint16_t destination_port;
     67        /** Length is the length in octets of this user datagram including this header and the data.
     68         *  This means the minimum value of the length is eight.
     69         */
    6070        uint16_t total_length;
     71        /** Checksum is the 16-bit one's complement of the one's complement sum of a pseudo header of information from the IP header, the UDP header, and the data, padded with zero octets at the end (if necessary) to make a multiple of two octets.
     72         *  The pseudo header conceptually prefixed to the UDP header contains the source address, the destination address, the protocol, and the UDP length.
     73         *  This information gives protection against misrouted datagrams.
     74         *  If the computed checksum is zero, it is transmitted as all ones (the equivalent in one's complement arithmetic).
     75         *  An all zero transmitted checksum value means that the transmitter generated no checksum (for debugging or for higher level protocols that don't care).
     76         */
    6177        uint16_t checksum;
    6278} __attribute__ ((packed));
Note: See TracChangeset for help on using the changeset viewer.