librpc: further fixes for witness.idl.
[kai/samba-autobuild/.git] / librpc / idl / witness.idl
1 #include "idl_types.h"
2
3 import "misc.idl";
4
5 [
6   uuid("ccd8c074-d0e5-4a40-92b4-d074faa6ba28"),
7   version(1.1),
8   pointer_default(unique),
9   helpstring("SMB Witness Service"),
10   endpoint("ncacn_ip_tcp:")
11 ]
12 interface witness
13 {
14         typedef [v1_enum] enum {
15                 WITNESS_V1 = 0x00010001,
16                 WITNESS_V2 = 0x00020000
17         } witness_version;
18
19         /*****************/
20         /* Function 0x00 */
21
22         typedef [enum16bit] enum {
23                 WITNESS_STATE_UNKNOWN     = 0x00,
24                 WITNESS_STATE_AVAILABLE   = 0x01,
25                 WITNESS_STATE_UNAVAILABLE = 0xff
26         } witness_interfaceInfo_state;
27
28         typedef [bitmap32bit] bitmap {
29                 WITNESS_INFO_IPv4_VALID = 0x01,
30                 WITNESS_INFO_IPv6_VALID = 0x02,
31                 WITNESS_INFO_WITNESS_IF = 0x04
32         } witness_interfaceInfo_flags;
33
34         typedef struct {
35                 [charset(UTF16),to_null] uint16 group_name[260];
36                 witness_version version;
37                 witness_interfaceInfo_state state;
38                 [flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
39                 [flag(NDR_BIG_ENDIAN)] ipv6address ipv6;
40                 witness_interfaceInfo_flags flags;
41         } witness_interfaceInfo;
42
43         typedef struct {
44                 uint32 num_interfaces;
45                 [size_is(num_interfaces)] witness_interfaceInfo *interfaces;
46         } witness_interfaceList;
47
48         WERROR witness_GetInterfaceList(
49                 [out] witness_interfaceList **interface_list
50                 );
51
52         /*****************/
53         /* Function 0x01 */
54
55         WERROR witness_Register(
56                 [out,ref] policy_handle *context_handle,
57                 [in] witness_version version,
58                 [in,unique,string,charset(UTF16)] uint16 *net_name,
59                 [in,unique,string,charset(UTF16)] uint16 *ip_address,
60                 [in,unique,string,charset(UTF16)] uint16 *client_computer_name
61                 );
62
63         /*****************/
64         /* Function 0x02 */
65
66         WERROR witness_UnRegister(
67                 [in] policy_handle context_handle
68                 );
69
70         /*****************/
71         /* Function 0x03 */
72
73         typedef [v1_enum] enum {
74                 WITNESS_NOTIFY_RESOURCE_CHANGE = 1,
75                 WITNESS_NOTIFY_CLIENT_MOVE     = 2,
76                 WITNESS_NOTIFY_SHARE_MOVE      = 3,
77                 WITNESS_NOTIFY_IP_CHANGE       = 4
78         } witness_notifyResponse_type;
79
80         typedef [v1_enum] enum {
81                 WITNESS_RESOURCE_STATE_UNKNOWN     = 0x00,
82                 WITNESS_RESOURCE_STATE_AVAILABLE   = 0x01,
83                 WITNESS_RESOURCE_STATE_UNAVAILABLE = 0xff
84         } witness_ResourceChange_type;
85
86         typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize,public] struct {
87                 [value(ndr_size_witness_ResourceChange(r,ndr->flags))] uint32 length;
88                 witness_ResourceChange_type type;
89                 nstring name;
90         } witness_ResourceChange;
91
92         typedef [bitmap32bit] bitmap {
93                 WITNESS_IPADDR_V4      = 0x01,
94                 WITNESS_IPADDR_V6      = 0x02,
95                 WITNESS_IPADDR_ONLINE  = 0x08,
96                 WITNESS_IPADDR_OFFLINE = 0x10
97         } witness_IPaddrInfo_flags;
98
99         typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize] struct {
100                 witness_IPaddrInfo_flags flags;
101                 ipv4address ipv4;
102                 ipv6address ipv6;
103         } witness_IPaddrInfo;
104
105         typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
106                 [value(r->num*ndr_size_witness_IPaddrInfo(r->addr, ndr->flags))] uint32 length;
107                 [value(0)] uint32 reserved;
108                 uint32 num;
109                 witness_IPaddrInfo addr[num];
110         } witness_IPaddrInfoList;
111
112         typedef [public,switch_type(witness_notifyResponse_type),nodiscriminant, flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] union {
113                 [case(WITNESS_NOTIFY_RESOURCE_CHANGE)] witness_ResourceChange resource_change;
114                 [case(WITNESS_NOTIFY_CLIENT_MOVE)]     witness_IPaddrInfoList client_move;
115                 [case(WITNESS_NOTIFY_SHARE_MOVE)]      witness_IPaddrInfoList share_move;
116                 [case(WITNESS_NOTIFY_IP_CHANGE)]       witness_IPaddrInfoList ip_change;
117         } witness_notifyResponse_message;
118
119         typedef [flag(NDR_PAHEX)] struct {
120                 witness_notifyResponse_type type;
121                 [value(messages->length)] uint32 length;
122                 uint32 num;
123                 /* [switch_is(type), size_is(num)] witness_notifyResponse_message *messages; */
124                 /* [size_is(length)] uint8 *messages; */
125                 [subcontext(4), subcontext_size(length), flag(NDR_REMAINING)] DATA_BLOB *messages;
126         } witness_notifyResponse;
127
128         WERROR witness_AsyncNotify(
129                 [in] policy_handle context_handle,
130                 [out] witness_notifyResponse **response
131                 );
132
133         /*****************/
134         /* Function 0x04 */
135
136         typedef [bitmap32bit] bitmap {
137                 WITNESS_REGISTER_NONE            = 0x00,
138                 WITNESS_REGISTER_IP_NOTIFICATION = 0x01
139         } witness_RegisterEx_flags;
140
141         WERROR witness_RegisterEx(
142                 [out,ref] policy_handle *context_handle,
143                 [in] witness_version version,
144                 [in,unique,string,charset(UTF16)] uint16 *net_name,
145                 [in,unique,string,charset(UTF16)] uint16 *share_name,
146                 [in,unique,string,charset(UTF16)] uint16 *ip_address,
147                 [in,unique,string,charset(UTF16)] uint16 *client_computer_name,
148                 [in] witness_RegisterEx_flags flags,
149                 [in] uint32 timeout
150                 );
151 }