idl: Define messages sent between samba-dcerpcd and rpcd's
authorVolker Lendecke <vl@samba.org>
Wed, 9 Jun 2021 06:27:36 +0000 (08:27 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 10 Dec 2021 14:02:30 +0000 (14:02 +0000)
MSG_RPC_DUMP_STATUS will be like pool-usage carrying a file descriptor to
report status to, the other two are described in rpc_host.idl.

NOALIGN on rpc_worker_status: This makes it easier to count bytes to
push into a static buffer.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
librpc/idl/messaging.idl
source3/librpc/idl/rpc_host.idl [new file with mode: 0644]
source3/librpc/idl/wscript_build
source3/librpc/wscript_build

index 61566919446d0f4ec2477b6650dca7b2a3f7f74a..d6929c799adf59e6d03e7784e2aa06784808c379 100644 (file)
@@ -160,6 +160,10 @@ interface messaging
                /* MSG_DBWRAP_G_LOCK_RETRY              = 4002, */
                MSG_DBWRAP_MODIFIED             = 4003,
 
+               MSG_RPC_HOST_NEW_CLIENT         = 4004,
+               MSG_RPC_WORKER_STATUS           = 4005,
+               MSG_RPC_DUMP_STATUS             = 4006,
+
                /*
                 * source4 allows new messages to be registered at
                 * runtime (currently used in python bindings and in
diff --git a/source3/librpc/idl/rpc_host.idl b/source3/librpc/idl/rpc_host.idl
new file mode 100644 (file)
index 0000000..0fc3f95
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ * @file rpc_host.idl
+ *
+ * Definitions for communication between samba-dcerpcd and rpc helper
+ * daemons
+ */
+#include "idl_types.h"
+
+import "named_pipe_auth.idl";
+import "dcerpc.idl";
+
+[
+       pointer_default(unique)
+]
+
+interface rpc_host_msg
+{
+       /**
+        * @brief MSG_RPC_HOST_NEW_CLIENT: samba-dcerpcd->rpcd
+        *
+        * samba-dcerpcd to rpcd msg announcing a new client. This
+        * will carry a file descriptor representing the new
+        * connection
+        */
+       typedef [public] struct {
+               /**
+                * @brief The binding the client wants to connect to
+                */
+               [string,charset(UTF8)] char *binding;
+
+               /**
+                * @brief Auth info inherited from SMB
+                */
+               named_pipe_auth_req_info5 *npa_info5;
+
+               /**
+                * @brief Raw bind PDU
+                *
+                * Already read from the socket by samba-dcerpcd
+                */
+               DATA_BLOB bind_packet;
+       } rpc_host_client;
+
+       /**
+        * @brief MSG_RPC_WORKER_STATUS: rpcd->samba-dcerpcd
+        *
+        * Once a client has been handed over from samba-dcerpcd to an
+        * rpcd, samba-dcerpc has no control over this socket
+        * anymore. So it can't know when the client exits and the
+        * rpcd helper process has a slot free. Thus whenever a client
+        * exits, rpcd sends this message up to samba-dcerpc for a
+        * status update.
+        */
+       typedef [flag(NDR_NOALIGN),public] struct {
+               /**
+                * @brief Which rpc service is this message from
+                *
+                * samba-dcerpcd will only have the source pid of this
+                * message. To avoid a walk through all arrays with
+                * all rpcd helpers, give samba-dcerpcd a hint where
+                * in its arrays to find the rpcd that sent this
+                * message.
+                */
+               uint8 server_index;
+
+               /**
+                * @brief Which of the processes of a helper prog is this from
+                */
+               uint8 worker_index;
+
+               /**
+                * @brief How many clients this process serves right now
+                */
+               uint32 num_clients;
+       } rpc_worker_status;
+}
index 2c6ec49faec1020b7c6be7cd85ec47d715147887..9332a8d5668855e5495c3b7d7d992c56bf1e18b9 100644 (file)
@@ -14,7 +14,10 @@ bld.SAMBA_PIDL_LIST('PIDL',
                     output_dir='../gen_ndr')
 
 bld.SAMBA_PIDL_LIST('PIDL',
-                    '''libnetapi.idl libnet_join.idl
+                    '''
+                    libnetapi.idl
+                    libnet_join.idl
+                    rpc_host.idl
                     ''',
                     options='--includedir=%s --header --ndr-parser' % topinclude,
                     output_dir='../gen_ndr',
index a0f1a9d05ff984c5d63cf7bba54fc4e7c2ee7891..40b4eaf1108c606bcc6247346c7f7a8404ea65fe 100644 (file)
@@ -12,6 +12,10 @@ bld.SAMBA3_SUBSYSTEM('NDR_LIBNET_JOIN',
        public_deps='ndr krb5samba NDR_ODJ'
        )
 
+bld.SAMBA3_SUBSYSTEM("NDR_RPC_HOST",
+                     source='gen_ndr/ndr_rpc_host.c',
+                     public_deps='ndr')
+
 bld.SAMBA3_SUBSYSTEM('NDR_OPEN_FILES',
        source='gen_ndr/ndr_open_files.c',
        public_deps='ndr NDR_SERVER_ID NDR_FILE_ID NDR_SECURITY NDR_SMB2_LEASE_STRUCT'