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) 2000 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_NETWORK_H 28*0Sstevel@tonic-gate #define _DHCP_NETWORK_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 <sys/param.h> 34*0Sstevel@tonic-gate #include <netinet/in.h> 35*0Sstevel@tonic-gate #include <dhcp_svc_public.h> 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate /* 38*0Sstevel@tonic-gate * Implementation-specific data structures for the files dhcp_network 39*0Sstevel@tonic-gate * container. These structures are subject to change at any time. 40*0Sstevel@tonic-gate */ 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate #ifdef __cplusplus 43*0Sstevel@tonic-gate extern "C" { 44*0Sstevel@tonic-gate #endif 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate /* 47*0Sstevel@tonic-gate * Per-record state describing the underlying record, including its 48*0Sstevel@tonic-gate * position on-disk. 49*0Sstevel@tonic-gate */ 50*0Sstevel@tonic-gate typedef struct dn_recpos { 51*0Sstevel@tonic-gate dn_rec_t dnp_rec; /* traditional record */ 52*0Sstevel@tonic-gate size_t dnp_size; /* its size in the file */ 53*0Sstevel@tonic-gate off_t dnp_off; /* its starting offset in the file */ 54*0Sstevel@tonic-gate } dn_recpos_t; 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate /* 57*0Sstevel@tonic-gate * Per-record state for the underlying on-disk record representation. Note 58*0Sstevel@tonic-gate * that `dnf_cid' is twice its usual maximum length (plus room for a NUL 59*0Sstevel@tonic-gate * byte) since it doubles in size when converted to ASCII; `dnf_macro' and 60*0Sstevel@tonic-gate * `dnf_comment' are twice their usual maximum length in case we need to 61*0Sstevel@tonic-gate * escape every character in them. 62*0Sstevel@tonic-gate */ 63*0Sstevel@tonic-gate typedef struct dn_filerec { 64*0Sstevel@tonic-gate char dnf_cip[INET_ADDRSTRLEN]; 65*0Sstevel@tonic-gate char dnf_cid[DN_MAX_CID_LEN * 2 + 1]; 66*0Sstevel@tonic-gate uint16_t dnf_flags; 67*0Sstevel@tonic-gate char dnf_sip[INET_ADDRSTRLEN]; 68*0Sstevel@tonic-gate uint32_t dnf_lease; 69*0Sstevel@tonic-gate uint64_t dnf_sig; 70*0Sstevel@tonic-gate char dnf_macro[DSVC_MAX_MACSYM_LEN * 2 + 1]; 71*0Sstevel@tonic-gate char dnf_comment[DN_MAX_COMMENT_LEN * 2 + 1]; 72*0Sstevel@tonic-gate } dn_filerec_t; 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate /* 75*0Sstevel@tonic-gate * Per-instance state for each instance of an open_dn() 76*0Sstevel@tonic-gate */ 77*0Sstevel@tonic-gate typedef struct dn_handle { 78*0Sstevel@tonic-gate unsigned int dh_oflags; /* flags passed into open_dn() */ 79*0Sstevel@tonic-gate char dh_location[MAXPATHLEN]; 80*0Sstevel@tonic-gate ipaddr_t dh_net; 81*0Sstevel@tonic-gate } dn_handle_t; 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate /* 84*0Sstevel@tonic-gate * Order of the fields in the on-disk record. 85*0Sstevel@tonic-gate */ 86*0Sstevel@tonic-gate enum { DNF_CIP, DNF_CID, DNF_FLAGS, DNF_SIP, DNF_LEASE, DNF_SIG, DNF_MACRO, 87*0Sstevel@tonic-gate DNF_COMMENT }; 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate #define DNF_FIELDS 8 /* number of fields per record */ 90*0Sstevel@tonic-gate #define DNF_COMMENT_CHAR '#' 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate /* 93*0Sstevel@tonic-gate * Constants for use with find_dn() 94*0Sstevel@tonic-gate */ 95*0Sstevel@tonic-gate #define FIND_PARTIAL 0x0001 /* allow partial success */ 96*0Sstevel@tonic-gate #define FIND_POSITION 0x0002 /* return dn_recpos_t's */ 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate #ifdef __cplusplus 99*0Sstevel@tonic-gate } 100*0Sstevel@tonic-gate #endif 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate #endif /* _DHCP_NETWORK_H */ 103