1*4a5d661aSToomas Soome /* $NetBSD: bootp.h,v 1.4 1997/09/06 13:55:57 drochner Exp $ */ 2*4a5d661aSToomas Soome 3*4a5d661aSToomas Soome /* 4*4a5d661aSToomas Soome * Bootstrap Protocol (BOOTP). RFC951 and RFC1048. 5*4a5d661aSToomas Soome * 6*4a5d661aSToomas Soome * This file specifies the "implementation-independent" BOOTP protocol 7*4a5d661aSToomas Soome * information which is common to both client and server. 8*4a5d661aSToomas Soome * 9*4a5d661aSToomas Soome * Copyright 1988 by Carnegie Mellon. 10*4a5d661aSToomas Soome * 11*4a5d661aSToomas Soome * Permission to use, copy, modify, and distribute this program for any 12*4a5d661aSToomas Soome * purpose and without fee is hereby granted, provided that this copyright 13*4a5d661aSToomas Soome * and permission notice appear on all copies and supporting documentation, 14*4a5d661aSToomas Soome * the name of Carnegie Mellon not be used in advertising or publicity 15*4a5d661aSToomas Soome * pertaining to distribution of the program without specific prior 16*4a5d661aSToomas Soome * permission, and notice be given in supporting documentation that copying 17*4a5d661aSToomas Soome * and distribution is by permission of Carnegie Mellon and Stanford 18*4a5d661aSToomas Soome * University. Carnegie Mellon makes no representations about the 19*4a5d661aSToomas Soome * suitability of this software for any purpose. It is provided "as is" 20*4a5d661aSToomas Soome * without express or implied warranty. 21*4a5d661aSToomas Soome * 22*4a5d661aSToomas Soome * $FreeBSD$ 23*4a5d661aSToomas Soome */ 24*4a5d661aSToomas Soome 25*4a5d661aSToomas Soome 26*4a5d661aSToomas Soome struct bootp { 27*4a5d661aSToomas Soome unsigned char bp_op; /* packet opcode type */ 28*4a5d661aSToomas Soome unsigned char bp_htype; /* hardware addr type */ 29*4a5d661aSToomas Soome unsigned char bp_hlen; /* hardware addr length */ 30*4a5d661aSToomas Soome unsigned char bp_hops; /* gateway hops */ 31*4a5d661aSToomas Soome unsigned int bp_xid; /* transaction ID */ 32*4a5d661aSToomas Soome unsigned short bp_secs; /* seconds since boot began */ 33*4a5d661aSToomas Soome unsigned short bp_flags; 34*4a5d661aSToomas Soome struct in_addr bp_ciaddr; /* client IP address */ 35*4a5d661aSToomas Soome struct in_addr bp_yiaddr; /* 'your' IP address */ 36*4a5d661aSToomas Soome struct in_addr bp_siaddr; /* server IP address */ 37*4a5d661aSToomas Soome struct in_addr bp_giaddr; /* gateway IP address */ 38*4a5d661aSToomas Soome unsigned char bp_chaddr[16]; /* client hardware address */ 39*4a5d661aSToomas Soome unsigned char bp_sname[64]; /* server host name */ 40*4a5d661aSToomas Soome unsigned char bp_file[128]; /* boot file name */ 41*4a5d661aSToomas Soome #ifdef SUPPORT_DHCP 42*4a5d661aSToomas Soome #define BOOTP_VENDSIZE 312 43*4a5d661aSToomas Soome #else 44*4a5d661aSToomas Soome #define BOOTP_VENDSIZE 64 45*4a5d661aSToomas Soome #endif 46*4a5d661aSToomas Soome unsigned char bp_vend[BOOTP_VENDSIZE]; /* vendor-specific area */ 47*4a5d661aSToomas Soome }; 48*4a5d661aSToomas Soome 49*4a5d661aSToomas Soome /* 50*4a5d661aSToomas Soome * UDP port numbers, server and client. 51*4a5d661aSToomas Soome */ 52*4a5d661aSToomas Soome #define IPPORT_BOOTPS 67 53*4a5d661aSToomas Soome #define IPPORT_BOOTPC 68 54*4a5d661aSToomas Soome 55*4a5d661aSToomas Soome #define BOOTREPLY 2 56*4a5d661aSToomas Soome #define BOOTREQUEST 1 57*4a5d661aSToomas Soome 58*4a5d661aSToomas Soome 59*4a5d661aSToomas Soome /* 60*4a5d661aSToomas Soome * Vendor magic cookie (v_magic) for CMU 61*4a5d661aSToomas Soome */ 62*4a5d661aSToomas Soome #define VM_CMU "CMU" 63*4a5d661aSToomas Soome 64*4a5d661aSToomas Soome /* 65*4a5d661aSToomas Soome * Vendor magic cookie (v_magic) for RFC1048 66*4a5d661aSToomas Soome */ 67*4a5d661aSToomas Soome #define VM_RFC1048 { 99, 130, 83, 99 } 68*4a5d661aSToomas Soome 69*4a5d661aSToomas Soome 70*4a5d661aSToomas Soome 71*4a5d661aSToomas Soome /* 72*4a5d661aSToomas Soome * RFC1048 tag values used to specify what information is being supplied in 73*4a5d661aSToomas Soome * the vendor field of the packet. 74*4a5d661aSToomas Soome */ 75*4a5d661aSToomas Soome 76*4a5d661aSToomas Soome #define TAG_PAD ((unsigned char) 0) 77*4a5d661aSToomas Soome #define TAG_SUBNET_MASK ((unsigned char) 1) 78*4a5d661aSToomas Soome #define TAG_TIME_OFFSET ((unsigned char) 2) 79*4a5d661aSToomas Soome #define TAG_GATEWAY ((unsigned char) 3) 80*4a5d661aSToomas Soome #define TAG_TIME_SERVER ((unsigned char) 4) 81*4a5d661aSToomas Soome #define TAG_NAME_SERVER ((unsigned char) 5) 82*4a5d661aSToomas Soome #define TAG_DOMAIN_SERVER ((unsigned char) 6) 83*4a5d661aSToomas Soome #define TAG_LOG_SERVER ((unsigned char) 7) 84*4a5d661aSToomas Soome #define TAG_COOKIE_SERVER ((unsigned char) 8) 85*4a5d661aSToomas Soome #define TAG_LPR_SERVER ((unsigned char) 9) 86*4a5d661aSToomas Soome #define TAG_IMPRESS_SERVER ((unsigned char) 10) 87*4a5d661aSToomas Soome #define TAG_RLP_SERVER ((unsigned char) 11) 88*4a5d661aSToomas Soome #define TAG_HOSTNAME ((unsigned char) 12) 89*4a5d661aSToomas Soome #define TAG_BOOTSIZE ((unsigned char) 13) 90*4a5d661aSToomas Soome #define TAG_DUMPFILE ((unsigned char) 14) 91*4a5d661aSToomas Soome #define TAG_DOMAINNAME ((unsigned char) 15) 92*4a5d661aSToomas Soome #define TAG_SWAPSERVER ((unsigned char) 16) 93*4a5d661aSToomas Soome #define TAG_ROOTPATH ((unsigned char) 17) 94*4a5d661aSToomas Soome 95*4a5d661aSToomas Soome #ifdef SUPPORT_DHCP 96*4a5d661aSToomas Soome #define TAG_REQ_ADDR ((unsigned char) 50) 97*4a5d661aSToomas Soome #define TAG_LEASETIME ((unsigned char) 51) 98*4a5d661aSToomas Soome #define TAG_OVERLOAD ((unsigned char) 52) 99*4a5d661aSToomas Soome #define TAG_DHCP_MSGTYPE ((unsigned char) 53) 100*4a5d661aSToomas Soome #define TAG_SERVERID ((unsigned char) 54) 101*4a5d661aSToomas Soome #define TAG_PARAM_REQ ((unsigned char) 55) 102*4a5d661aSToomas Soome #define TAG_MSG ((unsigned char) 56) 103*4a5d661aSToomas Soome #define TAG_MAXSIZE ((unsigned char) 57) 104*4a5d661aSToomas Soome #define TAG_T1 ((unsigned char) 58) 105*4a5d661aSToomas Soome #define TAG_T2 ((unsigned char) 59) 106*4a5d661aSToomas Soome #define TAG_CLASSID ((unsigned char) 60) 107*4a5d661aSToomas Soome #define TAG_CLIENTID ((unsigned char) 61) 108*4a5d661aSToomas Soome #endif 109*4a5d661aSToomas Soome 110*4a5d661aSToomas Soome #define TAG_END ((unsigned char) 255) 111*4a5d661aSToomas Soome 112*4a5d661aSToomas Soome #ifdef SUPPORT_DHCP 113*4a5d661aSToomas Soome #define DHCPDISCOVER 1 114*4a5d661aSToomas Soome #define DHCPOFFER 2 115*4a5d661aSToomas Soome #define DHCPREQUEST 3 116*4a5d661aSToomas Soome #define DHCPDECLINE 4 117*4a5d661aSToomas Soome #define DHCPACK 5 118*4a5d661aSToomas Soome #define DHCPNAK 6 119*4a5d661aSToomas Soome #define DHCPRELEASE 7 120*4a5d661aSToomas Soome #endif 121*4a5d661aSToomas Soome 122*4a5d661aSToomas Soome /* 123*4a5d661aSToomas Soome * bootp flags 124*4a5d661aSToomas Soome */ 125*4a5d661aSToomas Soome #define BOOTP_NONE 0x0000 /* No flags */ 126*4a5d661aSToomas Soome #define BOOTP_PXE 0x0001 /* Booting from PXE. */ 127*4a5d661aSToomas Soome 128*4a5d661aSToomas Soome /* 129*4a5d661aSToomas Soome * "vendor" data permitted for CMU bootp clients. 130*4a5d661aSToomas Soome */ 131*4a5d661aSToomas Soome 132*4a5d661aSToomas Soome struct cmu_vend { 133*4a5d661aSToomas Soome unsigned char v_magic[4]; /* magic number */ 134*4a5d661aSToomas Soome unsigned int v_flags; /* flags/opcodes, etc. */ 135*4a5d661aSToomas Soome struct in_addr v_smask; /* Subnet mask */ 136*4a5d661aSToomas Soome struct in_addr v_dgate; /* Default gateway */ 137*4a5d661aSToomas Soome struct in_addr v_dns1, v_dns2; /* Domain name servers */ 138*4a5d661aSToomas Soome struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */ 139*4a5d661aSToomas Soome struct in_addr v_ts1, v_ts2; /* Time servers */ 140*4a5d661aSToomas Soome unsigned char v_unused[25]; /* currently unused */ 141*4a5d661aSToomas Soome }; 142*4a5d661aSToomas Soome 143*4a5d661aSToomas Soome 144*4a5d661aSToomas Soome /* v_flags values */ 145*4a5d661aSToomas Soome #define VF_SMASK 1 /* Subnet mask field contains valid data */ 146