xref: /onnv-gate/usr/src/cmd/tsol/tnd/tnd.h (revision 4746:0bc0c48f4304)
1*4746Srica /*
2*4746Srica  * CDDL HEADER START
3*4746Srica  *
4*4746Srica  * The contents of this file are subject to the terms of the
5*4746Srica  * Common Development and Distribution License (the "License").
6*4746Srica  * You may not use this file except in compliance with the License.
7*4746Srica  *
8*4746Srica  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*4746Srica  * or http://www.opensolaris.org/os/licensing.
10*4746Srica  * See the License for the specific language governing permissions
11*4746Srica  * and limitations under the License.
12*4746Srica  *
13*4746Srica  * When distributing Covered Code, include this CDDL HEADER in each
14*4746Srica  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*4746Srica  * If applicable, add the following below this CDDL HEADER, with the
16*4746Srica  * fields enclosed by brackets "[]" replaced with your own identifying
17*4746Srica  * information: Portions Copyright [yyyy] [name of copyright owner]
18*4746Srica  *
19*4746Srica  * CDDL HEADER END
20*4746Srica  */
21*4746Srica 
22*4746Srica /*
23*4746Srica  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*4746Srica  * Use is subject to license terms.
25*4746Srica  */
26*4746Srica 
27*4746Srica #ifndef	_TND_H_
28*4746Srica #define	_TND_H_
29*4746Srica 
30*4746Srica #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*4746Srica 
32*4746Srica #ifdef	__cplusplus
33*4746Srica extern "C" {
34*4746Srica #endif
35*4746Srica 
36*4746Srica /*
37*4746Srica  * TSOL Messages have the following header
38*4746Srica  */
39*4746Srica 
40*4746Srica typedef struct {
41*4746Srica 	uchar_t tnd_version; /* protocol version number */
42*4746Srica 	uchar_t tnd_message; /* message type. */
43*4746Srica 	uchar_t tnd_error_code; /* Error return for a reply. */
44*4746Srica } tsol_tnd_hdr_t;
45*4746Srica 
46*4746Srica /*
47*4746Srica  * TND TSOL messages
48*4746Srica  */
49*4746Srica 
50*4746Srica #define	TND_DEBUG_REQ	127
51*4746Srica #define	TND_POLL_REQ	128
52*4746Srica #define	TND_REPLY	129
53*4746Srica 
54*4746Srica /*
55*4746Srica  * TND errors
56*4746Srica  */
57*4746Srica 
58*4746Srica #define	TND_SUCCESS 1
59*4746Srica #define	TND_FAIL_LOG	2
60*4746Srica #define	TND_FAIL_DEBUG_LEVEL 4
61*4746Srica #define	TND_NOT_SUPPORTED 8
62*4746Srica #define	TND_DENIED	16
63*4746Srica 
64*4746Srica /* TND door files */
65*4746Srica #define	TND_DOORFILE	"/etc/.tnd_door"
66*4746Srica #define	TND_DOORFILE2	"/etc/.tnd_door2"
67*4746Srica 
68*4746Srica /*
69*4746Srica  * tnd request messages have the following format
70*4746Srica  */
71*4746Srica 
72*4746Srica struct tsol_tnd_msg {
73*4746Srica 	tsol_tnd_hdr_t ttm_hdr; /* message header */
74*4746Srica 	uint_t ttm_int; /* debug level or poll interval(in seconds) */
75*4746Srica };
76*4746Srica 
77*4746Srica #define	TNDLOG "/var/tsol/tndlog"
78*4746Srica #define	MAX_TND_DEBUG 2
79*4746Srica #define	DEF_TND_DEBUG 1
80*4746Srica 
81*4746Srica #define	HNAMELEN 64
82*4746Srica 
83*4746Srica /*
84*4746Srica  * polling default (seconds)
85*4746Srica  */
86*4746Srica #define	TND_DEF_POLL_TIME 1800 /* 30 minutes */
87*4746Srica 
88*4746Srica /* tnrhtp_c cache structure */
89*4746Srica struct tnd_tnrhtp_c {
90*4746Srica 	tsol_tpent_t tp_ent;
91*4746Srica 	struct tnd_tnrhtp_c *tp_next;
92*4746Srica };
93*4746Srica 
94*4746Srica /* tnrhdb_c cache structure */
95*4746Srica typedef struct tnd_tnrhdb_c {
96*4746Srica 	tsol_rhent_t	rh_ent;
97*4746Srica 	int		visited;	/* Flag to handle deletions */
98*4746Srica 	struct tnd_tnrhdb_c	*rh_next;
99*4746Srica } tnd_tnrhdb_t;
100*4746Srica 
101*4746Srica /* tnrhdb lookup table */
102*4746Srica typedef struct tnrh_tlb {
103*4746Srica 	in_addr_t	addr;
104*4746Srica 	char		template_name[TNTNAMSIZ];
105*4746Srica 	int		reload;		/* flag to reload/delete */
106*4746Srica 	int		masklen_used;	/* Which mask did we use */
107*4746Srica 	tnd_tnrhdb_t	*src;		/* Which table entry is our source */
108*4746Srica 	struct tnrh_tlb	*next;		/* Next in the hash chain */
109*4746Srica } tnrh_tlb_t;
110*4746Srica 
111*4746Srica /* tnrhdb IPv6 address lookup table */
112*4746Srica typedef struct tnrh_tlb_ipv6 {
113*4746Srica 	in6_addr_t	addr;
114*4746Srica 	char		template_name[TNTNAMSIZ];
115*4746Srica 	int		reload;		/* flag to reload/delete */
116*4746Srica 	int		masklen_used;	/* Which mask did we use */
117*4746Srica 	tnd_tnrhdb_t	*src;		/* Which table entry is our source */
118*4746Srica 	struct tnrh_tlb_ipv6	*next;	/* Next in the hash chain */
119*4746Srica } tnrh_tlb_ipv6_t;
120*4746Srica 
121*4746Srica /* Clients of tnd can use this structure */
122*4746Srica typedef struct {
123*4746Srica 	struct tsol_rhent rh;
124*4746Srica 	union {
125*4746Srica 		in_addr_t _v4addr;
126*4746Srica 		in6_addr_t _v6addr;
127*4746Srica 	} _addr_un;
128*4746Srica 	sa_family_t af;
129*4746Srica 	int flag;	/* flag to reload/delete */
130*4746Srica } tndclnt_arg_t;
131*4746Srica #define	v4addr _addr_un._v4addr
132*4746Srica #define	v6addr _addr_un._v6addr
133*4746Srica 
134*4746Srica #ifdef	__cplusplus
135*4746Srica }
136*4746Srica #endif
137*4746Srica 
138*4746Srica #endif	/* _TND_H_ */
139