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