xref: /titanic_51/usr/src/lib/libdladm/common/libdlflow.h (revision 63251bc7f1ca38259078c48e316fee4ed66d4e93)
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_flow_attr_t *, void *),
64 			    dladm_handle_t, datalink_id_t, void *, boolean_t);
65 extern dladm_status_t	dladm_flow_info(dladm_handle_t, const char *,
66 			    dladm_flow_attr_t *);
67 
68 extern dladm_status_t	dladm_set_flowprop(dladm_handle_t, const char *,
69 			    const char *, char **, uint_t, uint_t, char **);
70 extern dladm_status_t	dladm_get_flowprop(dladm_handle_t, const char *,
71 			    uint32_t, const char *, char **, uint_t *);
72 extern dladm_status_t	dladm_walk_flowprop(int (*)(void *, const char *),
73 			    const char *, void *);
74 
75 extern void		dladm_flow_attr_mask(uint64_t, dladm_flow_attr_t *);
76 extern dladm_status_t	dladm_flow_attr_check(dladm_arg_list_t *);
77 extern dladm_status_t	dladm_prefixlen2mask(int, int, uchar_t *);
78 extern dladm_status_t	dladm_mask2prefixlen(in6_addr_t *, int, int *);
79 extern char		*dladm_proto2str(uint8_t);
80 extern uint8_t		dladm_str2proto(const char *);
81 
82 extern void		dladm_flow_attr_ip2str(dladm_flow_attr_t *,
83 			    char *, size_t);
84 extern void		dladm_flow_attr_proto2str(dladm_flow_attr_t *,
85 			    char *, size_t);
86 extern void		dladm_flow_attr_port2str(dladm_flow_attr_t *,
87 			    char *, size_t);
88 extern void		dladm_flow_attr_dsfield2str(dladm_flow_attr_t *,
89 			    char *, size_t);
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _LIBDLFLOW_H */
96