xref: /titanic_41/usr/src/lib/libdladm/common/libdladm_impl.h (revision ed5289f91b9bf164dccd6c75398362be77a4478d)
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 typedef struct val_desc {
40 	char		*vd_name;
41 	uintptr_t	vd_val;
42 } val_desc_t;
43 
44 #define	VALCNT(vals)	(sizeof ((vals)) / sizeof (val_desc_t))
45 
46 extern dladm_status_t	dladm_errno2status(int);
47 extern dladm_status_t   i_dladm_rw_db(const char *, mode_t,
48 			    dladm_status_t (*)(void *, FILE *, FILE *),
49 			    void *, boolean_t);
50 
51 /*
52  * Link attributes persisted by dlmgmtd.
53  */
54 /*
55  * Set for VLANs only
56  */
57 #define	FVLANID		"vid"		/* uint64_t */
58 #define	FLINKOVER	"linkover"	/* uint64_t */
59 
60 /*
61  * Set for AGGRs only
62  */
63 #define	FKEY		"key"		/* uint64_t */
64 #define	FNPORTS		"nports"	/* uint64_t */
65 #define	FPORTS		"portnames"	/* string */
66 #define	FPOLICY		"policy"	/* uint64_t */
67 #define	FFIXMACADDR	"fix_macaddr"	/* boolean_t */
68 #define	FMACADDR	"macaddr"	/* string */
69 #define	FFORCE		"force"		/* boolean_t */
70 #define	FLACPMODE	"lacp_mode"	/* uint64_t */
71 #define	FLACPTIMER	"lacp_timer"	/* uint64_t */
72 
73 #ifdef	__cplusplus
74 }
75 #endif
76 
77 #endif	/* _LIBDLADM_IMPL_H */
78