e18c24a3cd11218ff79ad81856e86958e83860ec
[samba.git] / source / librpc / idl / epmapper.idl
1 #include "idl_types.h"
2
3 /*
4   endpoint mapper interface
5   Related links:
6         http://www.opengroup.org/onlinepubs/9629399/apdxl.htm : Details on towers
7 http://www.opengroup.org/onlinepubs/9629399/chap6.htm#tagcjh_11_02_03_01: binding strings
8
9 */
10
11 [
12  uuid("e1af8308-5d1f-11c9-91a4-08002b14a0fa"), 
13  version(3.0), 
14  endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", 
15                   "ncalrpc:[EPMAPPER]", "ncacn_unix_stream:[/tmp/epmapper]"),
16  helpstring("EndPoint Mapper"),
17  pointer_default(unique)
18 ]
19 interface epmapper
20 {
21
22         /*
23           note that the following IDL won't work in MIDL, and in fact
24           that the full towers/floors representation of epm cannot be
25           represented in MIDL at all. I decided to represent it using
26           the extended IDL syntax in pidl to make it easier to work
27           with.
28         */
29
30         const int EPMAPPER_STATUS_NO_MORE_ENTRIES = 0x16c9a0d6;
31         const int EPMAPPER_STATUS_NO_MEMORY = 0x16C9A012;
32         const int EPMAPPER_STATUS_OK = 0;
33
34
35         /* this guid indicates NDR encoding in a protocol tower */
36         const string NDR_GUID = "8a885d04-1ceb-11c9-9fe8-08002b104860";
37         const string NDR_GUID_VERSION = 2;
38
39         typedef struct {
40                 GUID uuid;
41                 uint16 version;
42         } epm_prot_uuid;
43
44         typedef enum {
45                 
46                 /* Level 4 and higher */
47                 EPM_PROTOCOL_DNET_NSP           = 0x04,
48                 EPM_PROTOCOL_OSI_TP4            = 0x05,
49                 EPM_PROTOCOL_OSI_CLNS           = 0x06,
50                 EPM_PROTOCOL_TCP                = 0x07,
51                 EPM_PROTOCOL_UDP                = 0x08,
52                 EPM_PROTOCOL_IP                 = 0x09,
53                 /* These 4 are protocol identifiers, always at level 3 or lower */
54                 EPM_PROTOCOL_NCADG                      = 0x0a, /* Connectionless RPC */
55                 EPM_PROTOCOL_NCACN                      = 0x0b,
56                 EPM_PROTOCOL_NCALRPC            = 0x0c, /* Local RPC */
57                 EPM_PROTOCOL_UUID                       = 0x0d,
58                 EPM_PROTOCOL_IPX                        = 0x0e,
59                 EPM_PROTOCOL_SMB                = 0x0f,
60                 EPM_PROTOCOL_PIPE               = 0x10,
61                 EPM_PROTOCOL_NETBIOS            = 0x11,
62                 EPM_PROTOCOL_NETBEUI            = 0x12,
63                 EPM_PROTOCOL_SPX                = 0x13,
64                 EPM_PROTOCOL_NB_IPX             = 0x14, /* NetBIOS over IPX */
65                 EPM_PROTOCOL_DSP                        = 0x16, /* AppleTalk Data Stream Protocol */
66                 EPM_PROTOCOL_DDP                    = 0x17, /* AppleTalk Data Datagram Protocol */
67                 EPM_PROTOCOL_APPLETALK          = 0x18, /* AppleTalk */
68                 EPM_PROTOCOL_VINES_SPP          = 0x1a, 
69                 EPM_PROTOCOL_VINES_IPC          = 0x1b, /* Inter Process Communication */
70                 EPM_PROTOCOL_STREETTALK         = 0x1c, /* Vines Streettalk */
71                 EPM_PROTOCOL_HTTP               = 0x1f,
72                 EPM_PROTOCOL_UNIX_DS            = 0x20, /* Unix domain socket */
73                 EPM_PROTOCOL_NULL                       = 0x21
74         } epm_protocols;
75
76         typedef [nodiscriminant] union {
77                 [case(EPM_PROTOCOL_UUID)] epm_prot_uuid uuid;
78                 [default]  [flag(NDR_REMAINING)] DATA_BLOB lhs_data;
79         } epm_protocol_info;
80
81         typedef struct {
82                 /*FIXME */
83         } epm_rhs_dnet_nsp;
84
85         typedef struct {
86                 /*FIXME*/
87         } epm_rhs_osi_tp4;
88
89         typedef struct {
90                 /*FIXME*/
91         } epm_rhs_osi_clns;
92         
93         typedef struct {
94                 uint16 port;
95         } epm_rhs_udp;
96
97         typedef struct {
98                 uint16 port;
99         } epm_rhs_tcp;
100
101         typedef struct {
102                 uint32 address;
103         } epm_rhs_ip;
104
105         typedef struct {
106                 uint16 minor_version;
107         } epm_rhs_ncadg;
108
109         typedef struct {
110                 uint16 minor_version;
111         } epm_rhs_ncacn;
112
113         typedef struct {
114                 uint16 unknown;
115         } epm_rhs_uuid;
116
117         typedef struct {
118                 /*FIXME */
119         } epm_rhs_ipx;
120
121         typedef struct {
122                 astring unc;
123         } epm_rhs_smb;
124
125         typedef struct {
126                 astring path;   
127         } epm_rhs_pipe;
128
129         typedef struct {
130                 astring name;
131         } epm_rhs_netbios;
132
133         typedef struct {
134         } epm_rhs_netbeui;
135
136         typedef struct {
137         } epm_rhs_spx;
138
139         typedef struct {
140         } epm_rhs_nb_ipx;
141
142         typedef struct {
143                 uint16 port;
144         } epm_rhs_http;
145
146         typedef struct {
147                 astring path;
148         } epm_rhs_unix_ds;
149
150         typedef struct {
151         } epm_rhs_null;
152
153         typedef struct {
154                 uint16 minor_version;
155         } epm_rhs_ncalrpc;
156
157         typedef struct {
158         } epm_rhs_appletalk;
159
160         typedef struct {
161         } epm_rhs_atalk_stream;
162
163         typedef struct {
164         } epm_rhs_atalk_datagram;
165
166         typedef struct {
167                 uint16 port;
168         } epm_rhs_vines_spp;
169
170         typedef struct {
171                 uint16 port;
172         } epm_rhs_vines_ipc;
173
174         typedef struct {
175                 astring streettalk;
176         } epm_rhs_streettalk;
177
178         typedef [flag(NDR_BIG_ENDIAN),nodiscriminant] union {
179                 [case(EPM_PROTOCOL_DNET_NSP)] epm_rhs_dnet_nsp dnet_nsp;
180                 [case(EPM_PROTOCOL_OSI_TP4)] epm_rhs_osi_tp4 osi_tp4;
181                 [case(EPM_PROTOCOL_OSI_CLNS)] epm_rhs_osi_clns osi_clns;
182                 [case(EPM_PROTOCOL_TCP)] epm_rhs_tcp tcp;
183                 [case(EPM_PROTOCOL_UDP)] epm_rhs_udp udp;
184                 [case(EPM_PROTOCOL_IP)] epm_rhs_ip ip;
185                 [case(EPM_PROTOCOL_NCADG)] epm_rhs_ncadg ncadg;
186                 [case(EPM_PROTOCOL_NCACN)] epm_rhs_ncacn ncacn;
187                 [case(EPM_PROTOCOL_NCALRPC)] epm_rhs_ncalrpc ncalrpc;
188                 [case(EPM_PROTOCOL_UUID)] epm_rhs_uuid uuid;
189                 [case(EPM_PROTOCOL_IPX)] epm_rhs_ipx ipx;
190                 [case(EPM_PROTOCOL_SMB)] epm_rhs_smb smb;
191                 [case(EPM_PROTOCOL_PIPE)] epm_rhs_pipe pipe;
192                 [case(EPM_PROTOCOL_NETBIOS)] epm_rhs_netbios netbios;
193                 [case(EPM_PROTOCOL_NETBEUI)] epm_rhs_netbeui netbeui;
194                 [case(EPM_PROTOCOL_SPX)] epm_rhs_spx spx;
195                 [case(EPM_PROTOCOL_NB_IPX)] epm_rhs_nb_ipx nb_ipx;
196                 [case(EPM_PROTOCOL_DSP)] epm_rhs_atalk_stream atalk_stream;
197                 [case(EPM_PROTOCOL_DDP)] epm_rhs_atalk_datagram atalk_datagram;
198                 [case(EPM_PROTOCOL_APPLETALK)] epm_rhs_appletalk appletalk;
199                 [case(EPM_PROTOCOL_VINES_SPP)] epm_rhs_vines_spp vines_spp;
200                 [case(EPM_PROTOCOL_VINES_IPC)] epm_rhs_vines_ipc vines_ipc;
201                 [case(EPM_PROTOCOL_STREETTALK)] epm_rhs_streettalk streettalk;
202                 [case(EPM_PROTOCOL_HTTP)] epm_rhs_http http;
203                 [case(EPM_PROTOCOL_UNIX_DS)] epm_rhs_unix_ds unix_ds;
204                 [case(EPM_PROTOCOL_NULL)] epm_rhs_null null;
205                 [default]  [flag(NDR_REMAINING)] DATA_BLOB unknown;
206         } epm_rhs;
207
208         typedef struct {
209                 uint8  protocol;
210                 [switch_is(protocol)] epm_protocol_info info;
211         } epm_lhs;
212
213         typedef struct {
214                 [subcontext(2)] epm_lhs lhs;
215                 [subcontext(2),switch_is(lhs.protocol)] epm_rhs rhs;
216         } epm_floor;
217
218         /* note that the NDR_NOALIGN flag is inherited by all nested
219            structures. All of the towers/floors stuff is
220            non-aligned. I wonder what sort of wicked substance these
221            guys were smoking?
222         */
223         typedef [gensize,flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
224                 uint16 num_floors;
225                 epm_floor floors[num_floors];
226         } epm_tower;
227
228         typedef struct {
229                 [value(ndr_size_epm_tower(0, &r->tower,ndr->flags))] uint32  tower_length;
230                 [subcontext(4)] epm_tower tower;
231         } epm_twr_t;
232
233         typedef struct {
234                 GUID        object;
235                 epm_twr_t   *tower;
236                 ascstr2     annotation;
237         } epm_entry_t;
238
239         typedef struct {
240                 GUID                uuid;
241                 uint16              vers_major;
242                 uint16              vers_minor;
243         } rpc_if_id_t;
244     
245         /**********************/
246         /* Function 0x0       */
247         error_status_t epm_Insert(
248                 [in]    uint32          num_ents,
249                 [in,size_is(num_ents)]  epm_entry_t         entries[],
250                 [in]    uint32    replace
251                 );
252     
253         /**********************/
254         /* Function 0x1       */
255         error_status_t epm_Delete(
256                 [in]     uint32          num_ents,
257                 [in, size_is(num_ents)]  epm_entry_t entries[]
258                 );
259     
260         /**********************/
261         /* Function 0x02      */
262         error_status_t epm_Lookup(
263                 [in]            uint32          inquiry_type,
264                 [in]            GUID            *object,
265                 [in]            rpc_if_id_t     *interface_id,
266                 [in]            uint32          vers_option,
267                 [in,out,ref]    policy_handle   *entry_handle,
268                 [in]            uint32          max_ents,
269                 [out]           uint32          num_ents,
270                 [out, length_is(num_ents), size_is(max_ents)]  epm_entry_t entries[]
271                 );
272
273
274         /**********************/
275         /* Function 0x03      */
276
277         typedef struct {
278                 epm_twr_t *twr;
279         } epm_twr_p_t;
280
281         error_status_t epm_Map(
282                 [in]            GUID            *object,
283                 [in]            epm_twr_t       *map_tower,
284                 [in,out,ref]    policy_handle   *entry_handle,
285                 [in]            uint32          max_towers,
286                 [out]           uint32          num_towers,
287                 [out, length_is(num_towers), size_is(max_towers)]  epm_twr_p_t towers[]
288                 );
289     
290
291         /**********************/
292         /* Function 0x04      */
293         error_status_t epm_LookupHandleFree(
294                 [in,out,ref]    policy_handle *entry_handle
295                 );
296     
297         /**********************/
298         /* Function 0x05      */
299         error_status_t epm_InqObject(
300                 [out]           GUID        *epm_object
301                 );
302     
303
304         /**********************/
305         /* Function 0x06      */
306         error_status_t epm_MgmtDelete(
307                 [in]            uint32   object_speced,
308                 [in]            GUID     *object,
309                 [in]            epm_twr_t    *tower
310                 );
311
312         /**********************/
313         /* Function 0x07      */
314         error_status_t epm_MapAuth();
315 }