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 2001-2002 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _IPP_IPP_H 28*0Sstevel@tonic-gate #define _IPP_IPP_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate /* 33*0Sstevel@tonic-gate * IP Policy Framework (IPPF) 34*0Sstevel@tonic-gate */ 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #include <sys/types.h> 37*0Sstevel@tonic-gate #include <sys/param.h> 38*0Sstevel@tonic-gate #include <sys/nvpair.h> 39*0Sstevel@tonic-gate #include <sys/stream.h> 40*0Sstevel@tonic-gate #include <sys/kstat.h> 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 #ifdef _KERNEL 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate typedef struct ipp_mod ipp_mod_t; 49*0Sstevel@tonic-gate typedef int32_t ipp_mod_id_t; 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate #define IPP_MOD_RESERVED 0 /* Upper limit of reserved values */ 52*0Sstevel@tonic-gate #define IPP_MOD_INVAL -1 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate typedef struct ipp_action ipp_action_t; 55*0Sstevel@tonic-gate typedef int32_t ipp_action_id_t; 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate #define IPP_ACTION_RESERVED 0 /* Upper limit of reserved values */ 58*0Sstevel@tonic-gate #define IPP_ACTION_INVAL -1 59*0Sstevel@tonic-gate #define IPP_ACTION_CONT -2 60*0Sstevel@tonic-gate #define IPP_ACTION_DEFER -3 61*0Sstevel@tonic-gate #define IPP_ACTION_DROP -4 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate #endif /* _KERNEL */ 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate #define IPP_ANAME_CONT "ipp.continue" 66*0Sstevel@tonic-gate #define IPP_ANAME_DEFER "ipp.defer" 67*0Sstevel@tonic-gate #define IPP_ANAME_DROP "ipp.drop" 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate typedef enum ipp_flags { 70*0Sstevel@tonic-gate IPP_DESTROY_REF = 0x00000001 71*0Sstevel@tonic-gate } ipp_flags_t; 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate #ifdef _KERNEL 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate typedef struct ipp_stat ipp_stat_t; 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate /* 78*0Sstevel@tonic-gate * NOTE: Semi-opaque alias for struct ipp_stat_impl in common/ipp/ipp_impl.h 79*0Sstevel@tonic-gate */ 80*0Sstevel@tonic-gate struct ipp_stat { 81*0Sstevel@tonic-gate void *ipps_data; 82*0Sstevel@tonic-gate }; 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate #define IPP_STAT_TAG 0x80 85*0Sstevel@tonic-gate 86*0Sstevel@tonic-gate #define IPP_STAT_INT32 (IPP_STAT_TAG | KSTAT_DATA_INT32) 87*0Sstevel@tonic-gate #define IPP_STAT_UINT32 (IPP_STAT_TAG | KSTAT_DATA_UINT32) 88*0Sstevel@tonic-gate #define IPP_STAT_INT64 (IPP_STAT_TAG | KSTAT_DATA_INT64) 89*0Sstevel@tonic-gate #define IPP_STAT_UINT64 (IPP_STAT_TAG | KSTAT_DATA_UINT64) 90*0Sstevel@tonic-gate #define IPP_STAT_STRING (IPP_STAT_TAG | KSTAT_DATA_CHAR) 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #define IPP_STAT_READ KSTAT_READ 93*0Sstevel@tonic-gate #define IPP_STAT_WRITE KSTAT_WRITE 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate typedef kstat_named_t ipp_named_t; 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate typedef struct ipp_class ipp_class_t; 98*0Sstevel@tonic-gate typedef struct ipp_log ipp_log_t; 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate typedef struct ipp_packet ipp_packet_t; 101*0Sstevel@tonic-gate 102*0Sstevel@tonic-gate #define IPPO_REV_1 1 103*0Sstevel@tonic-gate #define IPPO_REV IPPO_REV_1 /* interface version */ 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate typedef struct ipp_ops ipp_ops_t; 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate struct ipp_ops { 108*0Sstevel@tonic-gate int ippo_rev; 109*0Sstevel@tonic-gate int (*ippo_action_create)(ipp_action_id_t, nvlist_t **, 110*0Sstevel@tonic-gate ipp_flags_t); 111*0Sstevel@tonic-gate int (*ippo_action_modify)(ipp_action_id_t, nvlist_t **, 112*0Sstevel@tonic-gate ipp_flags_t); 113*0Sstevel@tonic-gate int (*ippo_action_destroy)(ipp_action_id_t, ipp_flags_t); 114*0Sstevel@tonic-gate int (*ippo_action_info)(ipp_action_id_t, int (*)(nvlist_t *, 115*0Sstevel@tonic-gate void *), void *, ipp_flags_t); 116*0Sstevel@tonic-gate int (*ippo_action_invoke)(ipp_action_id_t, ipp_packet_t *); 117*0Sstevel@tonic-gate }; 118*0Sstevel@tonic-gate 119*0Sstevel@tonic-gate /* 120*0Sstevel@tonic-gate * IPPF client interface 121*0Sstevel@tonic-gate */ 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate extern int ipp_list_mods(ipp_mod_id_t **, int *); 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gate extern ipp_mod_id_t ipp_mod_lookup(const char *); 126*0Sstevel@tonic-gate extern int ipp_mod_name(ipp_mod_id_t, char **); 127*0Sstevel@tonic-gate extern int ipp_mod_register(const char *, ipp_ops_t *); 128*0Sstevel@tonic-gate extern int ipp_mod_unregister(ipp_mod_id_t); 129*0Sstevel@tonic-gate extern int ipp_mod_list_actions(ipp_mod_id_t, ipp_action_id_t **, 130*0Sstevel@tonic-gate int *); 131*0Sstevel@tonic-gate 132*0Sstevel@tonic-gate extern ipp_action_id_t ipp_action_lookup(const char *); 133*0Sstevel@tonic-gate extern int ipp_action_name(ipp_action_id_t, char **); 134*0Sstevel@tonic-gate extern int ipp_action_mod(ipp_action_id_t, ipp_mod_id_t *); 135*0Sstevel@tonic-gate extern int ipp_action_create(ipp_mod_id_t, const char *, 136*0Sstevel@tonic-gate nvlist_t **, ipp_flags_t, ipp_action_id_t *); 137*0Sstevel@tonic-gate extern int ipp_action_modify(ipp_action_id_t, nvlist_t **, 138*0Sstevel@tonic-gate ipp_flags_t); 139*0Sstevel@tonic-gate extern int ipp_action_destroy(ipp_action_id_t, ipp_flags_t); 140*0Sstevel@tonic-gate extern int ipp_action_info(ipp_action_id_t, int (*)(nvlist_t *, 141*0Sstevel@tonic-gate void *), void *, ipp_flags_t); 142*0Sstevel@tonic-gate extern void ipp_action_set_ptr(ipp_action_id_t, void *); 143*0Sstevel@tonic-gate extern void *ipp_action_get_ptr(ipp_action_id_t); 144*0Sstevel@tonic-gate extern int ipp_action_ref(ipp_action_id_t, ipp_action_id_t, 145*0Sstevel@tonic-gate ipp_flags_t); 146*0Sstevel@tonic-gate extern int ipp_action_unref(ipp_action_id_t, ipp_action_id_t, 147*0Sstevel@tonic-gate ipp_flags_t); 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate extern int ipp_packet_alloc(ipp_packet_t **, const char *, 150*0Sstevel@tonic-gate ipp_action_id_t); 151*0Sstevel@tonic-gate extern void ipp_packet_free(ipp_packet_t *); 152*0Sstevel@tonic-gate extern int ipp_packet_add_class(ipp_packet_t *, const char *, 153*0Sstevel@tonic-gate ipp_action_id_t); 154*0Sstevel@tonic-gate extern int ipp_packet_process(ipp_packet_t **); 155*0Sstevel@tonic-gate extern int ipp_packet_next(ipp_packet_t *, ipp_action_id_t); 156*0Sstevel@tonic-gate extern void ipp_packet_set_data(ipp_packet_t *, mblk_t *); 157*0Sstevel@tonic-gate extern mblk_t *ipp_packet_get_data(ipp_packet_t *); 158*0Sstevel@tonic-gate extern void ipp_packet_set_private(ipp_packet_t *, void *, 159*0Sstevel@tonic-gate void (*)(void *)); 160*0Sstevel@tonic-gate extern void *ipp_packet_get_private(ipp_packet_t *); 161*0Sstevel@tonic-gate 162*0Sstevel@tonic-gate extern int ipp_stat_create(ipp_action_id_t, const char *, int, 163*0Sstevel@tonic-gate int (*)(ipp_stat_t *, void *, int), void *, ipp_stat_t **); 164*0Sstevel@tonic-gate extern void ipp_stat_install(ipp_stat_t *); 165*0Sstevel@tonic-gate extern void ipp_stat_destroy(ipp_stat_t *); 166*0Sstevel@tonic-gate extern int ipp_stat_named_init(ipp_stat_t *, const char *, 167*0Sstevel@tonic-gate uchar_t, ipp_named_t *); 168*0Sstevel@tonic-gate extern int ipp_stat_named_op(ipp_named_t *, void *, int); 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate #endif /* _KERNEL */ 171*0Sstevel@tonic-gate 172*0Sstevel@tonic-gate #ifdef __cplusplus 173*0Sstevel@tonic-gate } 174*0Sstevel@tonic-gate #endif 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate #endif /* _IPP_IPP_H */ 177