1 /******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
4 * This program and the accompanying materials
5 * are made available under the terms of the BSD License
6 * which accompanies this distribution, and is available at
7 * http://www.opensource.org/licenses/bsd-license.php
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
20 #define UDPPORT_BOOTPS 67 /**< UDP port of BootP/DHCP-server */
21 #define UDPPORT_BOOTPC 68 /**< UDP port of BootP/DHCP-client */
22 #define UDPPORT_DNSS 53 /**< UDP port of DNS-server */
23 #define UDPPORT_DNSC 32769 /**< UDP port of DNS-client */
24 #define UDPPORT_TFTPC 2001 /**< UDP port of TFTP-client */
25 #define UDPPORT_DHCPV6C 546 /**< UDP port of DHCPv6-client */
28 * A header for UDP-packets.
29 * For more information see RFC 768.
32 uint16_t uh_sport; /**< Source port */
33 uint16_t uh_dport; /**< Destinantion port */
34 uint16_t uh_ulen; /**< Length in octets, incl. this header and data */
35 uint16_t uh_sum; /**< Checksum */
37 typedef struct udphdr udp_hdr_t;
39 typedef int32_t *(*handle_upper_udp_t)(uint8_t *, int32_t);
40 typedef void *(*handle_upper_udp_dun_t)(uint8_t);
42 /* Handles UDP-packets that are detected by any network layer. */
43 extern int8_t handle_udp(int fd, uint8_t * udp_packet, int32_t packetsize);
45 /* Handles UDP related ICMP-Dest.Unreachable packets that are detected by
46 * the network layers. */
47 extern void handle_udp_dun(uint8_t * udp_packet, uint32_t packetsize, uint8_t err_code);
49 /* fills udp header */
50 extern void fill_udphdr(uint8_t *packet, uint16_t packetsize,
51 uint16_t src_port, uint16_t dest_port);
54 extern void net_set_tftp_port(uint16_t tftp_port);
55 extern void net_set_mtftp_port(uint16_t tftp_port);