xref: /illumos-gate/usr/src/lib/libdladm/common/libdlflow.h (revision 4ac67f0276a8313b5cefec38af347b94b7bfb526)
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 /*
22da14cebeSEric Cheng  * Copyright 2008 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;
48da14cebeSEric Cheng 	char			fa_flowname[MAXNAMELEN];
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 
55*4ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_flow_add(dladm_handle_t, datalink_id_t,
56*4ac67f02SAnurag S. Maskey 			    dladm_arg_list_t *, dladm_arg_list_t *, char *,
57*4ac67f02SAnurag S. Maskey 			    boolean_t, const char *);
58*4ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_flow_remove(dladm_handle_t, char *, boolean_t,
59da14cebeSEric Cheng 			    const char *);
60*4ac67f02SAnurag 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*4ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_walk_flow(int (*)(dladm_flow_attr_t *, void *),
64*4ac67f02SAnurag S. Maskey 			    dladm_handle_t, datalink_id_t, void *, boolean_t);
65*4ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_flow_info(dladm_handle_t, const char *,
66*4ac67f02SAnurag S. Maskey 			    dladm_flow_attr_t *);
67da14cebeSEric Cheng 
68*4ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_set_flowprop(dladm_handle_t, const char *,
69*4ac67f02SAnurag S. Maskey 			    const char *, char **, uint_t, uint_t, char **);
70*4ac67f02SAnurag S. Maskey extern dladm_status_t	dladm_get_flowprop(dladm_handle_t, const char *,
71*4ac67f02SAnurag S. Maskey 			    uint32_t, const char *, char **, uint_t *);
72da14cebeSEric Cheng extern dladm_status_t	dladm_walk_flowprop(int (*)(void *, const char *),
73da14cebeSEric Cheng 			    const char *, void *);
74da14cebeSEric Cheng 
75da14cebeSEric Cheng extern void		dladm_flow_attr_mask(uint64_t, dladm_flow_attr_t *);
76da14cebeSEric Cheng extern dladm_status_t	dladm_flow_attr_check(dladm_arg_list_t *);
77da14cebeSEric Cheng extern dladm_status_t	dladm_prefixlen2mask(int, int, uchar_t *);
78da14cebeSEric Cheng extern dladm_status_t	dladm_mask2prefixlen(in6_addr_t *, int, int *);
79da14cebeSEric Cheng extern char		*dladm_proto2str(uint8_t);
80da14cebeSEric Cheng extern uint8_t		dladm_str2proto(const char *);
81da14cebeSEric Cheng 
82da14cebeSEric Cheng extern void		dladm_flow_attr_ip2str(dladm_flow_attr_t *,
83da14cebeSEric Cheng 			    char *, size_t);
84da14cebeSEric Cheng extern void		dladm_flow_attr_proto2str(dladm_flow_attr_t *,
85da14cebeSEric Cheng 			    char *, size_t);
86da14cebeSEric Cheng extern void		dladm_flow_attr_port2str(dladm_flow_attr_t *,
87da14cebeSEric Cheng 			    char *, size_t);
88da14cebeSEric Cheng extern void		dladm_flow_attr_dsfield2str(dladm_flow_attr_t *,
89da14cebeSEric Cheng 			    char *, size_t);
90da14cebeSEric Cheng 
91da14cebeSEric Cheng #ifdef	__cplusplus
92da14cebeSEric Cheng }
93da14cebeSEric Cheng #endif
94da14cebeSEric Cheng 
95da14cebeSEric Cheng #endif	/* _LIBDLFLOW_H */
96