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 /*
23 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
24 */
25
26 /*
27 * SRVSVC - Server Service (partial)
28 *
29 * This module needs only NetShareEnum (levels 0, 1)
30 * and NetServerGetInfo (levels 100, 101)
31 */
32
33 #include <libmlrpc/ndrtypes.ndl>
34
35 /*
36 * SRVSVC - Server Service
37 */
38
39 #define SRVSVC_OPNUM_NetShareEnum 0x0f
40 #define SRVSVC_OPNUM_NetServerGetInfo 0x15
41
42 /*
43 * SRVSVC NetShareEnum (
44 * IN LPTSTR servername,
45 * IN DWORD level;
46 * OUT union switch(level) {
47 * case 0: struct {
48 * DWORD entriesread;
49 * [size_is(entriesread)]
50 * _SHARE_INFO_0 *entries;
51 * } *bufptr0;
52 * case 1: struct {
53 * DWORD entriesread;
54 * [size_is(entriesread)]
55 * _SHARE_INFO_1 *entries;
56 * } *bufptr1;
57 * ...
58 * } bufptr,
59 * IN DWORD prefmaxlen,
60 * OUT DWORD totalentries,
61 * IN OUT DWORD ?* resume_handle,
62 * OUT DWORD status
63 * )
64 */
65
66 struct mslm_NetShareInfo_0 {
67 LPTSTR shi0_netname;
68 };
69 struct mslm_NetShareInfo_0_result {
70 DWORD entriesread;
71 SIZE_IS(entriesread)
72 struct mslm_NetShareInfo_0 *entries;
73 };
74
75 struct mslm_NetShareInfo_1 {
76 LPTSTR shi1_netname;
77 DWORD shi1_type; /* type of resource such as IPC$ */
78 LPTSTR shi1_comment;
79 };
80 struct mslm_NetShareInfo_1_result {
81 DWORD entriesread;
82 SIZE_IS(entriesread)
83 struct mslm_NetShareInfo_1 *entries;
84 };
85
86 union mslm_NetShareEnum_ru {
87 CASE(0) struct mslm_NetShareInfo_0_result *bufptr0;
88 CASE(1) struct mslm_NetShareInfo_1_result *bufptr1;
89 DEFAULT char *nullptr;
90 };
91 struct mslm_NetShareEnum_result {
92 DWORD level;
93 SWITCH(level)
94 union mslm_NetShareEnum_ru ru;
95 };
96
97
98 OPERATION(SRVSVC_OPNUM_NetShareEnum)
99 struct mslm_NetShareEnum {
100 IN LPTSTR servername;
101 INOUT DWORD level;
102 INOUT struct mslm_NetShareEnum_result result;
103 IN DWORD prefmaxlen;
104 OUT DWORD totalentries;
105 INOUT DWORD *resume_handle;
106 OUT DWORD status;
107 };
108
109
110 /*
111 * SRVSVC NetServerGetInfo (
112 * IN LPTSTR servername,
113 * IN DWORD level,
114 * OUT union switch(level) {
115 * case 100: _SERVER_INFO_100 * p100;
116 * case 101: _SERVER_INFO_101 * p101;
117 * case 102: _SERVER_INFO_102 * p102;
118 * } bufptr,
119 * OUT DWORD status
120 * )
121 */
122
123 /* for svX_platform (note: decimal!) */
124 #define SV_PLATFORM_ID_DOS 300
125 #define SV_PLATFORM_ID_OS2 400
126 #define SV_PLATFORM_ID_NT 500
127 #define SV_PLATFORM_ID_OSF 600
128 #define SV_PLATFORM_ID_VMS 700
129
130 struct mslm_SERVER_INFO_100 {
131 DWORD sv100_platform_id;
132 LPTSTR sv100_name;
133 };
134
135 struct mslm_SERVER_INFO_101 {
136 DWORD sv101_platform_id;
137 LPTSTR sv101_name;
138 DWORD sv101_version_major;
139 DWORD sv101_version_minor;
140 DWORD sv101_type;
141 LPTSTR sv101_comment;
142 };
143
144 union mslm_NetServerGetInfo_ru {
145 CASE(100) struct mslm_SERVER_INFO_100 *info100;
146 CASE(101) struct mslm_SERVER_INFO_101 *info101;
147 DEFAULT char *nullptr;
148 };
149
150 struct mslm_NetServerGetInfo_result {
151 DWORD level;
152 SWITCH(level)
153 union mslm_NetServerGetInfo_ru ru;
154 };
155
156
157 OPERATION(SRVSVC_OPNUM_NetServerGetInfo)
158 struct mslm_NetServerGetInfo {
159 IN LPTSTR servername;
160 IN DWORD level;
161 OUT struct mslm_NetServerGetInfo_result result;
162 OUT DWORD status;
163 };
164
165
166 /*
167 * The SRVSVC interface
168 */
169 INTERFACE(0)
170 union srvsvc_interface {
171 CASE(SRVSVC_OPNUM_NetShareEnum)
172 struct mslm_NetShareEnum NetShareEnum;
173 CASE(SRVSVC_OPNUM_NetServerGetInfo)
174 struct mslm_NetServerGetInfo NetServerGetInfo;
175 };
176 typedef union srvsvc_interface srvsvc_interface_t;
177 EXTERNTYPEINFO(srvsvc_interface)