xref: /titanic_50/usr/src/lib/libdladm/common/libdlflow.h (revision 24fe0b3bf671e123467ce1df0b67cadd3614c8e4)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _LIBDLFLOW_H
27 #define	_LIBDLFLOW_H
28 
29 /*
30  * This file includes strcutures, macros and routines used by general
31  * flow administration
32  */
33 #include <sys/types.h>
34 #include <netinet/in.h>
35 #include <sys/mac_flow.h>
36 #include <sys/dld.h>
37 #include <sys/param.h>
38 #include <sys/mac.h>
39 #include <libdladm.h>
40 #include <libdladm_impl.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct dladm_flow_attr {
47 	datalink_id_t		fa_linkid;
48 	char			fa_flowname[MAXFLOWNAMELEN];
49 	flow_desc_t		fa_flow_desc;
50 	mac_resource_props_t	fa_resource_props;
51 	uint64_t		fa_mask;
52 	int			fa_nattr;
53 } dladm_flow_attr_t;
54 
55 extern dladm_status_t	dladm_flow_add(dladm_handle_t, datalink_id_t,
56 			    dladm_arg_list_t *, dladm_arg_list_t *, char *,
57 			    boolean_t, const char *);
58 extern dladm_status_t	dladm_flow_remove(dladm_handle_t, char *, boolean_t,
59 			    const char *);
60 extern dladm_status_t	dladm_flow_init(dladm_handle_t);
61 
62 extern dladm_status_t	dladm_flow_parse_db(char *, dld_flowinfo_t *);
63 extern dladm_status_t	dladm_walk_flow(int (*)(dladm_handle_t,
64 			    dladm_flow_attr_t *, void *), dladm_handle_t,
65 			    datalink_id_t, void *, boolean_t);
66 extern dladm_status_t	dladm_flow_info(dladm_handle_t, const char *,
67 			    dladm_flow_attr_t *);
68 
69 extern dladm_status_t	dladm_set_flowprop(dladm_handle_t, const char *,
70 			    const char *, char **, uint_t, uint_t, char **);
71 extern dladm_status_t	dladm_get_flowprop(dladm_handle_t, const char *,
72 			    uint32_t, const char *, char **, uint_t *);
73 extern dladm_status_t	dladm_walk_flowprop(int (*)(void *, const char *),
74 			    const char *, void *);
75 
76 extern void		dladm_flow_attr_mask(uint64_t, dladm_flow_attr_t *);
77 extern dladm_status_t	dladm_flow_attr_check(dladm_arg_list_t *);
78 extern dladm_status_t	dladm_prefixlen2mask(int, int, uchar_t *);
79 extern dladm_status_t	dladm_mask2prefixlen(in6_addr_t *, int, int *);
80 extern char		*dladm_proto2str(uint8_t);
81 extern uint8_t		dladm_str2proto(const char *);
82 
83 extern void		dladm_flow_attr_ip2str(dladm_flow_attr_t *,
84 			    char *, size_t);
85 extern void		dladm_flow_attr_proto2str(dladm_flow_attr_t *,
86 			    char *, size_t);
87 extern void		dladm_flow_attr_port2str(dladm_flow_attr_t *,
88 			    char *, size_t);
89 extern void		dladm_flow_attr_dsfield2str(dladm_flow_attr_t *,
90 			    char *, size_t);
91 
92 #ifdef	__cplusplus
93 }
94 #endif
95 
96 #endif	/* _LIBDLFLOW_H */
97