1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _IPP_IPP_H 28*7c478bd9Sstevel@tonic-gate #define _IPP_IPP_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * IP Policy Framework (IPPF) 34*7c478bd9Sstevel@tonic-gate */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 37*7c478bd9Sstevel@tonic-gate #include <sys/param.h> 38*7c478bd9Sstevel@tonic-gate #include <sys/nvpair.h> 39*7c478bd9Sstevel@tonic-gate #include <sys/stream.h> 40*7c478bd9Sstevel@tonic-gate #include <sys/kstat.h> 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 43*7c478bd9Sstevel@tonic-gate extern "C" { 44*7c478bd9Sstevel@tonic-gate #endif 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate typedef struct ipp_mod ipp_mod_t; 49*7c478bd9Sstevel@tonic-gate typedef int32_t ipp_mod_id_t; 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate #define IPP_MOD_RESERVED 0 /* Upper limit of reserved values */ 52*7c478bd9Sstevel@tonic-gate #define IPP_MOD_INVAL -1 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate typedef struct ipp_action ipp_action_t; 55*7c478bd9Sstevel@tonic-gate typedef int32_t ipp_action_id_t; 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate #define IPP_ACTION_RESERVED 0 /* Upper limit of reserved values */ 58*7c478bd9Sstevel@tonic-gate #define IPP_ACTION_INVAL -1 59*7c478bd9Sstevel@tonic-gate #define IPP_ACTION_CONT -2 60*7c478bd9Sstevel@tonic-gate #define IPP_ACTION_DEFER -3 61*7c478bd9Sstevel@tonic-gate #define IPP_ACTION_DROP -4 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate #define IPP_ANAME_CONT "ipp.continue" 66*7c478bd9Sstevel@tonic-gate #define IPP_ANAME_DEFER "ipp.defer" 67*7c478bd9Sstevel@tonic-gate #define IPP_ANAME_DROP "ipp.drop" 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate typedef enum ipp_flags { 70*7c478bd9Sstevel@tonic-gate IPP_DESTROY_REF = 0x00000001 71*7c478bd9Sstevel@tonic-gate } ipp_flags_t; 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate typedef struct ipp_stat ipp_stat_t; 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* 78*7c478bd9Sstevel@tonic-gate * NOTE: Semi-opaque alias for struct ipp_stat_impl in common/ipp/ipp_impl.h 79*7c478bd9Sstevel@tonic-gate */ 80*7c478bd9Sstevel@tonic-gate struct ipp_stat { 81*7c478bd9Sstevel@tonic-gate void *ipps_data; 82*7c478bd9Sstevel@tonic-gate }; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate #define IPP_STAT_TAG 0x80 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate #define IPP_STAT_INT32 (IPP_STAT_TAG | KSTAT_DATA_INT32) 87*7c478bd9Sstevel@tonic-gate #define IPP_STAT_UINT32 (IPP_STAT_TAG | KSTAT_DATA_UINT32) 88*7c478bd9Sstevel@tonic-gate #define IPP_STAT_INT64 (IPP_STAT_TAG | KSTAT_DATA_INT64) 89*7c478bd9Sstevel@tonic-gate #define IPP_STAT_UINT64 (IPP_STAT_TAG | KSTAT_DATA_UINT64) 90*7c478bd9Sstevel@tonic-gate #define IPP_STAT_STRING (IPP_STAT_TAG | KSTAT_DATA_CHAR) 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate #define IPP_STAT_READ KSTAT_READ 93*7c478bd9Sstevel@tonic-gate #define IPP_STAT_WRITE KSTAT_WRITE 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate typedef kstat_named_t ipp_named_t; 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate typedef struct ipp_class ipp_class_t; 98*7c478bd9Sstevel@tonic-gate typedef struct ipp_log ipp_log_t; 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate typedef struct ipp_packet ipp_packet_t; 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate #define IPPO_REV_1 1 103*7c478bd9Sstevel@tonic-gate #define IPPO_REV IPPO_REV_1 /* interface version */ 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate typedef struct ipp_ops ipp_ops_t; 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate struct ipp_ops { 108*7c478bd9Sstevel@tonic-gate int ippo_rev; 109*7c478bd9Sstevel@tonic-gate int (*ippo_action_create)(ipp_action_id_t, nvlist_t **, 110*7c478bd9Sstevel@tonic-gate ipp_flags_t); 111*7c478bd9Sstevel@tonic-gate int (*ippo_action_modify)(ipp_action_id_t, nvlist_t **, 112*7c478bd9Sstevel@tonic-gate ipp_flags_t); 113*7c478bd9Sstevel@tonic-gate int (*ippo_action_destroy)(ipp_action_id_t, ipp_flags_t); 114*7c478bd9Sstevel@tonic-gate int (*ippo_action_info)(ipp_action_id_t, int (*)(nvlist_t *, 115*7c478bd9Sstevel@tonic-gate void *), void *, ipp_flags_t); 116*7c478bd9Sstevel@tonic-gate int (*ippo_action_invoke)(ipp_action_id_t, ipp_packet_t *); 117*7c478bd9Sstevel@tonic-gate }; 118*7c478bd9Sstevel@tonic-gate 119*7c478bd9Sstevel@tonic-gate /* 120*7c478bd9Sstevel@tonic-gate * IPPF client interface 121*7c478bd9Sstevel@tonic-gate */ 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate extern int ipp_list_mods(ipp_mod_id_t **, int *); 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate extern ipp_mod_id_t ipp_mod_lookup(const char *); 126*7c478bd9Sstevel@tonic-gate extern int ipp_mod_name(ipp_mod_id_t, char **); 127*7c478bd9Sstevel@tonic-gate extern int ipp_mod_register(const char *, ipp_ops_t *); 128*7c478bd9Sstevel@tonic-gate extern int ipp_mod_unregister(ipp_mod_id_t); 129*7c478bd9Sstevel@tonic-gate extern int ipp_mod_list_actions(ipp_mod_id_t, ipp_action_id_t **, 130*7c478bd9Sstevel@tonic-gate int *); 131*7c478bd9Sstevel@tonic-gate 132*7c478bd9Sstevel@tonic-gate extern ipp_action_id_t ipp_action_lookup(const char *); 133*7c478bd9Sstevel@tonic-gate extern int ipp_action_name(ipp_action_id_t, char **); 134*7c478bd9Sstevel@tonic-gate extern int ipp_action_mod(ipp_action_id_t, ipp_mod_id_t *); 135*7c478bd9Sstevel@tonic-gate extern int ipp_action_create(ipp_mod_id_t, const char *, 136*7c478bd9Sstevel@tonic-gate nvlist_t **, ipp_flags_t, ipp_action_id_t *); 137*7c478bd9Sstevel@tonic-gate extern int ipp_action_modify(ipp_action_id_t, nvlist_t **, 138*7c478bd9Sstevel@tonic-gate ipp_flags_t); 139*7c478bd9Sstevel@tonic-gate extern int ipp_action_destroy(ipp_action_id_t, ipp_flags_t); 140*7c478bd9Sstevel@tonic-gate extern int ipp_action_info(ipp_action_id_t, int (*)(nvlist_t *, 141*7c478bd9Sstevel@tonic-gate void *), void *, ipp_flags_t); 142*7c478bd9Sstevel@tonic-gate extern void ipp_action_set_ptr(ipp_action_id_t, void *); 143*7c478bd9Sstevel@tonic-gate extern void *ipp_action_get_ptr(ipp_action_id_t); 144*7c478bd9Sstevel@tonic-gate extern int ipp_action_ref(ipp_action_id_t, ipp_action_id_t, 145*7c478bd9Sstevel@tonic-gate ipp_flags_t); 146*7c478bd9Sstevel@tonic-gate extern int ipp_action_unref(ipp_action_id_t, ipp_action_id_t, 147*7c478bd9Sstevel@tonic-gate ipp_flags_t); 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate extern int ipp_packet_alloc(ipp_packet_t **, const char *, 150*7c478bd9Sstevel@tonic-gate ipp_action_id_t); 151*7c478bd9Sstevel@tonic-gate extern void ipp_packet_free(ipp_packet_t *); 152*7c478bd9Sstevel@tonic-gate extern int ipp_packet_add_class(ipp_packet_t *, const char *, 153*7c478bd9Sstevel@tonic-gate ipp_action_id_t); 154*7c478bd9Sstevel@tonic-gate extern int ipp_packet_process(ipp_packet_t **); 155*7c478bd9Sstevel@tonic-gate extern int ipp_packet_next(ipp_packet_t *, ipp_action_id_t); 156*7c478bd9Sstevel@tonic-gate extern void ipp_packet_set_data(ipp_packet_t *, mblk_t *); 157*7c478bd9Sstevel@tonic-gate extern mblk_t *ipp_packet_get_data(ipp_packet_t *); 158*7c478bd9Sstevel@tonic-gate extern void ipp_packet_set_private(ipp_packet_t *, void *, 159*7c478bd9Sstevel@tonic-gate void (*)(void *)); 160*7c478bd9Sstevel@tonic-gate extern void *ipp_packet_get_private(ipp_packet_t *); 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate extern int ipp_stat_create(ipp_action_id_t, const char *, int, 163*7c478bd9Sstevel@tonic-gate int (*)(ipp_stat_t *, void *, int), void *, ipp_stat_t **); 164*7c478bd9Sstevel@tonic-gate extern void ipp_stat_install(ipp_stat_t *); 165*7c478bd9Sstevel@tonic-gate extern void ipp_stat_destroy(ipp_stat_t *); 166*7c478bd9Sstevel@tonic-gate extern int ipp_stat_named_init(ipp_stat_t *, const char *, 167*7c478bd9Sstevel@tonic-gate uchar_t, ipp_named_t *); 168*7c478bd9Sstevel@tonic-gate extern int ipp_stat_named_op(ipp_named_t *, void *, int); 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 173*7c478bd9Sstevel@tonic-gate } 174*7c478bd9Sstevel@tonic-gate #endif 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate #endif /* _IPP_IPP_H */ 177