12632SN/A/* 22632SN/A * udp.h 32632SN/A * 42632SN/A * User Datagram Protocol (RFC 768). 52632SN/A * 62632SN/A * Copyright (c) 2000 Dug Song <dugsong@monkey.org> 72632SN/A * 82632SN/A * $Id: udp.h,v 1.8 2002/04/02 05:05:39 dugsong Exp $ 92632SN/A */ 102632SN/A 112632SN/A#ifndef DNET_UDP_H 122632SN/A#define DNET_UDP_H 132632SN/A 142632SN/A#define UDP_HDR_LEN 8 152632SN/A 162632SN/Astruct udp_hdr { 172632SN/A uint16_t uh_sport; /* source port */ 182632SN/A uint16_t uh_dport; /* destination port */ 192632SN/A uint16_t uh_ulen; /* udp length (including header) */ 202632SN/A uint16_t uh_sum; /* udp checksum */ 212632SN/A}; 222632SN/A 232632SN/A#define UDP_PORT_MAX 65535 242632SN/A 252632SN/A#define udp_pack_hdr(hdr, sport, dport, ulen) do { \ 262632SN/A struct udp_hdr *udp_pack_p = (struct udp_hdr *)(hdr); \ 272632SN/A udp_pack_p->uh_sport = htons(sport); \ 282632SN/A udp_pack_p->uh_dport = htons(dport); \ 292632SN/A udp_pack_p->uh_ulen = htons(ulen); \ 302632SN/A} while (0) 312632SN/A 322632SN/A#endif /* DNET_UDP_H */ 33