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 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  26  */
  27 
  28 #ifndef _NETDFS_NDL_
  29 #define _NETDFS_NDL_
  30 
  31 /*
  32  * NT Distributed File Service (NETDFS) RPC interface definition.
  33  */
  34 
  35 #include <libmlrpc/ndrtypes.ndl>
  36 
  37 
  38 #define NETDFS_ABSTRACT_UUID            "4fc742e0-4a10-11cf-8273-00aa004ae673"
  39 #define NETDFS_ABSTRACT_VERS            3
  40 
  41 #define NETDFS_TRANSFER_UUID            "8a885d04-1ceb-11c9-9fe8-08002b104860"
  42 #define NETDFS_TRANSFER_VERS            2
  43 
  44 #define NETDFS_OPNUM_GETVER             0x00
  45 #define NETDFS_OPNUM_ADD                0x01
  46 #define NETDFS_OPNUM_REMOVE             0x02
  47 #define NETDFS_OPNUM_SETINFO            0x03
  48 #define NETDFS_OPNUM_GETINFO            0x04
  49 #define NETDFS_OPNUM_ENUM               0x05
  50 #define NETDFS_OPNUM_MOVE               0x06
  51 #define NETDFS_OPNUM_RENAME             0x07
  52 #define NETDFS_OPNUM_ADDSTDROOT         0x0c
  53 #define NETDFS_OPNUM_REMSTDROOT         0x0d
  54 #define NETDFS_OPNUM_ENUMEX             0x15
  55 
  56 #define DFS_MANAGER_VERSION_NT4         0x01
  57 #define DFS_MANAGER_VERSION_W2K         0x02
  58 #define DFS_MANAGER_VERSION_W2K3        0x04
  59 
  60 struct netdfs_uuid {
  61         DWORD data1;
  62         WORD data2;
  63         WORD data3;
  64         BYTE data4[8];
  65 };
  66 typedef struct netdfs_uuid netdfs_uuid_t;
  67 
  68 struct netdfs_storage_info {
  69         DWORD state;
  70         LPTSTR server;
  71         LPTSTR share;
  72 };
  73 typedef struct netdfs_storage_info netdfs_storage_info_t;
  74 
  75 
  76 struct netdfs_storage_info1 {
  77         DWORD state;
  78         LPTSTR server;
  79         LPTSTR share;
  80         DWORD p_class;
  81         WORD p_rank;
  82         WORD p_reserved;
  83 };
  84 typedef struct netdfs_storage_info1 netdfs_storage_info1_t;
  85 
  86 struct netdfs_info1 {
  87         LPTSTR entry_path;
  88 };
  89 typedef struct netdfs_info1 netdfs_info1_t;
  90 
  91 struct netdfs_info2 {
  92         LPTSTR entry_path;
  93         LPTSTR comment;
  94         DWORD state;
  95         DWORD n_store;
  96 };
  97 typedef struct netdfs_info2 netdfs_info2_t;
  98 
  99 struct netdfs_info3 {
 100         LPTSTR entry_path;
 101         LPTSTR comment;
 102         DWORD state;
 103         DWORD n_store;
 104   SIZE_IS(n_store)
 105         struct netdfs_storage_info *si;
 106 };
 107 typedef struct netdfs_info3 netdfs_info3_t;
 108 
 109 struct netdfs_info4 {
 110         LPTSTR entry_path;
 111         LPTSTR comment;
 112         DWORD state;
 113         DWORD timeout;
 114         netdfs_uuid_t guid;
 115         DWORD n_store;
 116   SIZE_IS(n_store)
 117         struct netdfs_storage_info *si;
 118 };
 119 typedef struct netdfs_info4 netdfs_info4_t;
 120 
 121 struct netdfs_info5 {
 122         LPTSTR entry_path;
 123         LPTSTR comment;
 124         DWORD state;
 125         DWORD timeout;
 126         netdfs_uuid_t guid;
 127         DWORD flags;
 128         DWORD metadata_sz;
 129         DWORD n_store;
 130 };
 131 typedef struct netdfs_info5 netdfs_info5_t;
 132 
 133 struct netdfs_info6 {
 134         LPTSTR entry_path;
 135         LPTSTR comment;
 136         DWORD state;
 137         DWORD timeout;
 138         netdfs_uuid_t guid;
 139         DWORD flags;
 140         DWORD metadata_sz;
 141         DWORD n_store;
 142   SIZE_IS(n_store)
 143         struct netdfs_storage_info1 *si;
 144 };
 145 typedef struct netdfs_info6 netdfs_info6_t;
 146 
 147 struct netdfs_info100 {
 148         LPTSTR comment;
 149 };
 150 typedef struct netdfs_info100 netdfs_info100_t;
 151 
 152 struct netdfs_info101 {
 153         DWORD state;
 154 };
 155 typedef struct netdfs_info101 netdfs_info101_t;
 156 
 157 
 158 struct netdfs_info102 {
 159         DWORD timeout;
 160 };
 161 typedef struct netdfs_info102 netdfs_info102_t;
 162 
 163 
 164 struct netdfs_info103 {
 165         DWORD property_flag_mask;
 166         DWORD property_flags;
 167 };
 168 typedef struct netdfs_info103 netdfs_info103_t;
 169 
 170 
 171 struct netdfs_info104 {
 172         DWORD priority_class;
 173         WORD priority_rank;
 174         WORD reserved;
 175 };
 176 typedef struct netdfs_info104 netdfs_info104_t;
 177 
 178 
 179 struct netdfs_info105 {
 180         LPTSTR comment;
 181         DWORD state;
 182         DWORD timeout;
 183         DWORD property_flag_mask;
 184         DWORD property_flags;
 185 };
 186 typedef struct netdfs_info105 netdfs_info105_t;
 187 
 188 
 189 struct netdfs_info106 {
 190         DWORD storage_state;
 191         DWORD priority_class;
 192         DWORD priority_rank;
 193 };
 194 
 195 
 196 struct netdfs_info200 {
 197         LPTSTR entry_path;
 198 };
 199 
 200 
 201 struct netdfs_info300 {
 202         DWORD flavor;
 203         LPTSTR dfsname;
 204 };
 205 typedef struct netdfs_info300 netdfs_info300_t;
 206 
 207 
 208 union netdfs_info_u {
 209         CASE(1) struct netdfs_info1 *info1;
 210         CASE(2) struct netdfs_info2 *info2;
 211         CASE(3) struct netdfs_info3 *info3;
 212         CASE(4) struct netdfs_info4 *info4;
 213         CASE(5) struct netdfs_info5 *info5;
 214         CASE(6) struct netdfs_info6 *info6;
 215         CASE(100) struct netdfs_info100 *info100;
 216         CASE(101) struct netdfs_info101 *info101;
 217         CASE(102) struct netdfs_info102 *info102;
 218         CASE(103) struct netdfs_info103 *info103;
 219         CASE(104) struct netdfs_info104 *info104;
 220         CASE(105) struct netdfs_info105 *info105;
 221         CASE(106) struct netdfs_info106 *info106;
 222         DEFAULT char *nullptr;
 223 };
 224 
 225 
 226 struct netdfs_info {
 227         DWORD level;
 228   SWITCH(level)
 229         union netdfs_info_u iu;
 230 };
 231 typedef struct netdfs_info netdfs_info_t;
 232 
 233 
 234 struct netdfs_array1 {
 235         DWORD count;
 236   SIZE_IS(count)
 237         struct netdfs_info1 *info1;
 238 };
 239 
 240 struct netdfs_array2 {
 241         DWORD count;
 242   SIZE_IS(count)
 243         struct netdfs_info2 *info2;
 244 };
 245 
 246 struct netdfs_array3 {
 247         DWORD count;
 248   SIZE_IS(count)
 249         struct netdfs_info3 *info3;
 250 };
 251 
 252 struct netdfs_array4 {
 253         DWORD count;
 254   SIZE_IS(count)
 255         struct netdfs_info4 *info4;
 256 };
 257 
 258 struct netdfs_array5 {
 259         DWORD count;
 260   SIZE_IS(count)
 261         struct netdfs_info5 *info5;
 262 };
 263 
 264 struct netdfs_array6 {
 265         DWORD count;
 266   SIZE_IS(count)
 267         struct netdfs_info6 *info6;
 268 };
 269 
 270 struct netdfs_array200 {
 271         DWORD count;
 272   SIZE_IS(count)
 273         struct netdfs_info200 *info200;
 274 };
 275 
 276 struct netdfs_array300 {
 277         DWORD count;
 278   SIZE_IS(count)
 279         struct netdfs_info300 *info300;
 280 };
 281 
 282 union netdfs_enum_info_u {
 283         CASE(1) struct netdfs_array1 *info1;
 284         CASE(2) struct netdfs_array2 *info2;
 285         CASE(3) struct netdfs_array3 *info3;
 286         CASE(4) struct netdfs_array4 *info4;
 287         CASE(5) struct netdfs_array5 *info5;
 288         CASE(6) struct netdfs_array6 *info6;
 289         CASE(200) struct netdfs_array200 *info200;
 290         CASE(300) struct netdfs_array300 *info300;
 291         DEFAULT char *nullptr;
 292 };
 293 
 294 
 295 struct netdfs_enum_info {
 296         DWORD level;
 297         DWORD switch_value;
 298   SWITCH(switch_value)
 299         union netdfs_enum_info_u iu;
 300 };
 301 
 302 
 303 /*
 304  ***********************************************************************
 305  * Return server version id
 306  ***********************************************************************
 307  */
 308 OPERATION(NETDFS_OPNUM_GETVER)
 309 struct netdfs_getver {
 310         OUT             DWORD version;
 311 };
 312 
 313 
 314 /*
 315  ***********************************************************************
 316  * Add a new volume or additional storage for an existing volume at
 317  * dfs_path.
 318  ***********************************************************************
 319  */
 320 OPERATION(NETDFS_OPNUM_ADD)
 321 struct netdfs_add {
 322         IN REFERENCE    LPTSTR dfs_path;
 323         IN REFERENCE    LPTSTR server;
 324         IN              LPTSTR share;
 325         IN              LPTSTR comment;
 326         IN              DWORD flags;
 327         OUT             DWORD status;
 328 };
 329 typedef struct netdfs_add netdfs_add_t;
 330 
 331 
 332 /*
 333  ***********************************************************************
 334  * Remove a volume or additional storage for volume from the DFS at
 335  * dfs_path. When applied to the last storage in a volume, removes
 336  * the volume from the DFS.
 337  ***********************************************************************
 338  */
 339 OPERATION(NETDFS_OPNUM_REMOVE)
 340 struct netdfs_remove {
 341         IN REFERENCE    LPTSTR dfs_path;
 342         IN              LPTSTR server;
 343         IN              LPTSTR share;
 344         OUT             DWORD status;
 345 };
 346 
 347 
 348 /*
 349  ***********************************************************************
 350  * Set information about the volume or storage. If the server and share
 351  * are specified, the information set is specific to that server and
 352  * share. Otherwise the information is specific to the volume as a whole.
 353  *
 354  * Valid levels are 100-102.
 355  ***********************************************************************
 356  */
 357 OPERATION(NETDFS_OPNUM_SETINFO)
 358 struct netdfs_setinfo {
 359         IN REFERENCE    LPTSTR dfs_path;
 360         IN              LPTSTR server;
 361         IN              LPTSTR share;
 362         IN              DWORD level;
 363         IN              struct netdfs_info info;
 364         OUT             DWORD status;
 365 };
 366 typedef struct netdfs_setinfo netdfs_setinfo_t;
 367 
 368 
 369 /*
 370  ***********************************************************************
 371  * Get information about the volume or storage. If the server and share
 372  * are specified, the information returned is specific to that server
 373  * and share. Otherwise the information is specific to the volume as a
 374  * whole.
 375  *
 376  * Valid levels are 1-4, 100-102.
 377  ***********************************************************************
 378  */
 379 OPERATION(NETDFS_OPNUM_GETINFO)
 380 struct netdfs_getinfo {
 381         IN REFERENCE    LPTSTR dfs_path;
 382         IN              LPTSTR server;
 383         IN              LPTSTR share;
 384         IN              DWORD level;
 385         OUT             struct netdfs_info info;
 386         OUT             DWORD status;
 387 };
 388 typedef struct netdfs_getinfo netdfs_getinfo_t;
 389 
 390 
 391 /*
 392  ***********************************************************************
 393  * Get information about all of the volumes in the DFS. dfs_path is
 394  * the "server" part of the UNC name used to refer to this particular
 395  * DFS.
 396  *
 397  * Valid levels are 1-3.
 398  ***********************************************************************
 399  */
 400 OPERATION(NETDFS_OPNUM_ENUM)
 401 struct netdfs_enum {
 402         IN              DWORD level;
 403         IN              DWORD pref_max_len;
 404         INOUT           struct netdfs_enum_info *info;
 405         INOUT           DWORD *resume_handle;
 406         OUT             DWORD status;
 407 };
 408 typedef struct netdfs_enum netdfs_enum_t;
 409 
 410 
 411 /*
 412  ***********************************************************************
 413  * Rename the current Win32 path in a DFS to a new Win32 path in the
 414  * same DFS.
 415  ***********************************************************************
 416  */
 417 OPERATION(NETDFS_OPNUM_RENAME)
 418 struct netdfs_rename {
 419         IN REFERENCE    LPTSTR dfs_path;
 420         IN REFERENCE    LPTSTR new_path;
 421         OUT             DWORD status;
 422 };
 423 
 424 
 425 /*
 426  ***********************************************************************
 427  * Move a DFS volume and all subordinate volumes from one place in the
 428  * DFS to another place in the DFS.
 429  ***********************************************************************
 430  */
 431 OPERATION(NETDFS_OPNUM_MOVE)
 432 struct netdfs_move {
 433         IN REFERENCE    LPTSTR dfs_path;
 434         IN REFERENCE    LPTSTR new_path;
 435         IN              DWORD flags;
 436         OUT             DWORD status;
 437 };
 438 
 439 
 440 /*
 441  ***********************************************************************
 442  * Add a DFS root share.
 443  ***********************************************************************
 444  */
 445 OPERATION(NETDFS_OPNUM_ADDSTDROOT)
 446 struct netdfs_addstdroot {
 447         IN REFERENCE    LPTSTR server;
 448         IN REFERENCE    LPTSTR share;
 449         IN REFERENCE    LPTSTR comment;
 450         IN              DWORD flags;
 451         OUT             DWORD status;
 452 };
 453 
 454 /*
 455  ***********************************************************************
 456  * Remove a DFS root share.
 457  ***********************************************************************
 458  */
 459 OPERATION(NETDFS_OPNUM_REMSTDROOT)
 460 struct netdfs_remstdroot {
 461         IN REFERENCE    LPTSTR server;
 462         IN REFERENCE    LPTSTR share;
 463         IN              DWORD flags;
 464         OUT             DWORD status;
 465 };
 466 
 467 
 468 /*
 469  ***********************************************************************
 470  * Get information about all of the volumes in the DFS. dfs_path is
 471  * the "server" part of the UNC name used to refer to this particular
 472  * DFS.
 473  *
 474  * Valid levels are 1-3.
 475  ***********************************************************************
 476  */
 477 OPERATION(NETDFS_OPNUM_ENUMEX)
 478 struct netdfs_enumex {
 479         IN REFERENCE    LPTSTR dfs_path;
 480         IN              DWORD level;
 481         IN              DWORD pref_max_len;
 482         INOUT           struct netdfs_enum_info *info;
 483         INOUT           DWORD *resume_handle;
 484         OUT             DWORD status;
 485 };
 486 
 487 
 488 /*
 489  ***********************************************************************
 490  * The NETDFS interface definiton.
 491  ***********************************************************************
 492  */
 493 INTERFACE(0)
 494 union netdfs_interface {
 495         CASE(NETDFS_OPNUM_GETVER)
 496                 struct netdfs_getver            netdfs_getver;
 497         CASE(NETDFS_OPNUM_ADD)
 498                 struct netdfs_add               netdfs_add;
 499         CASE(NETDFS_OPNUM_REMOVE)
 500                 struct netdfs_remove            netdfs_remove;
 501         CASE(NETDFS_OPNUM_SETINFO)
 502                 struct netdfs_setinfo           netdfs_setinfo;
 503         CASE(NETDFS_OPNUM_GETINFO)
 504                 struct netdfs_getinfo           netdfs_getinfo;
 505         CASE(NETDFS_OPNUM_ENUM)
 506                 struct netdfs_enum              netdfs_enum;
 507         CASE(NETDFS_OPNUM_MOVE)
 508                 struct netdfs_move              netdfs_move;
 509         CASE(NETDFS_OPNUM_RENAME)
 510                 struct netdfs_rename            netdfs_rename;
 511         CASE(NETDFS_OPNUM_ADDSTDROOT)
 512                 struct netdfs_addstdroot        netdfs_addstdroot;
 513         CASE(NETDFS_OPNUM_REMSTDROOT)
 514                 struct netdfs_remstdroot        netdfs_remstdroot;
 515         CASE(NETDFS_OPNUM_ENUMEX)
 516                 struct netdfs_enumex            netdfs_enumex;
 517 };
 518 typedef union netdfs_interface  netdfs_interface_t;
 519 EXTERNTYPEINFO(netdfs_interface)
 520 
 521 
 522 #endif /* _NETDFS_NDL_ */