Refactoring: net_sh_run uses ndr_syntax_id instead of pipe_idx
[kai/samba.git] / source3 / utils / net.h
index 15b1dd402b09f3a74df16c3012ee9ce4ad46708c..01a76a0db1299c7547a85d202d12543686756333 100644 (file)
  */
 
 #include "lib/netapi/netapi.h"
+#include "libnet/libnet.h"
+
+struct net_context {
+       const char *opt_requester_name;
+       const char *opt_host;
+       const char *opt_password;
+       const char *opt_user_name;
+       bool opt_user_specified;
+       const char *opt_workgroup;
+       int opt_long_list_entries;
+       int opt_reboot;
+       int opt_force;
+       int opt_stdin;
+       int opt_port;
+       int opt_verbose;
+       int opt_maxusers;
+       const char *opt_comment;
+       const char *opt_container;
+       int opt_flags;
+       int opt_timeout;
+       const char *opt_target_workgroup;
+       int opt_machine_pass;
+       int opt_localgroup;
+       int opt_domaingroup;
+       int do_talloc_report;
+       const char *opt_newntname;
+       int opt_rid;
+       int opt_acls;
+       int opt_attrs;
+       int opt_timestamps;
+       const char *opt_exclude;
+       const char *opt_destination;
+       int opt_testmode;
+
+       int opt_have_ip;
+       struct sockaddr_storage opt_dest_ip;
+       bool smb_encrypt;
+       struct libnetapi_ctx *netapi_ctx;
+
+       bool display_usage;
+       void *private_data;
+       const char *share_type[];
+};
+
+#define NET_TRANSPORT_LOCAL 0x01
+#define NET_TRANSPORT_RAP   0x02
+#define NET_TRANSPORT_RPC   0x04
+#define NET_TRANSPORT_ADS   0x08
+
+struct functable {
+       const char *funcname;
+       int (*fn)(struct net_context *c, int argc, const char **argv);
+       int valid_transports;
+       const char *description;
+       const char *usage;
+};
 
 typedef NTSTATUS (*rpc_command_fn)(struct net_context *c,
                                const DOM_SID *,
@@ -59,7 +115,7 @@ struct rpc_sh_cmd {
        struct rpc_sh_cmd *(*sub)(struct net_context *c,
                                  TALLOC_CTX *mem_ctx,
                                  struct rpc_sh_ctx *ctx);
-       int pipe_idx;
+       const struct ndr_syntax_id *interface;
        NTSTATUS (*fn)(struct net_context *c, TALLOC_CTX *mem_ctx,
                       struct rpc_sh_ctx *ctx,
                       struct rpc_pipe_client *pipe_hnd,
@@ -69,50 +125,10 @@ struct rpc_sh_cmd {
 
 enum netdom_domain_t { ND_TYPE_NT4, ND_TYPE_AD };
 
-struct net_context {
-       const char *opt_requester_name;
-       const char *opt_host;
-       const char *opt_password;
-       const char *opt_user_name;
-       bool opt_user_specified;
-       const char *opt_workgroup;
-       int opt_long_list_entries;
-       int opt_reboot;
-       int opt_force;
-       int opt_stdin;
-       int opt_port;
-       int opt_verbose;
-       int opt_maxusers;
-       const char *opt_comment;
-       const char *opt_container;
-       int opt_flags;
-       int opt_timeout;
-       const char *opt_target_workgroup;
-       int opt_machine_pass;
-       int opt_localgroup;
-       int opt_domaingroup;
-       int do_talloc_report;
-       const char *opt_newntname;
-       int opt_rid;
-       int opt_acls;
-       int opt_attrs;
-       int opt_timestamps;
-       const char *opt_exclude;
-       const char *opt_destination;
-       int opt_testmode;
-
-       int opt_have_ip;
-       struct sockaddr_storage opt_dest_ip;
-       bool smb_encrypt;
-       struct libnetapi_ctx *netapi_ctx;
-
-       bool AllowDebugChange;
-       const char *share_type[];
-};
-
 /* INCLUDE FILES */
 
 #include "utils/net_proto.h"
+#include "utils/net_help_common.h"
 
 /* MACROS & DEFINES */
 
@@ -125,20 +141,9 @@ struct net_context {
 #define NET_FLAGS_PDC                          0x00000008      /* PDC only */
 #define NET_FLAGS_ANONYMOUS                    0x00000010      /* use an anonymous connection */
 #define NET_FLAGS_NO_PIPE                      0x00000020      /* don't open an RPC pipe */
+#define NET_FLAGS_SIGN                         0x00000040      /* sign RPC connection */
+#define NET_FLAGS_SEAL                         0x00000080      /* seal RPC connection */
 
 /* net share operation modes */
 #define NET_MODE_SHARE_MIGRATE 1
 
-/* Structure for mapping accounts to groups */
-/* Array element is the group rid */
-typedef struct _groupmap {
-       uint32 rid;
-       uint32 gidNumber;
-       fstring sambaSID;
-       fstring group_dn;
-} GROUPMAP;
-
-typedef struct _accountmap {
-       uint32 rid;
-       fstring cn;
-} ACCOUNTMAP;