1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 1999-2001 by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _DHCP_INITTAB_H 28*0Sstevel@tonic-gate #define _DHCP_INITTAB_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <sys/types.h> 33*0Sstevel@tonic-gate #include <dhcp_symbol.h> 34*0Sstevel@tonic-gate #include <limits.h> 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate /* 37*0Sstevel@tonic-gate * dhcp_inittab.[ch] make up the interface to the inittab file, which 38*0Sstevel@tonic-gate * is a table of all known DHCP options. please see `README.inittab' 39*0Sstevel@tonic-gate * for more background on the inittab api, and dhcp_inittab.c for details 40*0Sstevel@tonic-gate * on how to use the exported functions. 41*0Sstevel@tonic-gate */ 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate #ifdef __cplusplus 44*0Sstevel@tonic-gate extern "C" { 45*0Sstevel@tonic-gate #endif 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate /* 48*0Sstevel@tonic-gate * On-disk inittab attributes and limits. 49*0Sstevel@tonic-gate */ 50*0Sstevel@tonic-gate #define ITAB_INITTAB_PATH "/etc/dhcp/inittab" 51*0Sstevel@tonic-gate #define ITAB_MAX_LINE_LEN 8192 /* bytes */ 52*0Sstevel@tonic-gate #define ITAB_MAX_NUMBER_LEN 30 /* digits */ 53*0Sstevel@tonic-gate #define ITAB_COMMENT_CHAR '#' 54*0Sstevel@tonic-gate #define ITAB_CODE_MAX UCHAR_MAX /* for now */ 55*0Sstevel@tonic-gate #define ITAB_GRAN_MAX UCHAR_MAX 56*0Sstevel@tonic-gate #define ITAB_MAX_MAX UCHAR_MAX 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate /* 59*0Sstevel@tonic-gate * Return values from the inittab API. 60*0Sstevel@tonic-gate */ 61*0Sstevel@tonic-gate #define ITAB_FAILURE 0 62*0Sstevel@tonic-gate #define ITAB_SUCCESS 1 63*0Sstevel@tonic-gate #define ITAB_UNKNOWN 2 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate /* 66*0Sstevel@tonic-gate * Categories to pass to inittab functions; note that these may be 67*0Sstevel@tonic-gate * bitwise-OR'd to request more than one. Note that these should 68*0Sstevel@tonic-gate * not be used otherwise. 69*0Sstevel@tonic-gate */ 70*0Sstevel@tonic-gate #define ITAB_CAT_STANDARD 0x01 71*0Sstevel@tonic-gate #define ITAB_CAT_FIELD 0x02 72*0Sstevel@tonic-gate #define ITAB_CAT_INTERNAL 0x04 73*0Sstevel@tonic-gate #define ITAB_CAT_VENDOR 0x08 74*0Sstevel@tonic-gate #define ITAB_CAT_SITE 0x10 75*0Sstevel@tonic-gate #define ITAB_CAT_COUNT 5 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate /* 78*0Sstevel@tonic-gate * Consumer which is using the inittab functions. 79*0Sstevel@tonic-gate */ 80*0Sstevel@tonic-gate #define ITAB_CONS_INFO 'i' 81*0Sstevel@tonic-gate #define ITAB_CONS_SERVER 'd' 82*0Sstevel@tonic-gate #define ITAB_CONS_SNOOP 's' 83*0Sstevel@tonic-gate #define ITAB_CONS_MANAGER 'm' 84*0Sstevel@tonic-gate #define ITAB_CONS_COUNT (sizeof ("idsm") - 1) 85*0Sstevel@tonic-gate 86*0Sstevel@tonic-gate /* 87*0Sstevel@tonic-gate * Extended error codes, for use with inittab_{en,de}code_e(). 88*0Sstevel@tonic-gate */ 89*0Sstevel@tonic-gate #define ITAB_SYNTAX_ERROR (-1) 90*0Sstevel@tonic-gate #define ITAB_BAD_IPADDR (-2) 91*0Sstevel@tonic-gate #define ITAB_BAD_STRING (-3) 92*0Sstevel@tonic-gate #define ITAB_BAD_OCTET (-4) 93*0Sstevel@tonic-gate #define ITAB_BAD_NUMBER (-5) 94*0Sstevel@tonic-gate #define ITAB_BAD_BOOLEAN (-6) 95*0Sstevel@tonic-gate #define ITAB_NOT_ENOUGH_IP (-7) 96*0Sstevel@tonic-gate #define ITAB_BAD_GRAN (-8) 97*0Sstevel@tonic-gate #define ITAB_NOMEM (-9) 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate extern uint8_t inittab_type_to_size(dhcp_symbol_t *); 100*0Sstevel@tonic-gate extern int inittab_verify(dhcp_symbol_t *, dhcp_symbol_t *); 101*0Sstevel@tonic-gate extern dhcp_symbol_t *inittab_load(uchar_t, char, size_t *); 102*0Sstevel@tonic-gate extern dhcp_symbol_t *inittab_getbyname(uchar_t, char, const char *); 103*0Sstevel@tonic-gate extern dhcp_symbol_t *inittab_getbycode(uchar_t, char, uint16_t); 104*0Sstevel@tonic-gate extern uchar_t *inittab_encode(dhcp_symbol_t *, const char *, 105*0Sstevel@tonic-gate uint16_t *, boolean_t); 106*0Sstevel@tonic-gate extern uchar_t *inittab_encode_e(dhcp_symbol_t *, const char *, 107*0Sstevel@tonic-gate uint16_t *, boolean_t, int *); 108*0Sstevel@tonic-gate extern char *inittab_decode(dhcp_symbol_t *, uchar_t *, 109*0Sstevel@tonic-gate uint16_t, boolean_t); 110*0Sstevel@tonic-gate extern char *inittab_decode_e(dhcp_symbol_t *, uchar_t *, 111*0Sstevel@tonic-gate uint16_t, boolean_t, int *); 112*0Sstevel@tonic-gate 113*0Sstevel@tonic-gate #ifdef __cplusplus 114*0Sstevel@tonic-gate } 115*0Sstevel@tonic-gate #endif 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate #endif /* _DHCP_INITTAB_H */ 118