10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*3431Scarlsonj * Common Development and Distribution License (the "License"). 6*3431Scarlsonj * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*3431Scarlsonj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*3431Scarlsonj * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _DHCP_INITTAB_H 270Sstevel@tonic-gate #define _DHCP_INITTAB_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #include <sys/types.h> 320Sstevel@tonic-gate #include <dhcp_symbol.h> 330Sstevel@tonic-gate #include <limits.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* 360Sstevel@tonic-gate * dhcp_inittab.[ch] make up the interface to the inittab file, which 370Sstevel@tonic-gate * is a table of all known DHCP options. please see `README.inittab' 380Sstevel@tonic-gate * for more background on the inittab api, and dhcp_inittab.c for details 390Sstevel@tonic-gate * on how to use the exported functions. 400Sstevel@tonic-gate */ 410Sstevel@tonic-gate 420Sstevel@tonic-gate #ifdef __cplusplus 430Sstevel@tonic-gate extern "C" { 440Sstevel@tonic-gate #endif 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * On-disk inittab attributes and limits. 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate #define ITAB_INITTAB_PATH "/etc/dhcp/inittab" 50*3431Scarlsonj #define ITAB_INITTAB6_PATH "/etc/dhcp/inittab6" 510Sstevel@tonic-gate #define ITAB_MAX_LINE_LEN 8192 /* bytes */ 520Sstevel@tonic-gate #define ITAB_MAX_NUMBER_LEN 30 /* digits */ 530Sstevel@tonic-gate #define ITAB_COMMENT_CHAR '#' 540Sstevel@tonic-gate #define ITAB_CODE_MAX UCHAR_MAX /* for now */ 550Sstevel@tonic-gate #define ITAB_GRAN_MAX UCHAR_MAX 560Sstevel@tonic-gate #define ITAB_MAX_MAX UCHAR_MAX 570Sstevel@tonic-gate 580Sstevel@tonic-gate /* 590Sstevel@tonic-gate * Return values from the inittab API. 600Sstevel@tonic-gate */ 610Sstevel@tonic-gate #define ITAB_FAILURE 0 620Sstevel@tonic-gate #define ITAB_SUCCESS 1 630Sstevel@tonic-gate #define ITAB_UNKNOWN 2 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * Categories to pass to inittab functions; note that these may be 670Sstevel@tonic-gate * bitwise-OR'd to request more than one. Note that these should 680Sstevel@tonic-gate * not be used otherwise. 690Sstevel@tonic-gate */ 700Sstevel@tonic-gate #define ITAB_CAT_STANDARD 0x01 710Sstevel@tonic-gate #define ITAB_CAT_FIELD 0x02 720Sstevel@tonic-gate #define ITAB_CAT_INTERNAL 0x04 730Sstevel@tonic-gate #define ITAB_CAT_VENDOR 0x08 740Sstevel@tonic-gate #define ITAB_CAT_SITE 0x10 75*3431Scarlsonj #define ITAB_CAT_V6 0x20 76*3431Scarlsonj #define ITAB_CAT_COUNT 6 770Sstevel@tonic-gate 780Sstevel@tonic-gate /* 790Sstevel@tonic-gate * Consumer which is using the inittab functions. 800Sstevel@tonic-gate */ 810Sstevel@tonic-gate #define ITAB_CONS_INFO 'i' 820Sstevel@tonic-gate #define ITAB_CONS_SERVER 'd' 830Sstevel@tonic-gate #define ITAB_CONS_SNOOP 's' 840Sstevel@tonic-gate #define ITAB_CONS_MANAGER 'm' 850Sstevel@tonic-gate #define ITAB_CONS_COUNT (sizeof ("idsm") - 1) 860Sstevel@tonic-gate 870Sstevel@tonic-gate /* 880Sstevel@tonic-gate * Extended error codes, for use with inittab_{en,de}code_e(). 890Sstevel@tonic-gate */ 900Sstevel@tonic-gate #define ITAB_SYNTAX_ERROR (-1) 910Sstevel@tonic-gate #define ITAB_BAD_IPADDR (-2) 920Sstevel@tonic-gate #define ITAB_BAD_STRING (-3) 930Sstevel@tonic-gate #define ITAB_BAD_OCTET (-4) 940Sstevel@tonic-gate #define ITAB_BAD_NUMBER (-5) 950Sstevel@tonic-gate #define ITAB_BAD_BOOLEAN (-6) 960Sstevel@tonic-gate #define ITAB_NOT_ENOUGH_IP (-7) 970Sstevel@tonic-gate #define ITAB_BAD_GRAN (-8) 980Sstevel@tonic-gate #define ITAB_NOMEM (-9) 990Sstevel@tonic-gate 100*3431Scarlsonj extern uint8_t inittab_type_to_size(const dhcp_symbol_t *); 101*3431Scarlsonj extern int inittab_verify(const dhcp_symbol_t *, dhcp_symbol_t *); 1020Sstevel@tonic-gate extern dhcp_symbol_t *inittab_load(uchar_t, char, size_t *); 1030Sstevel@tonic-gate extern dhcp_symbol_t *inittab_getbyname(uchar_t, char, const char *); 1040Sstevel@tonic-gate extern dhcp_symbol_t *inittab_getbycode(uchar_t, char, uint16_t); 105*3431Scarlsonj extern uchar_t *inittab_encode(const dhcp_symbol_t *, const char *, 1060Sstevel@tonic-gate uint16_t *, boolean_t); 107*3431Scarlsonj extern uchar_t *inittab_encode_e(const dhcp_symbol_t *, const char *, 1080Sstevel@tonic-gate uint16_t *, boolean_t, int *); 109*3431Scarlsonj extern char *inittab_decode(const dhcp_symbol_t *, const uchar_t *, 1100Sstevel@tonic-gate uint16_t, boolean_t); 111*3431Scarlsonj extern char *inittab_decode_e(const dhcp_symbol_t *, 112*3431Scarlsonj const uchar_t *, uint16_t, boolean_t, int *); 113*3431Scarlsonj 1140Sstevel@tonic-gate #ifdef __cplusplus 1150Sstevel@tonic-gate } 1160Sstevel@tonic-gate #endif 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate #endif /* _DHCP_INITTAB_H */ 119