Home | History | Annotate | Download | only in dhc
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the License).
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/CDDL.txt
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/CDDL.txt.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets [] replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 
     22 /*
     23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
     24  * Use is subject to license terms.
     25  *
     26  */
     27 
     28 #ifndef __DHCP_H
     29 #define	__DHCP_H
     30 
     31 #pragma ident	"@(#)dhcp.h	1.5	07/06/06 SMI"
     32 
     33 #ifndef ERR_SOCKET
     34 #define	ERR_SOCKET	-1
     35 #define	ERR_IOCTL	-2
     36 #define	ERR_MEM		-3
     37 #define	ERR_BIND	-4
     38 #endif
     39 
     40 struct dhcpmsg {
     41 	unsigned char op;
     42 	unsigned char htype;
     43 	unsigned char hlen;
     44 	unsigned char hops;
     45 	unsigned long xid;
     46 	unsigned short secs;
     47 	unsigned short flags;
     48 	unsigned long ciaddr;
     49 	unsigned long yiaddr;
     50 	unsigned long siaddr;
     51 	unsigned long giaddr;
     52 	unsigned char chaddr[16];
     53 	unsigned char sname[64];
     54 	unsigned char file[128];
     55 	unsigned char options[1236]; /* 312 default. we put 1236 to be 1472 */
     56 	} dhcpmsg;
     57 
     58 extern int iDHCPStart(struct in_addr *padd, int raw, int reuse);
     59 extern void vDHCPBuildDiscover(struct dhcpmsg *pdhcpm,
     60 				unsigned char *macaddr, char *clase);
     61 
     62 /* DHCP option and value (cf. RFC1533) */
     63 enum
     64 {
     65 	padOption			=	0,
     66 	subnetMask			=	1,
     67 	timerOffset			=	2,
     68 	routersOnSubnet			=	3,
     69 	timeServer			=	4,
     70 	nameServer			=	5,
     71 	dns				=	6,
     72 	logServer			=	7,
     73 	cookieServer			=	8,
     74 	lprServer			=	9,
     75 	impressServer			=	10,
     76 	resourceLocationServer		=	11,
     77 	hostName			=	12,
     78 	bootFileSize			=	13,
     79 	meritDumpFile			=	14,
     80 	domainName			=	15,
     81 	swapServer			=	16,
     82 	rootPath			=	17,
     83 	extentionsPath			=	18,
     84 	IPforwarding			=	19,
     85 	nonLocalSourceRouting		=	20,
     86 	policyFilter			=	21,
     87 	maxDgramReasmSize		=	22,
     88 	defaultIPTTL			=	23,
     89 	pathMTUagingTimeout		=	24,
     90 	pathMTUplateauTable		=	25,
     91 	ifMTU				=	26,
     92 	allSubnetsLocal			=	27,
     93 	broadcastAddr			=	28,
     94 	performMaskDiscovery		=	29,
     95 	maskSupplier			=	30,
     96 	performRouterDiscovery		=	31,
     97 	routerSolicitationAddr		=	32,
     98 	staticRoute			=	33,
     99 	trailerEncapsulation		=	34,
    100 	arpCacheTimeout			=	35,
    101 	ethernetEncapsulation		=	36,
    102 	tcpDefaultTTL			=	37,
    103 	tcpKeepaliveInterval		=	38,
    104 	tcpKeepaliveGarbage		=	39,
    105 	nisDomainName			=	40,
    106 	nisServers			=	41,
    107 	ntpServers			=	42,
    108 	vendorSpecificInfo		=	43,
    109 	netBIOSnameServer		=	44,
    110 	netBIOSdgramDistServer		=	45,
    111 	netBIOSnodeType			=	46,
    112 	netBIOSscope			=	47,
    113 	xFontServer			=	48,
    114 	xDisplayManager			=	49,
    115 	dhcpRequestedIPaddr		=	50,
    116 	dhcpIPaddrLeaseTime		=	51,
    117 	dhcpOptionOverload		=	52,
    118 	dhcpMessageType			=	53,
    119 	dhcpServerIdentifier		=	54,
    120 	dhcpParamRequest		=	55,
    121 	dhcpMsg				=	56,
    122 	dhcpMaxMsgSize			=	57,
    123 	dhcpT1value			=	58,
    124 	dhcpT2value			=	59,
    125 	dhcpClassIdentifier		=	60,
    126 	dhcpClientIdentifier		=	61,
    127 	endOption			=	255
    128 };
    129 
    130 #endif /* __DHCP_H */
    131