r5672: Use switch_type() and the token storage mechanism for unions:
[samba.git] / source4 / librpc / idl / samr.idl
index 84aaa2a10aeee7983877b5eda3268e195f3c8b92..e8b269dc66194ede58aca5b352a64149322b45cb 100644 (file)
@@ -16,7 +16,7 @@
 ] interface samr
 {
        /* account control (acct_flags) bits */
-       typedef [public] bitmap {
+       typedef [public,bitmap32bit] bitmap {
                ACB_DISABLED  = 0x00000001,  /* 1 = User account disabled */
                ACB_HOMDIRREQ = 0x00000002,  /* 1 = Home directory required */
                ACB_PWNOTREQ  = 0x00000004,  /* 1 = User password not required */
@@ -84,7 +84,7 @@
 
        NTSTATUS samr_LookupDomain (
                [in,ref]  policy_handle *connect_handle,                
-               [in,ref]  samr_String *domain,
+               [in,ref]  samr_String *domain_name,
                [out]     dom_sid2 *sid
                );
 
@@ -99,7 +99,7 @@
 
        typedef struct {
                uint32 count;
-               [size_is(count)] samr_SamEntry *entries;
+               [size_is(count)] samr_SamEntry *entries[];
        } samr_SamArray;
 
        NTSTATUS samr_EnumDomains (
                uint16 password_history_length;
                uint32 password_properties;
                /* yes, these are signed. They are in negative 100ns */
-               int64  max_password_age;
-               int64  min_password_age;
+               dlong  max_password_age;
+               dlong  min_password_age;
        } samr_DomInfo1;
 
        typedef struct {
                NTTIME force_logoff_time;
                samr_String comment;
-               samr_String domain;  /* domain name */
+               samr_String domain_name;
                samr_String primary; /* PDC name if this is a BDC */
-               uint64 sequence_num;
+               udlong sequence_num;
                uint32 unknown2;
                samr_Role role;
                uint32 unknown3;
        } samr_DomInfo7;
 
        typedef struct {
-               HYPER_T sequence_num;
+               hyper sequence_num;
                NTTIME domain_create_time;
        } samr_DomInfo8;
 
 
        typedef struct {
                samr_DomInfo2 info2;
-               HYPER_T lockout_duration;
-               HYPER_T lockout_window;
+               hyper lockout_duration;
+               hyper lockout_window;
                uint16 lockout_threshold;
        } samr_DomInfo11;
 
        typedef struct {
-               HYPER_T lockout_duration;
-               HYPER_T lockout_window;
+               hyper lockout_duration;
+               hyper lockout_window;
                uint16 lockout_threshold;
        } samr_DomInfo12;
 
        typedef struct {
-               HYPER_T sequence_num;
+               hyper sequence_num;
                NTTIME domain_create_time;
                uint32 unknown1;
                uint32 unknown2;
        } samr_DomInfo13;
 
-       typedef union {
+       typedef [switch_type(uint16)] union {
                [case(1)] samr_DomInfo1 info1;
                [case(2)] samr_DomInfo2 info2;
                [case(3)] samr_DomInfo3 info3;
 
        typedef struct {
                [range(0,1024)]  uint32 count;
-               [size_is(count)] uint32 *ids;
+               [size_is(count)] uint32 *ids[];
        } samr_Ids;
 
        NTSTATUS samr_GetAliasMembership(
        NTSTATUS samr_LookupNames(
                [in,ref]      policy_handle *domain_handle,
                [in,range(0,1000)] uint32 num_names,
-               [in,ref,size_is(1000),length_is(num_names)] samr_String *names,
+               [in,size_is(1000),length_is(num_names)] samr_String names[],
                [out]         samr_Ids rids,
                [out]         samr_Ids types
                );
 
        typedef struct {
                uint32 count;
-               [size_is(count)] samr_String *names;
+               [size_is(count)] samr_String *names[];
        } samr_Strings;
 
        NTSTATUS samr_LookupRids(
                [in,ref]      policy_handle *domain_handle,
                [in,range(0,1000)] uint32 num_rids,
-               [in,ref,size_is(1000),length_is(num_rids)] uint32 *rids,
+               [in,size_is(1000),length_is(num_rids)] uint32 rids[],
                [out]         samr_Strings names,
                [out]         samr_Ids types
                );
        } samr_GroupInfoDesciption;
 
        typedef enum {
-               GroupInfoAll          = 1,
-               GroupInfoName         = 2,
-               GroupInfoX            = 3,
-               GroupInfoDescription  = 4,
-               GroupInfoAll2         = 5
-       } GroupInfo;
-
-       typedef union {
-               [case(GroupInfoAll)]         samr_GroupInfoAll    all;
-               [case(GroupInfoName)]        samr_String            name;
-               [case(GroupInfoX)]           samr_GroupInfoX      unknown;
-               [case(GroupInfoDescription)] samr_String            description;
-               [case(GroupInfoAll2)]        samr_GroupInfoAll    all2;
+               GROUPINFOALL          = 1,
+               GROUPINFONAME         = 2,
+               GROUPINFOX            = 3,
+               GROUPINFODESCRIPTION  = 4,
+               GROUPINFOALL2         = 5
+       } samr_GroupInfoEnum;
+
+       typedef [switch_type(samr_GroupInfoEnum)] union {
+               [case(GROUPINFOALL)]         samr_GroupInfoAll    all;
+               [case(GROUPINFONAME)]        samr_String            name;
+               [case(GROUPINFOX)]           samr_GroupInfoX      unknown;
+               [case(GROUPINFODESCRIPTION)] samr_String            description;
+               [case(GROUPINFOALL2)]        samr_GroupInfoAll    all2;
        } samr_GroupInfo;
 
        NTSTATUS samr_QueryGroupInfo(
                [in,ref]                  policy_handle *group_handle,
-               [in]                      GroupInfo level,
+               [in]                      samr_GroupInfoEnum level,
                [out,switch_is(level)]    samr_GroupInfo *info
                );
 
        /* Function    0x15     */
        NTSTATUS samr_SetGroupInfo(
                [in,ref]                  policy_handle *group_handle,
-               [in]                      GroupInfo level,
+               [in]                      samr_GroupInfoEnum level,
                [in,switch_is(level),ref] samr_GroupInfo *info
                );
 
        /* Function    0x19     */
        typedef struct {
                uint32 count;
-               [size_is(count)] uint32 *rids;
-               [size_is(count)] uint32 *unknown;
+               [size_is(count)] uint32 *rids[];
+               [size_is(count)] uint32 *unknown[];
        } samr_ridArray;
 
        NTSTATUS samr_QueryGroupMember(
        } samr_AliasInfoAll;
 
        typedef enum {
-               AliasInfoAll          = 1,
-               AliasInfoName         = 2,
-               AliasInfoDescription  = 3
-       } AliasInfo;
-
-       typedef union {
-               [case(AliasInfoAll)] samr_AliasInfoAll all;
-               [case(AliasInfoName)] samr_String name;
-               [case(AliasInfoDescription)] samr_String description;
+               ALIASINFOALL          = 1,
+               ALIASINFONAME         = 2,
+               ALIASINFODESCRIPTION  = 3
+       } samr_AliasInfoEnum;
+
+       typedef [switch_type(samr_AliasInfoEnum)] union {
+               [case(ALIASINFOALL)] samr_AliasInfoAll all;
+               [case(ALIASINFONAME)] samr_String name;
+               [case(ALIASINFODESCRIPTION)] samr_String description;
        } samr_AliasInfo;
 
        NTSTATUS samr_QueryAliasInfo(
                [in,ref]                  policy_handle  *alias_handle,
-               [in]                      AliasInfo      level,
+               [in]                      samr_AliasInfoEnum      level,
                [out,switch_is(level)]    samr_AliasInfo *info
                );
 
        /* Function    0x1d     */
        NTSTATUS samr_SetAliasInfo(
                [in,ref]                  policy_handle  *alias_handle,
-               [in]                      AliasInfo      level,
+               [in]                      samr_AliasInfoEnum      level,
                [in,switch_is(level),ref] samr_AliasInfo *info
                );
 
        /* this is also used in samr and netlogon */
        typedef [public, flag(NDR_PAHEX)] struct {
                uint16 units_per_week;
-               [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
+               [size_is(1260), length_is(units_per_week/8)] uint8 *bits[];
        } samr_LogonHours;
 
        typedef struct {
        } samr_UserInfo20;
 
        /* this defines the bits used for fields_present in info21 */
-       typedef bitmap {
+       typedef [bitmap32bit] bitmap {
                SAMR_FIELD_NAME         = 0x00000002,
                SAMR_FIELD_DESCRIPTION  = 0x00000010,
                SAMR_FIELD_COMMENT      = 0x00000020,
                samr_String unknown2;
                samr_String unknown3;
                uint32 buf_count;
-               [size_is(buf_count)] uint8 *buffer;
+               [size_is(buf_count)] uint8 *buffer[];
                uint32 rid;
                uint32 primary_gid;
                samr_AcctFlags acct_flags;
                uint8 pw_len;
        } samr_UserInfo26;
 
-       typedef union {
+       typedef [switch_type(uint16)] union {
                [case(1)] samr_UserInfo1 info1;
                [case(2)] samr_UserInfo2 info2;
                [case(3)] samr_UserInfo3 info3;
 
        typedef struct {
                uint32     count;
-               [size_is(count)] samr_RidType *rid;
+               [size_is(count)] samr_RidType *rid[];
        } samr_RidArray;
 
        NTSTATUS samr_GetGroupsForUser(
 
        typedef struct {
                uint32 count;
-               [size_is(count)] samr_DispEntryGeneral *entries;
+               [size_is(count)] samr_DispEntryGeneral *entries[];
        } samr_DispInfoGeneral;
 
        typedef struct {
 
        typedef struct {
                uint32 count;
-               [size_is(count)] samr_DispEntryFull *entries;
+               [size_is(count)] samr_DispEntryFull *entries[];
        } samr_DispInfoFull;
 
        typedef struct {
 
        typedef struct {
                uint32 count;
-               [size_is(count)] samr_DispEntryAscii *entries;
+               [size_is(count)] samr_DispEntryAscii *entries[];
        } samr_DispInfoAscii;
 
-       typedef union {
+       typedef [switch_type(uint16)] union {
                [case(1)] samr_DispInfoGeneral info1;/* users */
                [case(2)] samr_DispInfoFull info2; /* trust accounts? */
                [case(3)] samr_DispInfoFull info3; /* groups */
        /************************/
        /* Function    0x38     */
        NTSTATUS samr_GetDomPwInfo(
-               [in]        samr_String *name,
+               [in]        samr_String *domain_name,
                [out]       samr_PwInfo info
                );
 
        /************************/
        /* Function    0x3f     */
 
-       const int SAMR_REJECT_OTHER      = 0;
-       const int SAMR_REJECT_TOO_SHORT  = 1;
-       const int SAMR_REJECT_COMPLEXITY = 2;
+       typedef [v1_enum] enum {
+               SAMR_REJECT_OTHER      = 0,
+               SAMR_REJECT_TOO_SHORT  = 1,
+               SAMR_REJECT_COMPLEXITY = 2
+       } samr_RejectReason;
 
        typedef struct {
-               uint32 reason;
+               samr_RejectReason reason;
                uint32 unknown1;
                uint32 unknown2;
        } samr_ChangeReject;