From 2882b5b5733c9aadb4a5312c92526c3224227733 Mon Sep 17 00:00:00 2001 From: Sam Liddicott Date: Fri, 7 Nov 2008 15:39:58 +0000 Subject: [PATCH] proxy rpc After much discussion; The proxies will communicate with idl defined messages and NDR encoding sent by ntioctl within the session. There will therefore be an implicit fnum associated with the ntioctl which identifies the file on which the proxy function is to operate. I'm not entirely happy with that out-of-band-data so that may change to be IN the NDR encoded data as well; but the tid and session is also out-of-band and used to interpret the fnum anyway, so maybe we won't worry about that right now. --- source4/librpc/config.mk | 7 +++- source4/librpc/idl/proxy.idl | 74 +++++++++++++++++++++++++++++++++++++++++++ source4/ntvfs/proxy/config.mk | 2 +- 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 source4/librpc/idl/proxy.idl diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index adea0711857..618e5c803d2 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -85,6 +85,11 @@ PUBLIC_DEPENDENCIES = LIBNDR NDR_ECHO_OBJ_FILES = $(gen_ndrsrcdir)/ndr_echo.o +[SUBSYSTEM::NDR_PROXY] +PUBLIC_DEPENDENCIES = LIBNDR + +NDR_PROXY_OBJ_FILES = $(gen_ndrsrcdir)/ndr_proxy.o + [SUBSYSTEM::NDR_IRPC] PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY NDR_NBT @@ -379,7 +384,7 @@ $(gen_ndrsrcdir)/tables.c: $(IDL_NDR_PARSE_H_FILES) [SUBSYSTEM::NDR_TABLE] PUBLIC_DEPENDENCIES = \ - NDR_AUDIOSRV NDR_ECHO NDR_DCERPC \ + NDR_AUDIOSRV NDR_ECHO NDR_PROXY NDR_DCERPC \ NDR_DSBACKUP NDR_EFS NDR_LSA NDR_DFS NDR_DRSUAPI \ NDR_POLICYAGENT NDR_UNIXINFO NDR_SAMR NDR_SPOOLSS NDR_WKSSVC NDR_SRVSVC NDR_ATSVC \ NDR_EVENTLOG NDR_EPMAPPER NDR_DBGIDL NDR_DSSETUP NDR_MSGSVC NDR_WINS \ diff --git a/source4/librpc/idl/proxy.idl b/source4/librpc/idl/proxy.idl new file mode 100644 index 00000000000..7202db5da0d --- /dev/null +++ b/source4/librpc/idl/proxy.idl @@ -0,0 +1,74 @@ + +[ + uuid("bf25facd-cc1a-4067-9a23-2e20b26816e5"), + endpoint("ncacn_np:[\\pipe\\rpcproxy]", "ncacn_ip_tcp:", "ncalrpc:"), + pointer_default(unique), + version(1.0), + helpstring("Caching Proxy") +] +interface rpcproxy +{ + NTSTATUS proxy_Read( + [in] uint32 fnum, /* file number as supplied by remote device */ + [in] uint32 mincnt, + [in] uint32 maxcnt, + [in] uint32 remaining, + [in] hyper offset, + [in] uint8 read_for_execute, + [in,out] uint8 flags, /* read_for_execute, zlib, md5 etc */ + [in] [switch_is(flags & PROXY_USE_CACHE)] digest_ digest, + [out] uint32 nread, + [out] [switch_is(flags)] Read_data response + ); + + NTSTATUS proxy_Write( + [in] uint32 fnum, /* file number as supplied by remote device */ + [in] hyper offset, + [in] uint32 count, /* the uncompressed count */ + [in] uint16 mode, + [in] uint8 flags, /* read_for_execute, zlib, md5 etc */ + [in] [switch_is(flags)] Write_data data, + [out] uint32 nwritten, + [out] uint32 remaining + ); + + typedef enum { + PROXY_USE_CACHE = 1, + PROXY_USE_ZLIB = 2, + /* if cache is not valid, fall back to mincnt */ + PROXY_VALIDATE = 4, + PROXY_RSYNC = 8 + } proxy_Read_flags; + + typedef struct digest { + uint8 data[16]; + } digest; + + typedef [/*nodiscriminant,*/switch_type(uint8)] union { + [case(PROXY_USE_CACHE)] uint8 digest[16]; + [default]; + } digest_; + + typedef struct { + uint32 count; + [/*nodiscriminant,*/size_is(count)] uint8 data[]; + } Read_data_generic; + + typedef [/*nodiscriminant,*/switch_type(uint8)] union { + [case(0)] Read_data_generic generic; + [case(PROXY_USE_ZLIB)] Read_data_generic compress; + [default]; + } Read_data; + + typedef struct { + uint32 count; + [/*nodiscriminant,*/size_is(count)] uint8 data[]; + } Write_data_generic; + + typedef [/*nodiscriminant,*/switch_type(uint8)] union { + [case(0)] Write_data_generic generic; + [case(PROXY_USE_ZLIB)] Write_data_generic compress; + [default]; + } Write_data; + +} diff --git a/source4/ntvfs/proxy/config.mk b/source4/ntvfs/proxy/config.mk index a7c7c232d9d..95c3fcff5af 100644 --- a/source4/ntvfs/proxy/config.mk +++ b/source4/ntvfs/proxy/config.mk @@ -4,7 +4,7 @@ INIT_FUNCTION = ntvfs_proxy_init SUBSYSTEM = ntvfs PRIVATE_DEPENDENCIES = \ - LIBCLI_SMB LIBCLI_RAW LIBCOMPRESSION SMB_PROXY_CACHE + LIBCLI_SMB LIBCLI_RAW LIBCOMPRESSION SMB_PROXY_CACHE RPC_NDR_PROXY # End MODULE ntvfs_proxy ################################################ -- 2.11.4.GIT