xref: /titanic_44/usr/src/lib/libdladm/common/libdlmgmt.h (revision 56b2bdd1f04d465cfe4a95b88ae5cba5884154e4)
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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 /*
26  * This file includes structures, macros used to communicate with linkmgmt
27  * daemon.
28  */
29 
30 #ifndef _LIBDLMGMT_H
31 #define	_LIBDLMGMT_H
32 
33 #include <sys/types.h>
34 #include <libdladm.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * datalink management related macros, structures.
42  */
43 
44 /*
45  * Door call commands.
46  */
47 #define	DLMGMT_CMD_CREATE_LINKID	(DLMGMT_CMD_BASE + 0)
48 #define	DLMGMT_CMD_DESTROY_LINKID	(DLMGMT_CMD_BASE + 1)
49 #define	DLMGMT_CMD_REMAP_LINKID		(DLMGMT_CMD_BASE + 2)
50 #define	DLMGMT_CMD_CREATECONF		(DLMGMT_CMD_BASE + 3)
51 #define	DLMGMT_CMD_OPENCONF		(DLMGMT_CMD_BASE + 4)
52 #define	DLMGMT_CMD_WRITECONF		(DLMGMT_CMD_BASE + 5)
53 #define	DLMGMT_CMD_UP_LINKID		(DLMGMT_CMD_BASE + 6)
54 #define	DLMGMT_CMD_SETATTR		(DLMGMT_CMD_BASE + 7)
55 #define	DLMGMT_CMD_UNSETATTR		(DLMGMT_CMD_BASE + 8)
56 #define	DLMGMT_CMD_REMOVECONF		(DLMGMT_CMD_BASE + 9)
57 #define	DLMGMT_CMD_DESTROYCONF		(DLMGMT_CMD_BASE + 10)
58 #define	DLMGMT_CMD_GETATTR		(DLMGMT_CMD_BASE + 11)
59 #define	DLMGMT_CMD_GETCONFSNAPSHOT	(DLMGMT_CMD_BASE + 12)
60 #define	DLMGMT_CMD_ZONEBOOT		(DLMGMT_CMD_BASE + 13)
61 #define	DLMGMT_CMD_ZONEHALT		(DLMGMT_CMD_BASE + 14)
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 	int			ld_confid;
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 	int		ld_confid;
109 	char		ld_attr[MAXLINKATTRLEN];
110 } dlmgmt_door_unsetattr_t;
111 
112 typedef struct dlmgmt_door_writeconf_s {
113 	int		ld_cmd;
114 	int		ld_confid;
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 	int		ld_confid;
125 } dlmgmt_door_destroyconf_t;
126 
127 typedef struct dlmgmt_door_openconf_s {
128 	int		ld_cmd;
129 	datalink_id_t	ld_linkid;
130 } dlmgmt_door_openconf_t;
131 
132 typedef struct dlmgmt_door_getconfsnapshot_s {
133 	int		ld_cmd;
134 	datalink_id_t	ld_linkid;
135 } dlmgmt_door_getconfsnapshot_t;
136 
137 typedef struct dlmgmt_door_getattr_s {
138 	int		ld_cmd;
139 	int		ld_confid;
140 	char		ld_attr[MAXLINKATTRLEN];
141 } dlmgmt_door_getattr_t;
142 
143 typedef struct dlmgmt_createconf_retval_s {
144 	uint_t			lr_err;
145 	int			lr_confid;
146 } dlmgmt_createconf_retval_t;
147 
148 typedef struct dlmgmt_openconf_retval_s {
149 	uint_t		lr_err;
150 	int		lr_confid;
151 } dlmgmt_openconf_retval_t;
152 
153 typedef struct dlmgmt_getconfsnapshot_retval_s {
154 	uint_t		lr_err;
155 	size_t		lr_nvlsz;
156 	/* buffer for nvl */
157 } dlmgmt_getconfsnapshot_retval_t;
158 
159 typedef struct dlmgmt_door_zone_s {
160 	int			ld_cmd;
161 	zoneid_t		ld_zoneid;
162 } dlmgmt_door_zoneboot_t, dlmgmt_door_zonehalt_t;
163 
164 typedef struct dlmgmt_retval_s	dlmgmt_remapid_retval_t,
165 				dlmgmt_upid_retval_t,
166 				dlmgmt_destroyid_retval_t,
167 				dlmgmt_setattr_retval_t,
168 				dlmgmt_unsetattr_retval_t,
169 				dlmgmt_writeconf_retval_t,
170 				dlmgmt_removeconf_retval_t,
171 				dlmgmt_destroyconf_retval_t,
172 				dlmgmt_zoneboot_retval_t,
173 				dlmgmt_zonehalt_retval_t;
174 
175 typedef struct dlmgmt_linkid_retval_s	dlmgmt_createid_retval_t;
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif /* _LIBDLMGMT_H */
182