From 760dfa76d9c912fd352e26be9be8a3d567f12375 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 15 Oct 2008 15:31:49 +0200 Subject: Share epmapper. --- source3/librpc/gen_ndr/epmapper.h | 4 +- source3/librpc/gen_ndr/ndr_epmapper.c | 20 +-- source3/librpc/idl/epmapper.idl | 305 ---------------------------------- 3 files changed, 11 insertions(+), 318 deletions(-) delete mode 100644 source3/librpc/idl/epmapper.idl (limited to 'source3/librpc') diff --git a/source3/librpc/gen_ndr/epmapper.h b/source3/librpc/gen_ndr/epmapper.h index 7689ee54a6..4b75261a02 100644 --- a/source3/librpc/gen_ndr/epmapper.h +++ b/source3/librpc/gen_ndr/epmapper.h @@ -227,7 +227,9 @@ struct epm_twr_t { struct epm_entry_t { struct GUID object; struct epm_twr_t *tower;/* [ptr] */ - const char * annotation;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4)] */ + uint32_t __annotation_offset;/* [value(0)] */ + uint32_t __annotation_length;/* [value(strlen(annotation)+1)] */ + const char *annotation;/* [charset(DOS)] */ }; struct rpc_if_id_t { diff --git a/source3/librpc/gen_ndr/ndr_epmapper.c b/source3/librpc/gen_ndr/ndr_epmapper.c index b7cead8a21..0f1005dda7 100644 --- a/source3/librpc/gen_ndr/ndr_epmapper.c +++ b/source3/librpc/gen_ndr/ndr_epmapper.c @@ -1633,12 +1633,9 @@ static enum ndr_err_code ndr_push_epm_entry_t(struct ndr_push *ndr, int ndr_flag NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->object)); NDR_CHECK(ndr_push_full_ptr(ndr, r->tower)); - { - uint32_t _flags_save_string = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4); - NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->annotation)); - ndr->flags = _flags_save_string; - } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen(r->annotation) + 1)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->annotation, strlen(r->annotation) + 1, sizeof(uint8_t), CH_DOS)); } if (ndr_flags & NDR_BUFFERS) { if (r->tower) { @@ -1661,12 +1658,9 @@ static enum ndr_err_code ndr_pull_epm_entry_t(struct ndr_pull *ndr, int ndr_flag } else { r->tower = NULL; } - { - uint32_t _flags_save_string = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4); - NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->annotation)); - ndr->flags = _flags_save_string; - } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__annotation_offset)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__annotation_length)); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->annotation, r->__annotation_length, sizeof(uint8_t), CH_DOS)); } if (ndr_flags & NDR_BUFFERS) { if (r->tower) { @@ -1690,6 +1684,8 @@ _PUBLIC_ void ndr_print_epm_entry_t(struct ndr_print *ndr, const char *name, con ndr_print_epm_twr_t(ndr, "tower", r->tower); } ndr->depth--; + ndr_print_uint32(ndr, "__annotation_offset", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->__annotation_offset); + ndr_print_uint32(ndr, "__annotation_length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->annotation) + 1:r->__annotation_length); ndr_print_string(ndr, "annotation", r->annotation); ndr->depth--; } diff --git a/source3/librpc/idl/epmapper.idl b/source3/librpc/idl/epmapper.idl deleted file mode 100644 index 2cbe3e1f02..0000000000 --- a/source3/librpc/idl/epmapper.idl +++ /dev/null @@ -1,305 +0,0 @@ -#include "idl_types.h" - -/* - endpoint mapper interface - Related links: - http://www.opengroup.org/onlinepubs/9629399/apdxo.htm : The official IDL for this pipe - http://www.opengroup.org/onlinepubs/9629399/apdxl.htm : Details on towers -http://www.opengroup.org/onlinepubs/9629399/chap6.htm#tagcjh_11_02_03_01: binding strings - -*/ - -import "misc.idl"; - -[ - uuid("e1af8308-5d1f-11c9-91a4-08002b14a0fa"), - version(3.0), - endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]", - "ncalrpc:[EPMAPPER]"), - helpstring("EndPoint Mapper"), - pointer_default(ptr) -] -interface epmapper -{ - - /* - note that the following IDL won't work in MIDL, and in fact - that the full towers/floors representation of epm cannot be - represented in MIDL at all. I decided to represent it using - the extended IDL syntax in pidl to make it easier to work - with. - */ - - const int EPMAPPER_STATUS_NO_MORE_ENTRIES = 0x16c9a0d6; - const int EPMAPPER_STATUS_NO_MEMORY = 0x16C9A012; - const int EPMAPPER_STATUS_OK = 0; - - - - typedef [enum8bit] enum { - - /* Level 4 and higher */ - EPM_PROTOCOL_DNET_NSP = 0x04, - EPM_PROTOCOL_OSI_TP4 = 0x05, - EPM_PROTOCOL_OSI_CLNS = 0x06, - EPM_PROTOCOL_TCP = 0x07, - EPM_PROTOCOL_UDP = 0x08, - EPM_PROTOCOL_IP = 0x09, - /* These 4 are protocol identifiers, always at level 3 or lower */ - EPM_PROTOCOL_NCADG = 0x0a, /* Connectionless RPC */ - EPM_PROTOCOL_NCACN = 0x0b, - EPM_PROTOCOL_NCALRPC = 0x0c, /* Local RPC */ - EPM_PROTOCOL_UUID = 0x0d, - EPM_PROTOCOL_IPX = 0x0e, - EPM_PROTOCOL_SMB = 0x0f, - EPM_PROTOCOL_PIPE = 0x10, - EPM_PROTOCOL_NETBIOS = 0x11, - EPM_PROTOCOL_NETBEUI = 0x12, - EPM_PROTOCOL_SPX = 0x13, - EPM_PROTOCOL_NB_IPX = 0x14, /* NetBIOS over IPX */ - EPM_PROTOCOL_DSP = 0x16, /* AppleTalk Data Stream Protocol */ - EPM_PROTOCOL_DDP = 0x17, /* AppleTalk Data Datagram Protocol */ - EPM_PROTOCOL_APPLETALK = 0x18, /* AppleTalk */ - EPM_PROTOCOL_VINES_SPP = 0x1a, - EPM_PROTOCOL_VINES_IPC = 0x1b, /* Inter Process Communication */ - EPM_PROTOCOL_STREETTALK = 0x1c, /* Vines Streettalk */ - EPM_PROTOCOL_HTTP = 0x1f, - EPM_PROTOCOL_UNIX_DS = 0x20, /* Unix domain socket */ - EPM_PROTOCOL_NULL = 0x21 - } epm_protocol; - - typedef struct { - /*FIXME */ - } epm_rhs_dnet_nsp; - - typedef struct { - /*FIXME*/ - } epm_rhs_osi_tp4; - - typedef struct { - /*FIXME*/ - } epm_rhs_osi_clns; - - typedef struct { - uint16 port; - } epm_rhs_udp; - - typedef struct { - uint16 port; - } epm_rhs_tcp; - - typedef struct { - ipv4address ipaddr; - } epm_rhs_ip; - - typedef struct { - uint16 minor_version; - } epm_rhs_ncadg; - - typedef struct { - uint16 minor_version; - } epm_rhs_ncacn; - - typedef struct { - [flag(NDR_REMAINING)] DATA_BLOB unknown; - } epm_rhs_uuid; - - typedef struct { - /*FIXME */ - } epm_rhs_ipx; - - typedef struct { - astring unc; - } epm_rhs_smb; - - typedef struct { - astring path; - } epm_rhs_pipe; - - typedef struct { - astring name; - } epm_rhs_netbios; - - typedef struct { - } epm_rhs_netbeui; - - typedef struct { - } epm_rhs_spx; - - typedef struct { - } epm_rhs_nb_ipx; - - typedef struct { - uint16 port; - } epm_rhs_http; - - typedef struct { - astring path; - } epm_rhs_unix_ds; - - typedef struct { - } epm_rhs_null; - - typedef struct { - uint16 minor_version; - } epm_rhs_ncalrpc; - - typedef struct { - } epm_rhs_appletalk; - - typedef struct { - } epm_rhs_atalk_stream; - - typedef struct { - } epm_rhs_atalk_datagram; - - typedef struct { - uint16 port; - } epm_rhs_vines_spp; - - typedef struct { - uint16 port; - } epm_rhs_vines_ipc; - - typedef struct { - astring streettalk; - } epm_rhs_streettalk; - - typedef [flag(NDR_BIG_ENDIAN),nodiscriminant] union { - [case(EPM_PROTOCOL_DNET_NSP)] epm_rhs_dnet_nsp dnet_nsp; - [case(EPM_PROTOCOL_OSI_TP4)] epm_rhs_osi_tp4 osi_tp4; - [case(EPM_PROTOCOL_OSI_CLNS)] epm_rhs_osi_clns osi_clns; - [case(EPM_PROTOCOL_TCP)] epm_rhs_tcp tcp; - [case(EPM_PROTOCOL_UDP)] epm_rhs_udp udp; - [case(EPM_PROTOCOL_IP)] epm_rhs_ip ip; - [case(EPM_PROTOCOL_NCADG)] epm_rhs_ncadg ncadg; - [case(EPM_PROTOCOL_NCACN)] epm_rhs_ncacn ncacn; - [case(EPM_PROTOCOL_NCALRPC)] epm_rhs_ncalrpc ncalrpc; - [case(EPM_PROTOCOL_UUID)] epm_rhs_uuid uuid; - [case(EPM_PROTOCOL_IPX)] epm_rhs_ipx ipx; - [case(EPM_PROTOCOL_SMB)] epm_rhs_smb smb; - [case(EPM_PROTOCOL_PIPE)] epm_rhs_pipe pipe; - [case(EPM_PROTOCOL_NETBIOS)] epm_rhs_netbios netbios; - [case(EPM_PROTOCOL_NETBEUI)] epm_rhs_netbeui netbeui; - [case(EPM_PROTOCOL_SPX)] epm_rhs_spx spx; - [case(EPM_PROTOCOL_NB_IPX)] epm_rhs_nb_ipx nb_ipx; - [case(EPM_PROTOCOL_DSP)] epm_rhs_atalk_stream atalk_stream; - [case(EPM_PROTOCOL_DDP)] epm_rhs_atalk_datagram atalk_datagram; - [case(EPM_PROTOCOL_APPLETALK)] epm_rhs_appletalk appletalk; - [case(EPM_PROTOCOL_VINES_SPP)] epm_rhs_vines_spp vines_spp; - [case(EPM_PROTOCOL_VINES_IPC)] epm_rhs_vines_ipc vines_ipc; - [case(EPM_PROTOCOL_STREETTALK)] epm_rhs_streettalk streettalk; - [case(EPM_PROTOCOL_HTTP)] epm_rhs_http http; - [case(EPM_PROTOCOL_UNIX_DS)] epm_rhs_unix_ds unix_ds; - [case(EPM_PROTOCOL_NULL)] epm_rhs_null null; - [default] [flag(NDR_REMAINING)] DATA_BLOB unknown; - } epm_rhs; - - typedef struct { - epm_protocol protocol; - [flag(NDR_REMAINING)] DATA_BLOB lhs_data; - } epm_lhs; - - typedef struct { - [subcontext(2)] epm_lhs lhs; - [subcontext(2),switch_is(lhs.protocol)] epm_rhs rhs; - } epm_floor; - - /* note that the NDR_NOALIGN flag is inherited by all nested - structures. All of the towers/floors stuff is - non-aligned. I wonder what sort of wicked substance these - guys were smoking? - */ - typedef [gensize,flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct { - uint16 num_floors; - epm_floor floors[num_floors]; - } epm_tower; - - typedef struct { - [value(ndr_size_epm_tower(&tower, ndr->flags))] uint32 tower_length; - [subcontext(4)] epm_tower tower; - } epm_twr_t; - - typedef struct { - GUID object; - epm_twr_t *tower; - ascstr2 annotation; - } epm_entry_t; - - typedef struct { - GUID uuid; - uint16 vers_major; - uint16 vers_minor; - } rpc_if_id_t; - - /**********************/ - /* Function 0x0 */ - error_status_t epm_Insert( - [in] uint32 num_ents, - [in,size_is(num_ents)] epm_entry_t entries[], - [in] uint32 replace - ); - - /**********************/ - /* Function 0x1 */ - error_status_t epm_Delete( - [in] uint32 num_ents, - [in, size_is(num_ents)] epm_entry_t entries[] - ); - - /**********************/ - /* Function 0x02 */ - error_status_t epm_Lookup( - [in] uint32 inquiry_type, - [in,ptr] GUID *object, - [in,ptr] rpc_if_id_t *interface_id, - [in] uint32 vers_option, - [in,out] policy_handle *entry_handle, - [in] uint32 max_ents, - [out] uint32 *num_ents, - [out, length_is(*num_ents), size_is(max_ents)] epm_entry_t entries[] - ); - - - /**********************/ - /* Function 0x03 */ - - typedef struct { - epm_twr_t *twr; - } epm_twr_p_t; - - [public] error_status_t epm_Map( - [in,ptr] GUID *object, - [in,ptr] epm_twr_t *map_tower, - [in,out] policy_handle *entry_handle, - [in] uint32 max_towers, - [out] uint32 *num_towers, - [out, length_is(*num_towers), size_is(max_towers)] epm_twr_p_t towers[] - ); - - - /**********************/ - /* Function 0x04 */ - error_status_t epm_LookupHandleFree( - [in,out] policy_handle *entry_handle - ); - - /**********************/ - /* Function 0x05 */ - error_status_t epm_InqObject( - [in] GUID *epm_object - ); - - - /**********************/ - /* Function 0x06 */ - error_status_t epm_MgmtDelete( - [in] uint32 object_speced, - [in,ptr] GUID *object, - [in,ptr] epm_twr_t *tower - ); - - /**********************/ - /* Function 0x07 */ - [todo] error_status_t epm_MapAuth(); -} -- cgit