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