18275SEric Cheng /*
28275SEric Cheng  * CDDL HEADER START
38275SEric Cheng  *
48275SEric Cheng  * The contents of this file are subject to the terms of the
58275SEric Cheng  * Common Development and Distribution License (the "License").
68275SEric Cheng  * You may not use this file except in compliance with the License.
78275SEric Cheng  *
88275SEric Cheng  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
98275SEric Cheng  * or http://www.opensolaris.org/os/licensing.
108275SEric Cheng  * See the License for the specific language governing permissions
118275SEric Cheng  * and limitations under the License.
128275SEric Cheng  *
138275SEric Cheng  * When distributing Covered Code, include this CDDL HEADER in each
148275SEric Cheng  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
158275SEric Cheng  * If applicable, add the following below this CDDL HEADER, with the
168275SEric Cheng  * fields enclosed by brackets "[]" replaced with your own identifying
178275SEric Cheng  * information: Portions Copyright [yyyy] [name of copyright owner]
188275SEric Cheng  *
198275SEric Cheng  * CDDL HEADER END
208275SEric Cheng  */
218275SEric Cheng /*
228558SGirish.Moodalbail@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
238275SEric Cheng  * Use is subject to license terms.
248275SEric Cheng  */
258275SEric Cheng 
268275SEric Cheng #ifndef _LIBDLFLOW_H
278275SEric Cheng #define	_LIBDLFLOW_H
288275SEric Cheng 
298275SEric Cheng /*
308275SEric Cheng  * This file includes strcutures, macros and routines used by general
318275SEric Cheng  * flow administration
328275SEric Cheng  */
338275SEric Cheng #include <sys/types.h>
348275SEric Cheng #include <netinet/in.h>
358275SEric Cheng #include <sys/mac_flow.h>
368275SEric Cheng #include <sys/dld.h>
378275SEric Cheng #include <sys/param.h>
388275SEric Cheng #include <sys/mac.h>
398275SEric Cheng #include <libdladm.h>
408275SEric Cheng #include <libdladm_impl.h>
418275SEric Cheng 
428275SEric Cheng #ifdef	__cplusplus
438275SEric Cheng extern "C" {
448275SEric Cheng #endif
458275SEric Cheng 
468275SEric Cheng typedef struct dladm_flow_attr {
478275SEric Cheng 	datalink_id_t		fa_linkid;
488558SGirish.Moodalbail@Sun.COM 	char			fa_flowname[MAXFLOWNAMELEN];
498275SEric Cheng 	flow_desc_t		fa_flow_desc;
508275SEric Cheng 	mac_resource_props_t	fa_resource_props;
518275SEric Cheng 	uint64_t		fa_mask;
528275SEric Cheng 	int			fa_nattr;
538275SEric Cheng } dladm_flow_attr_t;
548275SEric Cheng 
558453SAnurag.Maskey@Sun.COM extern dladm_status_t	dladm_flow_add(dladm_handle_t, datalink_id_t,
568453SAnurag.Maskey@Sun.COM 			    dladm_arg_list_t *, dladm_arg_list_t *, char *,
578453SAnurag.Maskey@Sun.COM 			    boolean_t, const char *);
588453SAnurag.Maskey@Sun.COM extern dladm_status_t	dladm_flow_remove(dladm_handle_t, char *, boolean_t,
598275SEric Cheng 			    const char *);
608453SAnurag.Maskey@Sun.COM extern dladm_status_t	dladm_flow_init(dladm_handle_t);
618275SEric Cheng 
628275SEric Cheng extern dladm_status_t	dladm_flow_parse_db(char *, dld_flowinfo_t *);
63*9421SMichael.Lim@Sun.COM extern dladm_status_t	dladm_walk_flow(int (*)(dladm_handle_t,
64*9421SMichael.Lim@Sun.COM 			    dladm_flow_attr_t *, void *), dladm_handle_t,
65*9421SMichael.Lim@Sun.COM 			    datalink_id_t, void *, boolean_t);
668453SAnurag.Maskey@Sun.COM extern dladm_status_t	dladm_flow_info(dladm_handle_t, const char *,
678453SAnurag.Maskey@Sun.COM 			    dladm_flow_attr_t *);
688275SEric Cheng 
698453SAnurag.Maskey@Sun.COM extern dladm_status_t	dladm_set_flowprop(dladm_handle_t, const char *,
708453SAnurag.Maskey@Sun.COM 			    const char *, char **, uint_t, uint_t, char **);
718453SAnurag.Maskey@Sun.COM extern dladm_status_t	dladm_get_flowprop(dladm_handle_t, const char *,
728453SAnurag.Maskey@Sun.COM 			    uint32_t, const char *, char **, uint_t *);
738275SEric Cheng extern dladm_status_t	dladm_walk_flowprop(int (*)(void *, const char *),
748275SEric Cheng 			    const char *, void *);
758275SEric Cheng 
768275SEric Cheng extern void		dladm_flow_attr_mask(uint64_t, dladm_flow_attr_t *);
778275SEric Cheng extern dladm_status_t	dladm_flow_attr_check(dladm_arg_list_t *);
788275SEric Cheng extern dladm_status_t	dladm_prefixlen2mask(int, int, uchar_t *);
798275SEric Cheng extern dladm_status_t	dladm_mask2prefixlen(in6_addr_t *, int, int *);
808275SEric Cheng extern char		*dladm_proto2str(uint8_t);
818275SEric Cheng extern uint8_t		dladm_str2proto(const char *);
828275SEric Cheng 
838275SEric Cheng extern void		dladm_flow_attr_ip2str(dladm_flow_attr_t *,
848275SEric Cheng 			    char *, size_t);
858275SEric Cheng extern void		dladm_flow_attr_proto2str(dladm_flow_attr_t *,
868275SEric Cheng 			    char *, size_t);
878275SEric Cheng extern void		dladm_flow_attr_port2str(dladm_flow_attr_t *,
888275SEric Cheng 			    char *, size_t);
898275SEric Cheng extern void		dladm_flow_attr_dsfield2str(dladm_flow_attr_t *,
908275SEric Cheng 			    char *, size_t);
918275SEric Cheng 
928275SEric Cheng #ifdef	__cplusplus
938275SEric Cheng }
948275SEric Cheng #endif
958275SEric Cheng 
968275SEric Cheng #endif	/* _LIBDLFLOW_H */
97