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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 1998-1999 by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #ifndef _DD_OPT_H 28 #define _DD_OPT_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/types.h> 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 /* The different data types of options supported by the service */ 39 enum option_type { 40 ERROR_OPTION = -1, 41 ASCII_OPTION, 42 BOOLEAN_OPTION, 43 IP_OPTION, 44 NUMBER_OPTION, 45 OCTET_OPTION 46 }; 47 48 /* Structure returned by dd_getopt */ 49 struct dhcp_option { 50 int error_code; /* Error indication; 0 == no error */ 51 union { 52 char *msg; /* Error message if error_code != 0 */ 53 struct { 54 enum option_type datatype; /* Type of option */ 55 ushort_t granularity; /* How big is it */ 56 ushort_t count; /* How many */ 57 union { /* The data, depending on datatype */ 58 char **strings; 59 boolean_t value; 60 struct in_addr **addrs; 61 int64_t *numbers; 62 uchar_t **octets; 63 } data; 64 } ret; 65 } u; 66 }; 67 68 extern struct dhcp_option *dd_getopt(ushort_t, const char *, const char *); 69 extern void dd_freeopt(struct dhcp_option *); 70 71 #ifdef __cplusplus 72 } 73 #endif 74 75 #endif /* !_DD_OPT_H */