/*
**************************************************************************
*
* Boot-ROM-Code to load an operating system across a TCP/IP network.
*
* Module: kernel/arpa.h
* Purpose: Header file for the higher internet protocols
* Entries: none
*
**************************************************************************
*
* Copyright (C) 1995-2003 Gero Kuhlmann <gero@gkminix.han.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: arpa.h,v 1.5 2003/01/25 23:29:40 gkminix Exp $
*/
#ifndef _KERNEL_ARPA_H
#define _KERNEL_ARPA_H
#ifndef _USE_ASSEMBLER
/*
**************************************************************************
*
* We need some includes for this file
*/
#include <general.h>
#include <kernel/net.h>
#include <pxe/common.h>
#include <pxe/pxegeneral.h>
#include <pxe/tftp.h>
/*
**************************************************************************
*
* Tag values for RFC1048 vendor fields (according to RFC2132):
*/
#define VEND_NOP 0 /* NOP */
#define VEND_SUBNET 1 /* Subnet mask */
#define VEND_TOFFS 2 /* Time offset */
#define VEND_ROUTER 3 /* Router IP address list */
#define VEND_TIMES 4 /* Time server IP address */
#define VEND_NAMES 5 /* Name server IP address */
#define VEND_DNS 6 /* Domain name server IP addr */
#define VEND_LOGS 7 /* Log server IP address */
#define VEND_COOKIES 8 /* Cookie server IP address */
#define VEND_LPRS 9 /* LPR server IP address */
#define VEND_IMPRESS 10 /* IMPRESS server IP address */
#define VEND_RESOURCES 11 /* Resource location server IP */
#define VEND_HNAME 12 /* Client host name */
#define VEND_BFSIZE 13 /* Boot file size */
#define VEND_DUMPFILE 14 /* Merrit Dump file name */
#define VEND_DOMAIN 15 /* Client domain name */
#define VEND_SWAPS 16 /* Swap server IP address */
#define VEND_ROOTPATH 17 /* Root file system path name */
#define VEND_EXTFILE 18 /* Extensions file name */
#define VEND_VENDOR 43 /* Vendor extensions */
#define VEND_REQIP 50 /* Requested client IP address */
#define VEND_IPLEASE 51 /* Lease time for IP address */
#define VEND_OVERLOAD 52 /* Option overload flags */
#define VEND_MSGTYPE 53 /* DHCP message type */
#define VEND_SERVER 54 /* Server IP address */
#define VEND_PARAMREQ 55 /* Parameter request list */
#define VEND_MESSAGE 56 /* DHCP error message */
#define VEND_DHCPSIZE 57 /* Max. DHCP message size */
#define VEND_RENEW 58 /* DHCP renewal time */
#define VEND_REBIND 59 /* DHCP rebind time */
#define VEND_CLASS 60 /* Vendor class identifier */
#define VEND_CLIENTID 61 /* Client ID */
#define VEND_TFTPNAME 66 /* TFTP server name */
#define VEND_BOOTFILE 67 /* Boot file name */
#define VEND_ARCH 93 /* Client architecture */
#define VEND_NETID 94 /* Client network interface ID */
#define VEND_UUID 97 /* Client UUID */
#define VEND_END 255 /* End of option list */
/* Option overload flags */
#define VEND_OVR_FILE 1 /* 'file' field used */
#define VEND_OVR_SNAME 2 /* 'sname' field used */
#define VEND_OVR_BOTH 3 /* both fields used */
/* DHCP message types */
#define VEND_DHCP_DISCOVER 1 /* DHCPDISCOVER message */
#define VEND_DHCP_OFFER 2 /* DHCPOFFER message */
#define VEND_DHCP_REQUEST 3 /* DHCPREQUEST message */
#define VEND_DHCP_DECLINE 4 /* DHCPDECLINE message */
#define VEND_DHCP_ACK 5 /* DHCPACK message */
#define VEND_DHCP_NAK 6 /* DHCPNAK message */
#define VEND_DHCP_RELEASE 7 /* DHCPRELEASE message */
#define VEND_DHCP_INFORM 8 /* DHCPINFORM message */
/* Client system architecture types */
#define VEND_CLIENT_IAx86PC 0 /* Intel x86 PC client */
#define VEND_CLIENT_PC98 1 /* NEC/Intel PC98 client */
#define VEND_CLIENT_IA64PC 2 /* Intel IA64 client */
#define VEND_CLIENT_ALPHA 3 /* DEC alpha client */
#define VEND_CLIENT_ARCx86 4 /* Intel x86 non-PC client */
/*
**************************************************************************
*
* Tag values for PXE vendor fields. The actual tag numbers are in the low
* order byte. The MSB identifies these as PXE vendor tags.
*/
#define VEND_PXE_STRING "PXEClient"
#define VEND_PXE_STRLEN 9
#define VEND_PXE_BASE 0x0100 /* Base of vendor tag numbers */
#define VEND_PXE_MASK 0x00FF /* Mask for extracting tag no. */
#define VEND_PXE_MTFTP_IP 0x0101 /* Multicast TFTP IP */
#define VEND_PXE_MTFTP_CPORT 0x0102 /* Multicast TFTP client port */
#define VEND_PXE_MTFTP_SPORT 0x0103 /* Multicast TFTP server port */
#define VEND_PXE_MTFTP_TMOUT 0x0104 /* Multicast TFTP timeout */
#define VEND_PXE_MTFTP_DELAY 0x0105 /* Multicast TFTP delay */
#define VEND_PXE_DISCOVER_CTL 0x0106 /* Discovery control */
#define VEND_PXE_DISCOVER_ADDR 0x0107 /* Discovery multicast IP addr */
#define VEND_PXE_SERVERS 0x0108 /* List of boot servers */
#define VEND_PXE_BOOT_MENU 0x0109 /* Boot menu specification */
#define VEND_PXE_MENU_PROMPT 0x010A /* Boot menu prompt */
#define VEND_PXE_MCAST_ADDRS 0x010B /* Multicast IP address range */
#define VEND_PXE_BOOT_ITEM 0x0147 /* Selected boot item */
#define VEND_PXE_END 0x01FF /* End tag */
/* PXE boot server types */
#define VEND_PXE_SERV_PXE 0 /* PXE bootstrap server */
#define VEND_PXE_SERV_WINNT 1 /* Windows NT boot server */
#define VEND_PXE_SERV_LCM 2 /* Intel LCM boot server */
#define VEND_PXE_SERV_DOS 3 /* DOS/UNDI boot server */
#define VEND_PXE_SERV_ESMPRO 4 /* NEC ESMPRO boot server */
#define VEND_PXE_SERV_WSOD 5 /* IBM WSoD boot server */
#define VEND_PXE_SERV_LCCM 6 /* IBM LCCM boot server */
/* Discovery flags bit masks */
#define VEND_PXE_DISC_BCAST 0x01 /* Disable broadcast discovery */
#define VEND_PXE_DISC_MCAST 0x02 /* Disable multicast discovery */
#define VEND_PXE_DISC_SERVER 0x04 /* Only use PXE_SERVERS */
/*
**************************************************************************
*
* BOOTP/DHCP packet:
*/
#define BOOTP_CHADDR_SIZE 16 /* size of chaddr field */
#define BOOTP_SNAME_SIZE 64 /* size of sname field */
#define BOOTP_FILE_SIZE 128 /* size of filename field */
#define BOOTP_VENDOR_SIZE 312 /* size of vendor area */
#define BOOTP_EXT_SIZE 2048 /* max size of tag extensions */
#define BOOTP_MIN_SIZE 240 /* min size of BOOTP record */
struct bootp {
unsigned char bp_op; /* BOOTP op code */
unsigned char bp_hwtype; /* hardware type */
unsigned char bp_hlen; /* length of hardware address */
unsigned char bp_hops; /* hop-number, only used by gw */
unsigned long bp_xid; /* transaction ID */
unsigned short bp_secs; /* time since client booted */
unsigned short bp_unused; /* unused */
t_ipaddr bp_ciaddr; /* client IP address */
t_ipaddr bp_yiaddr; /* your (client) IP address */
t_ipaddr bp_siaddr; /* server IP address */
t_ipaddr bp_giaddr; /* BOOTP gateway IP address */
/* client hardware address */
unsigned char bp_chaddr[BOOTP_CHADDR_SIZE];
/* server host name */
unsigned char bp_sname[BOOTP_SNAME_SIZE];
/* boot file name */
unsigned char bp_file[BOOTP_FILE_SIZE];
/* optional vendor information */
unsigned char bp_vend[BOOTP_VENDOR_SIZE];
};
/* BOOTP/DHCP packet types */
#define BOOTP_DISCOVER (GEN_PACKET_DHCP_DISCOVER - 1)
#define BOOTP_ACK (GEN_PACKET_DHCP_ACK - 1)
#define BOOTP_REPLY (GEN_PACKET_BINL_REPLY - 1)
#define BOOTP_PACKET_NUM 3
/* BOOTP/DHCP buffer pointers and sizes */
extern struct bootp *bootp_bufs[BOOTP_PACKET_NUM]; /* BOOTP buffer ptrs */
extern unsigned int bootp_sizes[BOOTP_PACKET_NUM]; /* BOOTP buffer sizes */
extern int cur_bootp_buf; /* ID of current buf */
/*
**************************************************************************
*
* TFTP global variables
*/
extern unsigned char *tftpbuf; /* TFTP receive buffer */
extern unsigned int tftpbuflen; /* number of bytes */
extern unsigned int tftpbufsize; /* size of buffer */
extern unsigned long filesize; /* size of file to read */
extern unsigned long srvrtout; /* server timeout */
extern int tftpoflag; /* open flag */
/*
**************************************************************************
*
* Public routines of the internet protocols library:
*/
/* Get a BOOTP record from server */
extern int bootp __P((void));
/* Get a vendor tag from a BOOTP record */
extern unsigned char *get_vend __P((int id));
/* Open a TFTP read connection */
extern int tftp_open __P((t_ipaddr server, t_ipaddr gateway,
unsigned char *fname, int fnamlen));
/* Get next block */
extern int tftp_get __P((void));
/* Close a TFTP connection */
extern int tftp_close __P((void));
/* Read a file via TFTP */
extern int tftp_read_file __P((t_tftp_read_file *params));
/* Initialize domain name resolver */
extern void res_config __P((void));
/* Resolve a host name */
extern t_ipaddr resolve __P((char *name));
#endif /* _USE_ASSEMBLER */
#endif /* _KERNEL_ARPA_H */
syntax highlighted by Code2HTML, v. 0.9.1