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