xref: /titanic_44/usr/src/lib/libdladm/common/libdlflow.h (revision c3affd820c380dd131cbf6584013c11487d84089)
1da14cebeSEric Cheng /*
2da14cebeSEric Cheng  * CDDL HEADER START
3da14cebeSEric Cheng  *
4da14cebeSEric Cheng  * The contents of this file are subject to the terms of the
5da14cebeSEric Cheng  * Common Development and Distribution License (the "License").
6da14cebeSEric Cheng  * You may not use this file except in compliance with the License.
7da14cebeSEric Cheng  *
8da14cebeSEric Cheng  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9da14cebeSEric Cheng  * or http://www.opensolaris.org/os/licensing.
10da14cebeSEric Cheng  * See the License for the specific language governing permissions
11da14cebeSEric Cheng  * and limitations under the License.
12da14cebeSEric Cheng  *
13da14cebeSEric Cheng  * When distributing Covered Code, include this CDDL HEADER in each
14da14cebeSEric Cheng  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15da14cebeSEric Cheng  * If applicable, add the following below this CDDL HEADER, with the
16da14cebeSEric Cheng  * fields enclosed by brackets "[]" replaced with your own identifying
17da14cebeSEric Cheng  * information: Portions Copyright [yyyy] [name of copyright owner]
18da14cebeSEric Cheng  *
19da14cebeSEric Cheng  * CDDL HEADER END
20da14cebeSEric Cheng  */
21da14cebeSEric Cheng /*
22da000602SGirish Moodalbail  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23da14cebeSEric Cheng  * Use is subject to license terms.
24da14cebeSEric Cheng  */
25da14cebeSEric Cheng 
26da14cebeSEric Cheng #ifndef _LIBDLFLOW_H
27da14cebeSEric Cheng #define	_LIBDLFLOW_H
28da14cebeSEric Cheng 
29da14cebeSEric Cheng /*
30da14cebeSEric Cheng  * This file includes strcutures, macros and routines used by general
31da14cebeSEric Cheng  * flow administration
32da14cebeSEric Cheng  */
33da14cebeSEric Cheng #include <sys/types.h>
34da14cebeSEric Cheng #include <netinet/in.h>
35da14cebeSEric Cheng #include <sys/mac_flow.h>
36da14cebeSEric Cheng #include <sys/dld.h>
37da14cebeSEric Cheng #include <sys/param.h>
38da14cebeSEric Cheng #include <sys/mac.h>
39da14cebeSEric Cheng #include <libdladm.h>
40da14cebeSEric Cheng #include <libdladm_impl.h>
41da14cebeSEric Cheng 
42da14cebeSEric Cheng #ifdef	__cplusplus
43da14cebeSEric Cheng extern "C" {
44da14cebeSEric Cheng #endif
45da14cebeSEric Cheng 
46da14cebeSEric Cheng typedef struct dladm_flow_attr {
47da14cebeSEric Cheng 	datalink_id_t		fa_linkid;
48da000602SGirish Moodalbail 	char			fa_flowname[MAXFLOWNAMELEN];
49da14cebeSEric Cheng 	flow_desc_t		fa_flow_desc;
50da14cebeSEric Cheng 	mac_resource_props_t	fa_resource_props;
51da14cebeSEric Cheng 	uint64_t		fa_mask;
52da14cebeSEric Cheng 	int			fa_nattr;
53da14cebeSEric Cheng } dladm_flow_attr_t;
54da14cebeSEric Cheng 
554ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_flow_add(dladm_handle_t, datalink_id_t,
564ac67f02SAnurag S. Maskey 			    dladm_arg_list_t *, dladm_arg_list_t *, char *,
574ac67f02SAnurag S. Maskey 			    boolean_t, const char *);
584ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_flow_remove(dladm_handle_t, char *, boolean_t,
59da14cebeSEric Cheng 			    const char *);
604ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_flow_init(dladm_handle_t);
61da14cebeSEric Cheng 
62da14cebeSEric Cheng extern dladm_status_t	dladm_flow_parse_db(char *, dld_flowinfo_t *);
63*c3affd82SMichael Lim extern dladm_status_t	dladm_walk_flow(int (*)(dladm_handle_t,
64*c3affd82SMichael Lim 			    dladm_flow_attr_t *, void *), dladm_handle_t,
65*c3affd82SMichael Lim 			    datalink_id_t, void *, boolean_t);
664ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_flow_info(dladm_handle_t, const char *,
674ac67f02SAnurag S. Maskey 			    dladm_flow_attr_t *);
68da14cebeSEric Cheng 
694ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_set_flowprop(dladm_handle_t, const char *,
704ac67f02SAnurag S. Maskey 			    const char *, char **, uint_t, uint_t, char **);
714ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_get_flowprop(dladm_handle_t, const char *,
724ac67f02SAnurag S. Maskey 			    uint32_t, const char *, char **, uint_t *);
73da14cebeSEric Cheng extern dladm_status_t	dladm_walk_flowprop(int (*)(void *, const char *),
74da14cebeSEric Cheng 			    const char *, void *);
75da14cebeSEric Cheng 
76da14cebeSEric Cheng extern void		dladm_flow_attr_mask(uint64_t, dladm_flow_attr_t *);
77da14cebeSEric Cheng extern dladm_status_t	dladm_flow_attr_check(dladm_arg_list_t *);
78da14cebeSEric Cheng extern dladm_status_t	dladm_prefixlen2mask(int, int, uchar_t *);
79da14cebeSEric Cheng extern dladm_status_t	dladm_mask2prefixlen(in6_addr_t *, int, int *);
80da14cebeSEric Cheng extern char		*dladm_proto2str(uint8_t);
81da14cebeSEric Cheng extern uint8_t		dladm_str2proto(const char *);
82da14cebeSEric Cheng 
83da14cebeSEric Cheng extern void		dladm_flow_attr_ip2str(dladm_flow_attr_t *,
84da14cebeSEric Cheng 			    char *, size_t);
85da14cebeSEric Cheng extern void		dladm_flow_attr_proto2str(dladm_flow_attr_t *,
86da14cebeSEric Cheng 			    char *, size_t);
87da14cebeSEric Cheng extern void		dladm_flow_attr_port2str(dladm_flow_attr_t *,
88da14cebeSEric Cheng 			    char *, size_t);
89da14cebeSEric Cheng extern void		dladm_flow_attr_dsfield2str(dladm_flow_attr_t *,
90da14cebeSEric Cheng 			    char *, size_t);
91da14cebeSEric Cheng 
92da14cebeSEric Cheng #ifdef	__cplusplus
93da14cebeSEric Cheng }
94da14cebeSEric Cheng #endif
95da14cebeSEric Cheng 
96da14cebeSEric Cheng #endif	/* _LIBDLFLOW_H */
97