xref: /titanic_51/usr/src/lib/libdladm/common/libdlmgmt.h (revision da14cebe459d3275048785f25bd869cb09b5307f)
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 /*
27  * This file includes structures, macros used to communicate with linkmgmt
28  * daemon.
29  */
30 
31 #ifndef _LIBDLMGMT_H
32 #define	_LIBDLMGMT_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <sys/types.h>
37 #include <libdladm.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * datalink management related macros, structures.
45  */
46 
47 /*
48  * Door call commands.
49  */
50 #define	DLMGMT_CMD_CREATE_LINKID	(DLMGMT_CMD_BASE + 0)
51 #define	DLMGMT_CMD_DESTROY_LINKID	(DLMGMT_CMD_BASE + 1)
52 #define	DLMGMT_CMD_REMAP_LINKID		(DLMGMT_CMD_BASE + 2)
53 #define	DLMGMT_CMD_CREATECONF		(DLMGMT_CMD_BASE + 3)
54 #define	DLMGMT_CMD_READCONF		(DLMGMT_CMD_BASE + 4)
55 #define	DLMGMT_CMD_WRITECONF		(DLMGMT_CMD_BASE + 5)
56 #define	DLMGMT_CMD_UP_LINKID		(DLMGMT_CMD_BASE + 6)
57 #define	DLMGMT_CMD_SETATTR		(DLMGMT_CMD_BASE + 7)
58 #define	DLMGMT_CMD_UNSETATTR		(DLMGMT_CMD_BASE + 8)
59 #define	DLMGMT_CMD_REMOVECONF		(DLMGMT_CMD_BASE + 9)
60 #define	DLMGMT_CMD_DESTROYCONF		(DLMGMT_CMD_BASE + 10)
61 #define	DLMGMT_CMD_GETATTR		(DLMGMT_CMD_BASE + 11)
62 
63 typedef struct dlmgmt_door_createid_s {
64 	int			ld_cmd;
65 	char			ld_link[MAXLINKNAMELEN];
66 	datalink_class_t	ld_class;
67 	uint32_t		ld_media;
68 	boolean_t		ld_prefix;
69 	uint32_t		ld_flags;
70 } dlmgmt_door_createid_t;
71 
72 typedef struct dlmgmt_door_destroyid_s {
73 	int		ld_cmd;
74 	datalink_id_t	ld_linkid;
75 	uint32_t	ld_flags;
76 } dlmgmt_door_destroyid_t;
77 
78 typedef struct dlmgmt_door_remapid_s {
79 	int		ld_cmd;
80 	datalink_id_t	ld_linkid;
81 	char		ld_link[MAXLINKNAMELEN];
82 } dlmgmt_door_remapid_t;
83 
84 typedef struct dlmgmt_door_upid_s {
85 	int		ld_cmd;
86 	datalink_id_t	ld_linkid;
87 } dlmgmt_door_upid_t;
88 
89 typedef struct dlmgmt_door_createconf_s {
90 	int			ld_cmd;
91 	char			ld_link[MAXLINKNAMELEN];
92 	datalink_id_t		ld_linkid;
93 	datalink_class_t	ld_class;
94 	uint32_t		ld_media;
95 } dlmgmt_door_createconf_t;
96 
97 typedef struct dlmgmt_door_setattr_s {
98 	int			ld_cmd;
99 	dladm_conf_t		ld_conf;
100 	char			ld_attr[MAXLINKATTRLEN];
101 	size_t			ld_attrsz;
102 	dladm_datatype_t	ld_type;
103 	char			ld_attrval[MAXLINKATTRVALLEN];
104 } dlmgmt_door_setattr_t;
105 
106 typedef struct dlmgmt_door_unsetattr_s {
107 	int		ld_cmd;
108 	dladm_conf_t	ld_conf;
109 	char		ld_attr[MAXLINKATTRLEN];
110 } dlmgmt_door_unsetattr_t;
111 
112 typedef struct dlmgmt_door_writeconf_s {
113 	int		ld_cmd;
114 	dladm_conf_t	ld_conf;
115 } dlmgmt_door_writeconf_t;
116 
117 typedef struct dlmgmt_door_removeconf_s {
118 	int		ld_cmd;
119 	datalink_id_t	ld_linkid;
120 } dlmgmt_door_removeconf_t;
121 
122 typedef struct dlmgmt_door_destroyconf_s {
123 	int		ld_cmd;
124 	dladm_conf_t	ld_conf;
125 } dlmgmt_door_destroyconf_t;
126 
127 typedef struct dlmgmt_door_readconf_s {
128 	int		ld_cmd;
129 	datalink_id_t	ld_linkid;
130 } dlmgmt_door_readconf_t;
131 
132 typedef struct dlmgmt_door_getattr_s {
133 	int		ld_cmd;
134 	dladm_conf_t	ld_conf;
135 	char		ld_attr[MAXLINKATTRLEN];
136 } dlmgmt_door_getattr_t;
137 
138 typedef struct dlmgmt_handle_retval_s {
139 	uint_t			lr_err;
140 	dladm_conf_t		lr_conf;
141 } dlmgmt_createconf_retval_t, dlmgmt_readconf_retval_t;
142 
143 typedef struct dlmgmt_retval_s	dlmgmt_remapid_retval_t,
144 				dlmgmt_upid_retval_t,
145 				dlmgmt_destroyid_retval_t,
146 				dlmgmt_setattr_retval_t,
147 				dlmgmt_unsetattr_retval_t,
148 				dlmgmt_writeconf_retval_t,
149 				dlmgmt_removeconf_retval_t,
150 				dlmgmt_destroyconf_retval_t;
151 
152 typedef struct dlmgmt_linkid_retval_s	dlmgmt_createid_retval_t;
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 #endif /* _LIBDLMGMT_H */
159