Unleashed v1.4
[unleashed.git] / usr / src / lib / libdladm / common / libdlflow_impl.h
blob060c31d84bbd7744b0865dd7a1f72ed06e2b4733
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _LIBDLFLOW_IMPL_H
27 #define _LIBDLFLOW_IMPL_H
29 #include <sys/types.h>
30 #include <sys/param.h>
31 #include <sys/mac.h>
32 #include <libdladm.h>
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 struct fprop_desc;
39 struct fattr_desc;
41 typedef dladm_status_t fpd_getf_t(dladm_handle_t, const char *, char **,
42 uint_t *);
43 typedef dladm_status_t fpd_setf_t(dladm_handle_t, const char *, val_desc_t *,
44 uint_t);
45 typedef dladm_status_t fpd_checkf_t(struct fprop_desc *, char **, uint_t,
46 val_desc_t **);
48 typedef struct fprop_desc {
49 char *pd_name;
50 val_desc_t pd_defval;
51 val_desc_t *pd_modval;
52 uint_t pd_nmodval;
53 boolean_t pd_temponly;
54 fpd_setf_t *pd_set;
55 fpd_getf_t *pd_getmod;
56 fpd_getf_t *pd_get;
57 fpd_checkf_t *pd_check;
58 } fprop_desc_t;
60 typedef struct prop_table {
61 fprop_desc_t *pt_table;
62 uint_t pt_size;
63 } prop_table_t;
65 typedef enum {
66 DLADM_PROP_VAL_CURRENT = 1,
67 DLADM_PROP_VAL_DEFAULT,
68 DLADM_PROP_VAL_MODIFIABLE,
69 DLADM_PROP_VAL_PERSISTENT
70 } prop_type_t;
72 typedef dladm_status_t fad_checkf_t(char *, flow_desc_t *);
74 extern dladm_status_t do_check_ip_addr(char *, boolean_t, flow_desc_t *);
75 extern dladm_status_t do_check_dsfield(char *, flow_desc_t *);
77 typedef struct fattr_desc {
78 const char *ad_name;
79 fad_checkf_t *ad_check;
80 } fattr_desc_t;
82 extern dladm_status_t i_dladm_get_prop_temp(dladm_handle_t, const char *,
83 prop_type_t, const char *, char **, uint_t *,
84 prop_table_t *);
85 extern dladm_status_t i_dladm_set_prop_temp(dladm_handle_t, const char *,
86 const char *, char **, uint_t, uint_t, char **,
87 prop_table_t *);
88 extern boolean_t i_dladm_is_prop_temponly(const char *prop_name,
89 char **, prop_table_t *);
91 * Data structures used for implementing persistent properties
93 typedef struct prop_val {
94 const char *lv_name;
95 struct prop_val *lv_nextval;
96 } prop_val_t;
98 typedef struct prop_db_info {
99 const char *li_name;
100 struct prop_db_info *li_nextprop;
101 struct prop_val *li_val;
102 } prop_db_info_t;
104 typedef struct prop_db_state prop_db_state_t;
106 typedef boolean_t (*prop_db_op_t)(dladm_handle_t, prop_db_state_t *,
107 char *, prop_db_info_t *, dladm_status_t *);
109 typedef dladm_status_t (*prop_db_initop_t)(dladm_handle_t, const char *,
110 const char *, char **, uint_t, uint_t, char **);
112 struct prop_db_state {
113 prop_db_op_t ls_op;
114 const char *ls_name;
115 const char *ls_propname;
116 char **ls_propval;
117 uint_t *ls_valcntp;
118 prop_db_initop_t ls_initop;
121 extern boolean_t process_prop_set(dladm_handle_t, prop_db_state_t *lsp,
122 char *buf, prop_db_info_t *listp,
123 dladm_status_t *statusp);
124 extern boolean_t process_prop_get(dladm_handle_t, prop_db_state_t *lsp,
125 char *buf, prop_db_info_t *listp,
126 dladm_status_t *statusp);
127 extern boolean_t process_prop_init(dladm_handle_t, prop_db_state_t *lsp,
128 char *buf, prop_db_info_t *listp,
129 dladm_status_t *statusp);
130 extern dladm_status_t process_prop_db(dladm_handle_t, void *arg, FILE *fp,
131 FILE *nfp);
133 extern dladm_status_t i_dladm_init_flowprop_db(dladm_handle_t);
134 extern dladm_status_t i_dladm_set_flow_proplist_db(dladm_handle_t, char *,
135 dladm_arg_list_t *);
136 extern dladm_status_t i_dladm_flow_check_restriction(datalink_id_t,
137 flow_desc_t *, mac_resource_props_t *, boolean_t);
139 extern dladm_status_t dladm_flow_attrlist_extract(dladm_arg_list_t *,
140 flow_desc_t *);
142 #ifdef __cplusplus
144 #endif
146 #endif /* _LIBDLFLOW_IMPL_H */