xref: /titanic_44/usr/src/lib/libdladm/common/libdlmgmt.h (revision 98157a7002f4f2cf7978f3084ca5577f0a1d72b2)
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[1];
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 union dlmgmt_door_arg_s {
139 	int				ld_cmd;
140 	dlmgmt_upcall_arg_create_t	kcreate;
141 	dlmgmt_upcall_arg_destroy_t	kdestroy;
142 	dlmgmt_upcall_arg_getattr_t	kgetattr;
143 	dlmgmt_door_getlinkid_t		getlinkid;
144 	dlmgmt_door_getnext_t		getnext;
145 	dlmgmt_door_createid_t		createid;
146 	dlmgmt_door_destroyid_t		destroyid;
147 	dlmgmt_door_remapid_t		remapid;
148 	dlmgmt_door_upid_t		upid;
149 	dlmgmt_door_createconf_t	createconf;
150 	dlmgmt_door_getname_t		getname;
151 	dlmgmt_door_getattr_t		getattr;
152 	dlmgmt_door_setattr_t		setattr;
153 	dlmgmt_door_writeconf_t		writeconf;
154 	dlmgmt_door_removeconf_t	removeconf;
155 	dlmgmt_door_destroyconf_t	destroyconf;
156 	dlmgmt_door_readconf_t		readconf;
157 } dlmgmt_door_arg_t;
158 
159 typedef struct dlmgmt_handle_retval_s {
160 	uint_t			lr_err;
161 	dladm_conf_t		lr_conf;
162 } dlmgmt_createconf_retval_t, dlmgmt_readconf_retval_t;
163 
164 typedef struct dlmgmt_null_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 
173 typedef struct dlmgmt_linkid_retval_s	dlmgmt_createid_retval_t;
174 
175 typedef union dlmgmt_retval {
176 	uint_t				lr_err; /* return error code */
177 	dlmgmt_create_retval_t		kcreate;
178 	dlmgmt_destroy_retval_t		kdestroy;
179 	dlmgmt_getattr_retval_t		getattr;
180 	dlmgmt_getname_retval_t		getname;
181 	dlmgmt_getlinkid_retval_t	getlinkid;
182 	dlmgmt_getnext_retval_t		getnext;
183 	dlmgmt_createid_retval_t	createid;
184 	dlmgmt_destroyid_retval_t	destroyid;
185 	dlmgmt_remapid_retval_t		remapid;
186 	dlmgmt_upid_retval_t		upid;
187 	dlmgmt_createconf_retval_t	createconf;
188 	dlmgmt_readconf_retval_t	readconf;
189 	dlmgmt_setattr_retval_t		setattr;
190 	dlmgmt_writeconf_retval_t	writeconf;
191 	dlmgmt_removeconf_retval_t	removeconf;
192 	dlmgmt_destroyconf_retval_t	destroyconf;
193 } dlmgmt_retval_t;
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #endif /* _LIBDLMGMT_H */
200