xref: /titanic_41/usr/src/lib/libdladm/common/libdlmgmt.h (revision 66ea84940ca8687745ad2a165ef9bf49ec13996f)
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 #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 
62 typedef struct dlmgmt_door_createid_s {
63 	int			ld_cmd;
64 	char			ld_link[MAXLINKNAMELEN];
65 	datalink_class_t	ld_class;
66 	uint32_t		ld_media;
67 	boolean_t		ld_prefix;
68 	uint32_t		ld_flags;
69 } dlmgmt_door_createid_t;
70 
71 typedef struct dlmgmt_door_destroyid_s {
72 	int		ld_cmd;
73 	datalink_id_t	ld_linkid;
74 	uint32_t	ld_flags;
75 } dlmgmt_door_destroyid_t;
76 
77 typedef struct dlmgmt_door_remapid_s {
78 	int		ld_cmd;
79 	datalink_id_t	ld_linkid;
80 	char		ld_link[MAXLINKNAMELEN];
81 } dlmgmt_door_remapid_t;
82 
83 typedef struct dlmgmt_door_upid_s {
84 	int		ld_cmd;
85 	datalink_id_t	ld_linkid;
86 } dlmgmt_door_upid_t;
87 
88 typedef struct dlmgmt_door_createconf_s {
89 	int			ld_cmd;
90 	char			ld_link[MAXLINKNAMELEN];
91 	datalink_id_t		ld_linkid;
92 	datalink_class_t	ld_class;
93 	uint32_t		ld_media;
94 } dlmgmt_door_createconf_t;
95 
96 typedef struct dlmgmt_door_setattr_s {
97 	int			ld_cmd;
98 	dladm_conf_t		ld_conf;
99 	char			ld_attr[MAXLINKATTRLEN];
100 	size_t			ld_attrsz;
101 	dladm_datatype_t	ld_type;
102 	char			ld_attrval[MAXLINKATTRVALLEN];
103 } dlmgmt_door_setattr_t;
104 
105 typedef struct dlmgmt_door_unsetattr_s {
106 	int		ld_cmd;
107 	dladm_conf_t	ld_conf;
108 	char		ld_attr[MAXLINKATTRLEN];
109 } dlmgmt_door_unsetattr_t;
110 
111 typedef struct dlmgmt_door_writeconf_s {
112 	int		ld_cmd;
113 	dladm_conf_t	ld_conf;
114 } dlmgmt_door_writeconf_t;
115 
116 typedef struct dlmgmt_door_removeconf_s {
117 	int		ld_cmd;
118 	datalink_id_t	ld_linkid;
119 } dlmgmt_door_removeconf_t;
120 
121 typedef struct dlmgmt_door_destroyconf_s {
122 	int		ld_cmd;
123 	dladm_conf_t	ld_conf;
124 } dlmgmt_door_destroyconf_t;
125 
126 typedef struct dlmgmt_door_readconf_s {
127 	int		ld_cmd;
128 	datalink_id_t	ld_linkid;
129 } dlmgmt_door_readconf_t;
130 
131 typedef struct dlmgmt_door_getattr_s {
132 	int		ld_cmd;
133 	dladm_conf_t	ld_conf;
134 	char		ld_attr[MAXLINKATTRLEN];
135 } dlmgmt_door_getattr_t;
136 
137 typedef struct dlmgmt_handle_retval_s {
138 	uint_t			lr_err;
139 	dladm_conf_t		lr_conf;
140 } dlmgmt_createconf_retval_t, dlmgmt_readconf_retval_t;
141 
142 typedef struct dlmgmt_door_linkprop_getnext_s {
143 	int			ld_cmd;
144 	dladm_conf_t		ld_conf;
145 	char			ld_last_attr[MAXLINKATTRLEN];
146 } dlmgmt_door_linkprop_getnext_t;
147 
148 typedef struct dlmgmt_linkprop_getnext_retval_s {
149 	uint_t			lr_err;
150 	char			lr_attr[MAXLINKATTRLEN];
151 	uint_t			lr_type;
152 	uint_t			lr_attrsz;
153 	char			lr_attrval[MAXLINKATTRVALLEN];
154 } dlmgmt_linkprop_getnext_retval_t;
155 
156 typedef struct dlmgmt_retval_s	dlmgmt_remapid_retval_t,
157 				dlmgmt_upid_retval_t,
158 				dlmgmt_destroyid_retval_t,
159 				dlmgmt_setattr_retval_t,
160 				dlmgmt_unsetattr_retval_t,
161 				dlmgmt_writeconf_retval_t,
162 				dlmgmt_removeconf_retval_t,
163 				dlmgmt_destroyconf_retval_t;
164 
165 typedef struct dlmgmt_linkid_retval_s	dlmgmt_createid_retval_t;
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif /* _LIBDLMGMT_H */
172