move dnet to the correct place so that we use this --HG-- rename : ext/dnet/dnet/addr.h => ext/dnet/addr.h rename : ext/dnet/dnet/arp.h => ext/dnet/arp.h rename : ext/dnet/dnet/blob.h => ext/dnet/blob.h rename : ext/dnet/dnet/eth.h => ext/dnet/eth.h rename : ext/dnet/dnet/fw.h => ext/dnet/fw.h rename : ext/dnet/dnet/icmp.h => ext/dnet/icmp.h rename : ext/dnet/dnet/intf.h => ext/dnet/intf.h rename : ext/dnet/dnet/ip.h => ext/dnet/ip.h rename : ext/dnet/dnet/ip6.h => ext/dnet/ip6.h rename : ext/dnet/dnet/os.h => ext/dnet/os.h rename : ext/dnet/dnet/rand.h => ext/dnet/rand.h rename : ext/dnet/dnet/route.h => ext/dnet/route.h rename : ext/dnet/dnet/tcp.h => ext/dnet/tcp.h rename : ext/dnet/dnet/udp.h => ext/dnet/udp.h
32 lines
782 B
C
32 lines
782 B
C
/*
|
|
* udp.h
|
|
*
|
|
* User Datagram Protocol (RFC 768).
|
|
*
|
|
* Copyright (c) 2000 Dug Song <dugsong@monkey.org>
|
|
*
|
|
* $Id: udp.h,v 1.8 2002/04/02 05:05:39 dugsong Exp $
|
|
*/
|
|
|
|
#ifndef DNET_UDP_H
|
|
#define DNET_UDP_H
|
|
|
|
#define UDP_HDR_LEN 8
|
|
|
|
struct udp_hdr {
|
|
uint16_t uh_sport; /* source port */
|
|
uint16_t uh_dport; /* destination port */
|
|
uint16_t uh_ulen; /* udp length (including header) */
|
|
uint16_t uh_sum; /* udp checksum */
|
|
};
|
|
|
|
#define UDP_PORT_MAX 65535
|
|
|
|
#define udp_pack_hdr(hdr, sport, dport, ulen) do { \
|
|
struct udp_hdr *udp_pack_p = (struct udp_hdr *)(hdr); \
|
|
udp_pack_p->uh_sport = htons(sport); \
|
|
udp_pack_p->uh_dport = htons(dport); \
|
|
udp_pack_p->uh_ulen = htons(ulen); \
|
|
} while (0)
|
|
|
|
#endif /* DNET_UDP_H */
|