xref: /titanic_52/usr/src/lib/libdladm/common/libdlmgmt.h (revision 69112edd987c28fa551d4f8d9362a84a45365f17)
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 2009 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 #include <sys/types.h>
35 #include <libdladm.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * datalink management related macros, structures.
43  */
44 
45 /*
46  * Door call commands.
47  */
48 #define	DLMGMT_CMD_CREATE_LINKID	(DLMGMT_CMD_BASE + 0)
49 #define	DLMGMT_CMD_DESTROY_LINKID	(DLMGMT_CMD_BASE + 1)
50 #define	DLMGMT_CMD_REMAP_LINKID		(DLMGMT_CMD_BASE + 2)
51 #define	DLMGMT_CMD_CREATECONF		(DLMGMT_CMD_BASE + 3)
52 #define	DLMGMT_CMD_READCONF		(DLMGMT_CMD_BASE + 4)
53 #define	DLMGMT_CMD_WRITECONF		(DLMGMT_CMD_BASE + 5)
54 #define	DLMGMT_CMD_UP_LINKID		(DLMGMT_CMD_BASE + 6)
55 #define	DLMGMT_CMD_SETATTR		(DLMGMT_CMD_BASE + 7)
56 #define	DLMGMT_CMD_UNSETATTR		(DLMGMT_CMD_BASE + 8)
57 #define	DLMGMT_CMD_REMOVECONF		(DLMGMT_CMD_BASE + 9)
58 #define	DLMGMT_CMD_DESTROYCONF		(DLMGMT_CMD_BASE + 10)
59 #define	DLMGMT_CMD_GETATTR		(DLMGMT_CMD_BASE + 11)
60 #define	DLMGMT_CMD_LINKPROP_GETNEXT	(DLMGMT_CMD_BASE + 12)
61 #define	DLMGMT_CMD_ZONEBOOT		(DLMGMT_CMD_BASE + 13)
62 #define	DLMGMT_CMD_ZONEHALT		(DLMGMT_CMD_BASE + 14)
63 
64 typedef struct dlmgmt_door_createid_s {
65 	int			ld_cmd;
66 	char			ld_link[MAXLINKNAMELEN];
67 	datalink_class_t	ld_class;
68 	uint32_t		ld_media;
69 	boolean_t		ld_prefix;
70 	uint32_t		ld_flags;
71 } dlmgmt_door_createid_t;
72 
73 typedef struct dlmgmt_door_destroyid_s {
74 	int		ld_cmd;
75 	datalink_id_t	ld_linkid;
76 	uint32_t	ld_flags;
77 } dlmgmt_door_destroyid_t;
78 
79 typedef struct dlmgmt_door_remapid_s {
80 	int		ld_cmd;
81 	datalink_id_t	ld_linkid;
82 	char		ld_link[MAXLINKNAMELEN];
83 } dlmgmt_door_remapid_t;
84 
85 typedef struct dlmgmt_door_upid_s {
86 	int		ld_cmd;
87 	datalink_id_t	ld_linkid;
88 } dlmgmt_door_upid_t;
89 
90 typedef struct dlmgmt_door_createconf_s {
91 	int			ld_cmd;
92 	char			ld_link[MAXLINKNAMELEN];
93 	datalink_id_t		ld_linkid;
94 	datalink_class_t	ld_class;
95 	uint32_t		ld_media;
96 } dlmgmt_door_createconf_t;
97 
98 typedef struct dlmgmt_door_setattr_s {
99 	int			ld_cmd;
100 	dladm_conf_t		ld_conf;
101 	char			ld_attr[MAXLINKATTRLEN];
102 	size_t			ld_attrsz;
103 	dladm_datatype_t	ld_type;
104 	char			ld_attrval[MAXLINKATTRVALLEN];
105 } dlmgmt_door_setattr_t;
106 
107 typedef struct dlmgmt_door_unsetattr_s {
108 	int		ld_cmd;
109 	dladm_conf_t	ld_conf;
110 	char		ld_attr[MAXLINKATTRLEN];
111 } dlmgmt_door_unsetattr_t;
112 
113 typedef struct dlmgmt_door_writeconf_s {
114 	int		ld_cmd;
115 	dladm_conf_t	ld_conf;
116 } dlmgmt_door_writeconf_t;
117 
118 typedef struct dlmgmt_door_removeconf_s {
119 	int		ld_cmd;
120 	datalink_id_t	ld_linkid;
121 } dlmgmt_door_removeconf_t;
122 
123 typedef struct dlmgmt_door_destroyconf_s {
124 	int		ld_cmd;
125 	dladm_conf_t	ld_conf;
126 } dlmgmt_door_destroyconf_t;
127 
128 typedef struct dlmgmt_door_readconf_s {
129 	int		ld_cmd;
130 	datalink_id_t	ld_linkid;
131 } dlmgmt_door_readconf_t;
132 
133 typedef struct dlmgmt_door_getattr_s {
134 	int		ld_cmd;
135 	dladm_conf_t	ld_conf;
136 	char		ld_attr[MAXLINKATTRLEN];
137 } dlmgmt_door_getattr_t;
138 
139 typedef struct dlmgmt_handle_retval_s {
140 	uint_t			lr_err;
141 	dladm_conf_t		lr_conf;
142 } dlmgmt_createconf_retval_t, dlmgmt_readconf_retval_t;
143 
144 typedef struct dlmgmt_door_linkprop_getnext_s {
145 	int			ld_cmd;
146 	dladm_conf_t		ld_conf;
147 	char			ld_last_attr[MAXLINKATTRLEN];
148 } dlmgmt_door_linkprop_getnext_t;
149 
150 typedef struct dlmgmt_linkprop_getnext_retval_s {
151 	uint_t			lr_err;
152 	char			lr_attr[MAXLINKATTRLEN];
153 	uint_t			lr_type;
154 	uint_t			lr_attrsz;
155 	char			lr_attrval[MAXLINKATTRVALLEN];
156 } dlmgmt_linkprop_getnext_retval_t;
157 
158 typedef struct dlmgmt_door_zone_s {
159 	int			ld_cmd;
160 	zoneid_t		ld_zoneid;
161 } dlmgmt_door_zoneboot_t, dlmgmt_door_zonehalt_t;
162 
163 typedef struct dlmgmt_retval_s	dlmgmt_remapid_retval_t,
164 				dlmgmt_upid_retval_t,
165 				dlmgmt_destroyid_retval_t,
166 				dlmgmt_setattr_retval_t,
167 				dlmgmt_unsetattr_retval_t,
168 				dlmgmt_writeconf_retval_t,
169 				dlmgmt_removeconf_retval_t,
170 				dlmgmt_destroyconf_retval_t,
171 				dlmgmt_zoneboot_retval_t,
172 				dlmgmt_zonehalt_retval_t;
173 
174 typedef struct dlmgmt_linkid_retval_s	dlmgmt_createid_retval_t;
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #endif /* _LIBDLMGMT_H */
181