diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-01-06 07:34:14 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:27 -0500 |
commit | d62a44c447c2754948448ae618c75d29a6b8d89e (patch) | |
tree | 182837b738a35bd2abe8b3fa1e47c3e0e316c594 | |
parent | 66af8726e525d6978936d5e950b0e4c3af66c86c (diff) | |
download | samba-d62a44c447c2754948448ae618c75d29a6b8d89e.tar.gz samba-d62a44c447c2754948448ae618c75d29a6b8d89e.tar.bz2 samba-d62a44c447c2754948448ae618c75d29a6b8d89e.zip |
r4558: more use of bitmaps and enums
metze
(This used to be commit 2a859fbc90a6b043bac318196e42c2949958d57f)
-rw-r--r-- | source4/librpc/idl/srvsvc.idl | 51 | ||||
-rw-r--r-- | source4/librpc/idl/wkssvc.idl | 10 | ||||
-rw-r--r-- | source4/rpc_server/common/server_info.c | 9 | ||||
-rw-r--r-- | source4/rpc_server/common/share_info.c | 4 |
4 files changed, 49 insertions, 25 deletions
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index aea5c686a2..8abc67d076 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -8,9 +8,11 @@ version(3.0), pointer_default(unique), helpstring("Server Service"), - depends(security) + depends(security,svcctl) ] interface srvsvc { + declare bitmap svcctl_ServerType; + /**************************/ /* srvsvc_NetCharDev */ /**************************/ @@ -374,12 +376,23 @@ /**************************/ /* share types */ - const int STYPE_DISKTREE = 0; - const int STYPE_PRINTQ = 1; - const int STYPE_DEVICE = 2; /* Serial device */ - const int STYPE_IPC = 3; /* Interprocess communication (IPC) */ - const int STYPE_TEMPORARY= 0x40000000; /* share is a temporary one */ - const int STYPE_HIDDEN = 0x80000000; /* share is a hidden one */ + const uint32 STYPE_TEMPORARY = 0x40000000; /* share is a temporary one */ + const uint32 STYPE_HIDDEN = 0x80000000; /* share is a hidden one */ + + typedef [v1_enum, flag(NDR_PAHEX)] enum { + STYPE_DISKTREE = 0, + STYPE_DISKTREE_TEMPORARY = STYPE_DISKTREE|STYPE_TEMPORARY, + STYPE_DISKTREE_HIDDEN = STYPE_DISKTREE|STYPE_HIDDEN, + STYPE_PRINTQ = 1, + STYPE_PRINTQ_TEMPORARY = STYPE_PRINTQ|STYPE_TEMPORARY, + STYPE_PRINTQ_HIDDEN = STYPE_PRINTQ|STYPE_HIDDEN, + STYPE_DEVICE = 2, /* Serial device */ + STYPE_DEVICE_TEMPORARY = STYPE_DEVICE|STYPE_TEMPORARY, + STYPE_DEVICE_HIDDEN = STYPE_DEVICE|STYPE_HIDDEN, + STYPE_IPC = 3, /* Interprocess communication (IPC) */ + STYPE_IPC_TEMPORARY = STYPE_IPC|STYPE_TEMPORARY, + STYPE_IPC_HIDDEN = STYPE_IPC|STYPE_HIDDEN + } srvsvc_ShareType; typedef struct { unistr *name; @@ -392,7 +405,7 @@ typedef struct { unistr *name; - uint32 type; + srvsvc_ShareType type; unistr *comment; } srvsvc_NetShareInfo1; @@ -403,7 +416,7 @@ typedef struct { unistr *name; - uint32 type; + srvsvc_ShareType type; unistr *comment; uint32 permissions; uint32 max_users; @@ -419,7 +432,7 @@ typedef struct { unistr *name; - uint32 type; + srvsvc_ShareType type; unistr *comment; uint32 csc_policy; } srvsvc_NetShareInfo501; @@ -431,7 +444,7 @@ typedef struct { unistr *name; - uint32 type; + srvsvc_ShareType type; unistr *comment; uint32 permissions; int32 max_users; @@ -546,32 +559,36 @@ WERROR srvsvc_NetShareCheck( [in] unistr *server_unc, [in] unistr device_name, - [out] uint32 type + [out] srvsvc_ShareType type ); /**************************/ /* srvsvc_NetSrv */ /**************************/ + typedef [public] enum { + PLATFORM_ID_NT = 500 + } srvsvc_PlatformId; + typedef struct { - uint32 platform_id; + srvsvc_PlatformId platform_id; unistr *server_name; } srvsvc_NetSrvInfo100; typedef struct { - uint32 platform_id; + srvsvc_PlatformId platform_id; unistr *server_name; uint32 version_major; uint32 version_minor; - uint32 server_type; + svcctl_ServerType server_type; unistr *comment; } srvsvc_NetSrvInfo101; typedef struct { - uint32 platform_id; + srvsvc_PlatformId platform_id; unistr *server_name; uint32 ver_major; uint32 ver_minor; - uint32 server_type; + svcctl_ServerType server_type; unistr *comment; uint32 users; uint32 disc; diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl index 578df3b3aa..318f7ce05b 100644 --- a/source4/librpc/idl/wkssvc.idl +++ b/source4/librpc/idl/wkssvc.idl @@ -7,9 +7,11 @@ [ uuid("6bffd098-a112-3610-9833-46c3f87e345a"), version(1.0), pointer_default(unique), - helpstring("Workstation Service") + helpstring("Workstation Service"), + depends(srvsvc) ] interface wkssvc { + declare enum srvsvc_PlatformId; #define BOOL uint32 @@ -17,7 +19,7 @@ /* Function: 0x00 */ typedef struct { - uint32 platform_id; + srvsvc_PlatformId platform_id; unistr *server_name; unistr *domain_name; uint32 version_major; @@ -25,7 +27,7 @@ } wkssvc_NetWkstaInfo100; typedef struct { - uint32 platform_id; + srvsvc_PlatformId platform_id; unistr *server_name; unistr *domain_name; uint32 version_major; @@ -34,7 +36,7 @@ } wkssvc_NetWkstaInfo101; typedef struct { - uint32 platform_id; + srvsvc_PlatformId platform_id; unistr *server_name; unistr *domain_name; uint32 version_major; diff --git a/source4/rpc_server/common/server_info.c b/source4/rpc_server/common/server_info.c index 9212ada3da..1a628a2ee6 100644 --- a/source4/rpc_server/common/server_info.c +++ b/source4/rpc_server/common/server_info.c @@ -21,15 +21,20 @@ */ #include "includes.h" +#include "librpc/gen_ndr/ndr_srvsvc.h" /* Here are common server info functions used by some dcerpc server interfaces */ /* This hardcoded value should go into a ldb database! */ -uint32_t dcesrv_common_get_platform_id(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx) +enum srvsvc_PlatformId dcesrv_common_get_platform_id(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx) { - return lp_parm_int(-1, "server_info", "platform_id", 500); + enum srvsvc_PlatformId id; + + id = lp_parm_int(-1, "server_info", "platform_id", PLATFORM_ID_NT); + + return id; } const char *dcesrv_common_get_server_name(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, const char *server_unc) diff --git a/source4/rpc_server/common/share_info.c b/source4/rpc_server/common/share_info.c index 6440c70676..ec744a5039 100644 --- a/source4/rpc_server/common/share_info.c +++ b/source4/rpc_server/common/share_info.c @@ -63,7 +63,7 @@ uint32_t dcesrv_common_get_share_current_users(TALLOC_CTX *mem_ctx, struct dcesr } /* This hardcoded value should go into a ldb database! */ -uint32_t dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum) +enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum) { /* for disk share 0x00000000 * for print share 0x00000001 @@ -73,7 +73,7 @@ uint32_t dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context * ADMIN$, IPC$, C$, D$, E$ ... are type |= 0x80000000 * this ones are hidden in NetShareEnum, but shown in NetShareEnumAll */ - uint32_t share_type = 0; + enum srvsvc_ShareType share_type = 0; if (!lp_browseable(snum)) { share_type |= STYPE_HIDDEN; |