2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _DHCP_INITTAB_H
2N/A#define _DHCP_INITTAB_H
2N/A
2N/A#include <sys/types.h>
2N/A#include <dhcp_symbol.h>
2N/A#include <limits.h>
2N/A
2N/A/*
2N/A * dhcp_inittab.[ch] make up the interface to the inittab file, which
2N/A * is a table of all known DHCP options. please see `README.inittab'
2N/A * for more background on the inittab api, and dhcp_inittab.c for details
2N/A * on how to use the exported functions.
2N/A */
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * On-disk inittab attributes and limits.
2N/A */
2N/A#define ITAB_INITTAB_PATH "/etc/dhcp/inittab"
2N/A#define ITAB_INITTAB6_PATH "/etc/dhcp/inittab6"
2N/A#define ITAB_MAX_LINE_LEN 8192 /* bytes */
2N/A#define ITAB_MAX_NUMBER_LEN 30 /* digits */
2N/A#define ITAB_COMMENT_CHAR '#'
2N/A#define ITAB_CODE_MAX UCHAR_MAX /* for now */
2N/A#define ITAB_GRAN_MAX UCHAR_MAX
2N/A#define ITAB_MAX_MAX UCHAR_MAX
2N/A
2N/A/*
2N/A * Return values from the inittab API.
2N/A */
2N/A#define ITAB_FAILURE 0
2N/A#define ITAB_SUCCESS 1
2N/A#define ITAB_UNKNOWN 2
2N/A
2N/A/*
2N/A * Categories to pass to inittab functions; note that these may be
2N/A * bitwise-OR'd to request more than one. Note that these should
2N/A * not be used otherwise.
2N/A */
2N/A#define ITAB_CAT_STANDARD 0x01
2N/A#define ITAB_CAT_FIELD 0x02
2N/A#define ITAB_CAT_INTERNAL 0x04
2N/A#define ITAB_CAT_VENDOR 0x08
2N/A#define ITAB_CAT_SITE 0x10
2N/A#define ITAB_CAT_V6 0x20
2N/A
2N/A/*
2N/A * Consumer which is using the inittab functions.
2N/A */
2N/A#define ITAB_CONS_INFO 'i'
2N/A#define ITAB_CONS_SERVER 'd'
2N/A#define ITAB_CONS_SNOOP 's'
2N/A#define ITAB_CONS_MANAGER 'm'
2N/A#define ITAB_CONS_COUNT (sizeof ("idsm") - 1)
2N/A
2N/A/*
2N/A * Extended error codes, for use with inittab_{en,de}code_e().
2N/A */
2N/A#define ITAB_SYNTAX_ERROR (-1)
2N/A#define ITAB_BAD_IPADDR (-2)
2N/A#define ITAB_BAD_STRING (-3)
2N/A#define ITAB_BAD_OCTET (-4)
2N/A#define ITAB_BAD_NUMBER (-5)
2N/A#define ITAB_BAD_BOOLEAN (-6)
2N/A#define ITAB_NOT_ENOUGH_IP (-7)
2N/A#define ITAB_BAD_GRAN (-8)
2N/A#define ITAB_NOMEM (-9)
2N/A
2N/Aextern uint8_t inittab_type_to_size(const dhcp_symbol_t *);
2N/Aextern int inittab_verify(const dhcp_symbol_t *, dhcp_symbol_t *);
2N/Aextern dhcp_symbol_t *inittab_load(uchar_t, char, size_t *);
2N/Aextern dhcp_symbol_t *inittab_getbyname(uchar_t, char, const char *);
2N/Aextern dhcp_symbol_t *inittab_getbycode(uchar_t, char, uint16_t);
2N/Aextern uchar_t *inittab_encode(const dhcp_symbol_t *, const char *,
2N/A uint16_t *, boolean_t);
2N/Aextern uchar_t *inittab_encode_e(const dhcp_symbol_t *, const char *,
2N/A uint16_t *, boolean_t, int *);
2N/Aextern char *inittab_decode(const dhcp_symbol_t *, const uchar_t *,
2N/A uint16_t, boolean_t);
2N/Aextern char *inittab_decode_e(const dhcp_symbol_t *,
2N/A const uchar_t *, uint16_t, boolean_t, int *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _DHCP_INITTAB_H */