Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

udp.h

Go to the documentation of this file.
00001 /*
00002  * udp.h
00003  *
00004  * User Datagram Protocol (RFC 768).
00005  *
00006  * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
00007  *
00008  * $Id: udp.h,v 1.8 2002/04/02 05:05:39 dugsong Exp $
00009  */
00010 
00011 #ifndef DNET_UDP_H
00012 #define DNET_UDP_H
00013 
00014 #define UDP_HDR_LEN     8
00015 
00016 struct udp_hdr {
00017         uint16_t        uh_sport;       /* source port */
00018         uint16_t        uh_dport;       /* destination port */
00019         uint16_t        uh_ulen;        /* udp length (including header) */
00020         uint16_t        uh_sum;         /* udp checksum */
00021 };
00022 
00023 #define UDP_PORT_MAX    65535
00024 
00025 #define udp_pack_hdr(hdr, sport, dport, ulen) do {              \
00026         struct udp_hdr *udp_pack_p = (struct udp_hdr *)(hdr);   \
00027         udp_pack_p->uh_sport = htons(sport);                    \
00028         udp_pack_p->uh_dport = htons(dport);                    \
00029         udp_pack_p->uh_ulen = htons(ulen);                      \
00030 } while (0)
00031 
00032 #endif /* DNET_UDP_H */

Generated on Sun May 14 14:51:10 2006 by  doxygen 1.4.2