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 _LIBDLADM_IMPL_H 27 #define _LIBDLADM_IMPL_H 28 29 #include <libdladm.h> 30 #include <stdio.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #define MAXLINELEN 1024 37 #define BUFLEN(lim, ptr) (((lim) > (ptr)) ? ((lim) - (ptr)) : 0) 38 39 extern dladm_status_t dladm_errno2status(int); 40 extern dladm_status_t i_dladm_rw_db(const char *, mode_t, 41 dladm_status_t (*)(void *, FILE *, FILE *), 42 void *, boolean_t); 43 44 extern const char *dladm_pri2str(mac_priority_level_t, char *); 45 extern dladm_status_t dladm_str2pri(char *, mac_priority_level_t *); 46 extern dladm_status_t dladm_parse_args(char *, dladm_arg_list_t **, 47 boolean_t); 48 extern void dladm_free_args(dladm_arg_list_t *); 49 50 /* 51 * Link attributes persisted by dlmgmtd. 52 */ 53 /* 54 * Set for VLANs only 55 */ 56 #define FVLANID "vid" /* uint64_t */ 57 #define FLINKOVER "linkover" /* uint64_t */ 58 59 /* 60 * Set for AGGRs only 61 */ 62 #define FKEY "key" /* uint64_t */ 63 #define FNPORTS "nports" /* uint64_t */ 64 #define FPORTS "portnames" /* string */ 65 #define FPOLICY "policy" /* uint64_t */ 66 #define FFIXMACADDR "fix_macaddr" /* boolean_t */ 67 #define FFORCE "force" /* boolean_t */ 68 #define FLACPMODE "lacp_mode" /* uint64_t */ 69 #define FLACPTIMER "lacp_timer" /* uint64_t */ 70 71 /* 72 * Set for VNICs only 73 */ 74 #define FMADDRTYPE "maddrtype" /* uint64_t */ 75 #define FMADDRLEN "maddrlen" /* uint64_t */ 76 #define FMADDRSLOT "maddrslot" /* uint64_t */ 77 #define FMADDRPREFIXLEN "maddrpreflen" /* uint64_t */ 78 #define FHWRINGS "hwrings" /* boolean_t */ 79 80 /* 81 * Common fields 82 */ 83 #define FMACADDR "macaddr" /* string */ 84 85 /* 86 * Data structures used for implementing temporary properties 87 */ 88 89 typedef struct val_desc { 90 char *vd_name; 91 uintptr_t vd_val; 92 } val_desc_t; 93 94 #define VALCNT(vals) (sizeof ((vals)) / sizeof (val_desc_t)) 95 96 extern dladm_status_t dladm_link_proplist_extract(dladm_arg_list_t *, 97 mac_resource_props_t *); 98 99 extern dladm_status_t dladm_flow_proplist_extract(dladm_arg_list_t *, 100 mac_resource_props_t *); 101 102 /* 103 * The prop extract() callback. 104 * 105 * rp_extract extracts the kernel structure from the val_desc_t created 106 * by the pd_check function. 107 */ 108 typedef dladm_status_t rp_extractf_t(val_desc_t *propval, void *arg, 109 uint_t cnt); 110 extern rp_extractf_t do_extract_maxbw, do_extract_priority, 111 do_extract_cpus; 112 113 typedef struct resource_prop_s { 114 /* 115 * resource property name 116 */ 117 char *rp_name; 118 119 /* 120 * callback to extract kernel structure 121 */ 122 rp_extractf_t *rp_extract; 123 } resource_prop_t; 124 125 #ifdef __cplusplus 126 } 127 #endif 128 129 #endif /* _LIBDLADM_IMPL_H */ 130