ref: 396844787c65f42dc77f65c259dcff39eb63578b
parent: 26dc73c763de25196a60caba7f7815b13cf2f91f
author: Alex Musolino <alex@musolino.id.au>
date: Tue Jun 11 11:18:27 EDT 2019
snoopy(8): include dhcp.h instead of replicating bootp/dhcp options enum
--- a/sys/src/cmd/ip/snoopy/dhcp.c
+++ b/sys/src/cmd/ip/snoopy/dhcp.c
@@ -3,106 +3,8 @@
#include <ip.h>
#include "dat.h"
#include "protos.h"
+#include "../dhcp.h"
-enum
-{
- Maxoptlen= 312-4,
-
- /* dhcp types */
- Discover= 1,
- Offer= 2,
- Request= 3,
- Decline= 4,
- Ack= 5,
- Nak= 6,
- Release= 7,
- Inform= 8,
-
- /* bootp option types */
- OBend= 255,
- OBpad= 0,
- OBmask= 1,
- OBtimeoff= 2,
- OBrouter= 3,
- OBtimeserver= 4,
- OBnameserver= 5,
- OBdnserver= 6,
- OBlogserver= 7,
- OBcookieserver= 8,
- OBlprserver= 9,
- OBimpressserver= 10,
- OBrlserver= 11,
- OBhostname= 12, /* 0xc0 */
- OBbflen= 13,
- OBdumpfile= 14,
- OBdomainname= 15,
- OBswapserver= 16, /* 0x10 */
- OBrootpath= 17,
- OBextpath= 18,
- OBipforward= 19,
- OBnonlocal= 20,
- OBpolicyfilter= 21,
- OBmaxdatagram= 22,
- OBttl= 23,
- OBpathtimeout= 24,
- OBpathplateau= 25,
- OBmtu= 26,
- OBsubnetslocal= 27,
- OBbaddr= 28,
- OBdiscovermask= 29,
- OBsupplymask= 30,
- OBdiscoverrouter= 31,
- OBrsserver= 32, /* 0x20 */
- OBstaticroutes= 33,
- OBtrailerencap= 34,
- OBarptimeout= 35,
- OBetherencap= 36,
- OBtcpttl= 37,
- OBtcpka= 38,
- OBtcpkag= 39,
- OBnisdomain= 40,
- OBniserver= 41,
- OBntpserver= 42,
- OBvendorinfo= 43, /* 0x2b */
- OBnetbiosns= 44,
- OBnetbiosdds= 45,
- OBnetbiostype= 46,
- OBnetbiosscope= 47,
- OBxfontserver= 48, /* 0x30 */
- OBxdispmanager= 49,
- OBnisplusdomain= 64, /* 0x40 */
- OBnisplusserver= 65,
- OBhomeagent= 68,
- OBsmtpserver= 69,
- OBpop3server= 70,
- OBnntpserver= 71,
- OBwwwserver= 72,
- OBfingerserver= 73,
- OBircserver= 74,
- OBstserver= 75,
- OBstdaserver= 76,
-
- /* dhcp options */
- ODipaddr= 50, /* 0x32 */
- ODlease= 51,
- ODoverload= 52,
- ODtype= 53, /* 0x35 */
- ODserverid= 54, /* 0x36 */
- ODparams= 55, /* 0x37 */
- ODmessage= 56,
- ODmaxmsg= 57,
- ODrenewaltime= 58,
- ODrebindingtime= 59,
- ODvendorclass= 60,
- ODclientid= 61, /* 0x3d */
- ODtftpserver= 66,
- ODbootfile= 67,
-
- /* plan9 vendor info options */
- OP9fsv4= 128, /* plan9 file servers */
- OP9authv4= 129, /* plan9 auth servers */
-};
-
/*
* convert a byte array to hex
*/
@@ -305,8 +207,8 @@
case OBdomainname:
p = pstring(p, e, "domname", o, n);
break;
- case OBswapserver:
- p = pserver(p, e, "swapsrv", o, n);
+ case OBrootserver:
+ p = pserver(p, e, "rootsrv", o, n);
break;
case OBrootpath:
p = pstring(p, e, "rootpath", o, n);