1/* bootp/dhcp defines */ 2#ifndef SLIRP_BOOTP_H 3#define SLIRP_BOOTP_H 1 4 5#define BOOTP_SERVER 67 6#define BOOTP_CLIENT 68 7 8#define BOOTP_REQUEST 1 9#define BOOTP_REPLY 2 10 11#define RFC1533_COOKIE 99, 130, 83, 99 12#define RFC1533_PAD 0 13#define RFC1533_NETMASK 1 14#define RFC1533_TIMEOFFSET 2 15#define RFC1533_GATEWAY 3 16#define RFC1533_TIMESERVER 4 17#define RFC1533_IEN116NS 5 18#define RFC1533_DNS 6 19#define RFC1533_LOGSERVER 7 20#define RFC1533_COOKIESERVER 8 21#define RFC1533_LPRSERVER 9 22#define RFC1533_IMPRESSSERVER 10 23#define RFC1533_RESOURCESERVER 11 24#define RFC1533_HOSTNAME 12 25#define RFC1533_BOOTFILESIZE 13 26#define RFC1533_MERITDUMPFILE 14 27#define RFC1533_DOMAINNAME 15 28#define RFC1533_SWAPSERVER 16 29#define RFC1533_ROOTPATH 17 30#define RFC1533_EXTENSIONPATH 18 31#define RFC1533_IPFORWARDING 19 32#define RFC1533_IPSOURCEROUTING 20 33#define RFC1533_IPPOLICYFILTER 21 34#define RFC1533_IPMAXREASSEMBLY 22 35#define RFC1533_IPTTL 23 36#define RFC1533_IPMTU 24 37#define RFC1533_IPMTUPLATEAU 25 38#define RFC1533_INTMTU 26 39#define RFC1533_INTLOCALSUBNETS 27 40#define RFC1533_INTBROADCAST 28 41#define RFC1533_INTICMPDISCOVER 29 42#define RFC1533_INTICMPRESPOND 30 43#define RFC1533_INTROUTEDISCOVER 31 44#define RFC1533_INTROUTESOLICIT 32 45#define RFC1533_INTSTATICROUTES 33 46#define RFC1533_LLTRAILERENCAP 34 47#define RFC1533_LLARPCACHETMO 35 48#define RFC1533_LLETHERNETENCAP 36 49#define RFC1533_TCPTTL 37 50#define RFC1533_TCPKEEPALIVETMO 38 51#define RFC1533_TCPKEEPALIVEGB 39 52#define RFC1533_NISDOMAIN 40 53#define RFC1533_NISSERVER 41 54#define RFC1533_NTPSERVER 42 55#define RFC1533_VENDOR 43 56#define RFC1533_NBNS 44 57#define RFC1533_NBDD 45 58#define RFC1533_NBNT 46 59#define RFC1533_NBSCOPE 47 60#define RFC1533_XFS 48 61#define RFC1533_XDM 49 62 63#define RFC2132_REQ_ADDR 50 64#define RFC2132_LEASE_TIME 51 65#define RFC2132_MSG_TYPE 53 66#define RFC2132_SRV_ID 54 67#define RFC2132_PARAM_LIST 55 68#define RFC2132_MESSAGE 56 69#define RFC2132_MAX_SIZE 57 70#define RFC2132_RENEWAL_TIME 58 71#define RFC2132_REBIND_TIME 59 72 73#define DHCPDISCOVER 1 74#define DHCPOFFER 2 75#define DHCPREQUEST 3 76#define DHCPACK 5 77#define DHCPNAK 6 78 79#define RFC1533_VENDOR_MAJOR 0 80#define RFC1533_VENDOR_MINOR 0 81 82#define RFC1533_VENDOR_MAGIC 128 83#define RFC1533_VENDOR_ADDPARM 129 84#define RFC1533_VENDOR_ETHDEV 130 85#define RFC1533_VENDOR_HOWTO 132 86#define RFC1533_VENDOR_MNUOPTS 160 87#define RFC1533_VENDOR_SELECTION 176 88#define RFC1533_VENDOR_MOTD 184 89#define RFC1533_VENDOR_NUMOFMOTD 8 90#define RFC1533_VENDOR_IMG 192 91#define RFC1533_VENDOR_NUMOFIMG 16 92 93#define RFC1533_END 255 94#define BOOTP_VENDOR_LEN 64 95#define DHCP_OPT_LEN 312 96 97struct bootp_t { 98 struct ip ip; 99 struct udphdr udp; 100 uint8_t bp_op; 101 uint8_t bp_htype; 102 uint8_t bp_hlen; 103 uint8_t bp_hops; 104 uint32_t bp_xid; 105 uint16_t bp_secs; 106 uint16_t unused; 107 struct in_addr bp_ciaddr; 108 struct in_addr bp_yiaddr; 109 struct in_addr bp_siaddr; 110 struct in_addr bp_giaddr; 111 uint8_t bp_hwaddr[16]; 112 uint8_t bp_sname[64]; 113 uint8_t bp_file[128]; 114 uint8_t bp_vend[DHCP_OPT_LEN]; 115}; 116 117typedef struct { 118 uint16_t allocated; 119 uint8_t macaddr[6]; 120} BOOTPClient; 121 122#define NB_BOOTP_CLIENTS 16 123 124void bootp_input(struct mbuf *m); 125 126#endif 127