r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
[vlendec/samba-autobuild/.git] / source3 / include / idmap.h
index 474982f2926eacfa88cbdf0050d13596d54863c4..ee248ef26f2895ce62416f00eb64ea13ef1d08f0 100644 (file)
    Boston, MA  02111-1307, USA.   
 */
 
-/* idmap version determines auto-conversion */
-#define IDMAP_VERSION 2
+/* idmap version determines auto-conversion - this is the database
+   structure version specifier. */
 
-#define SMB_IDMAP_INTERFACE_VERSION    2
+#define IDMAP_VERSION 2
 
+/* The interface version specifier. 
+   Updated to 3 for enum types by JRA. */
 
-#define ID_EMPTY       0x00
-#define ID_USERID      0x01
-#define ID_GROUPID     0x02
-#define ID_OTHER       0x04
+#define SMB_IDMAP_INTERFACE_VERSION    3
 
-#define ID_TYPEMASK    0x0f
+enum idmap_type { ID_USERID, ID_GROUPID };
 
-#define ID_QUERY_ONLY  0x10
-#define ID_CACHE_ONLY   0x20
+#define IDMAP_FLAG_NONE                0x0
+#define IDMAP_FLAG_QUERY_ONLY  0x1     /* Don't ever allocate, just query. */
+#define IDMAP_FLAG_CACHE_ONLY   0x2    /* Only look in our local cache, not remote. */
 
 /* Filled out by IDMAP backends */
 struct idmap_methods {
 
        /* Called when backend is first loaded */
-       NTSTATUS (*init)( char *params );
+       NTSTATUS (*init)( const char *params );
 
-       NTSTATUS (*allocate_id)(unid_t *id, int id_type);
-       NTSTATUS (*get_sid_from_id)(DOM_SID *sid, unid_t id, int id_type);
-       NTSTATUS (*get_id_from_sid)(unid_t *id, int *id_type, const DOM_SID *sid);
-       NTSTATUS (*set_mapping)(const DOM_SID *sid, unid_t id, int id_type);
+       NTSTATUS (*allocate_id)(unid_t *id, enum idmap_type id_type);
+       NTSTATUS (*get_sid_from_id)(DOM_SID *sid, unid_t id, enum idmap_type id_type, int flags);
+       NTSTATUS (*get_id_from_sid)(unid_t *id, enum idmap_type *id_type, const DOM_SID *sid, int flags);
+       NTSTATUS (*set_mapping)(const DOM_SID *sid, unid_t id, enum idmap_type id_type);
 
        /* Called when backend is unloaded */
        NTSTATUS (*close_fn)(void);