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