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