| 1 | /* | 
|---|
| 2 | Unix SMB/CIFS implementation. | 
|---|
| 3 | NT QUOTA code constants | 
|---|
| 4 | Copyright (C) Stefan (metze) Metzmacher      2003 | 
|---|
| 5 |  | 
|---|
| 6 | This program is free software; you can redistribute it and/or modify | 
|---|
| 7 | it under the terms of the GNU General Public License as published by | 
|---|
| 8 | the Free Software Foundation; either version 3 of the License, or | 
|---|
| 9 | (at your option) any later version. | 
|---|
| 10 |  | 
|---|
| 11 | This program is distributed in the hope that it will be useful, | 
|---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 14 | GNU General Public License for more details. | 
|---|
| 15 |  | 
|---|
| 16 | You should have received a copy of the GNU General Public License | 
|---|
| 17 | along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 18 | */ | 
|---|
| 19 |  | 
|---|
| 20 | #ifndef _NTQUOTAS_H | 
|---|
| 21 | #define _NTQUOTAS_H | 
|---|
| 22 |  | 
|---|
| 23 | /* | 
|---|
| 24 | * details for Quota Flags: | 
|---|
| 25 | * | 
|---|
| 26 | * 0x20 Log Limit: log if the user exceeds his Hard Quota | 
|---|
| 27 | * 0x10 Log Warn:  log if the user exceeds his Soft Quota | 
|---|
| 28 | * 0x02 Deny Disk: deny disk access when the user exceeds his Hard Quota | 
|---|
| 29 | * 0x01 Enable Quotas: enable quota for this fs | 
|---|
| 30 | * | 
|---|
| 31 | */ | 
|---|
| 32 |  | 
|---|
| 33 | #define QUOTAS_ENABLED          0x0001 | 
|---|
| 34 | #define QUOTAS_DENY_DISK        0x0002 | 
|---|
| 35 | #define QUOTAS_LOG_VIOLATIONS   0x0004 | 
|---|
| 36 | #define CONTENT_INDEX_DISABLED  0x0008 | 
|---|
| 37 | #define QUOTAS_LOG_THRESHOLD    0x0010 | 
|---|
| 38 | #define QUOTAS_LOG_LIMIT        0x0020 | 
|---|
| 39 | #define LOG_VOLUME_THRESHOLD    0x0040 | 
|---|
| 40 | #define LOG_VOLUME_LIMIT        0x0080 | 
|---|
| 41 | #define QUOTAS_INCOMPLETE       0x0100 | 
|---|
| 42 | #define QUOTAS_REBUILDING       0x0200 | 
|---|
| 43 | #define QUOTAS_0400             0x0400 | 
|---|
| 44 | #define QUOTAS_0800             0x0800 | 
|---|
| 45 | #define QUOTAS_1000             0x1000 | 
|---|
| 46 | #define QUOTAS_2000             0x2000 | 
|---|
| 47 | #define QUOTAS_4000             0x4000 | 
|---|
| 48 | #define QUOTAS_8000             0x8000 | 
|---|
| 49 |  | 
|---|
| 50 | #define SMB_NTQUOTAS_NO_LIMIT   ((uint64_t)(-1)) | 
|---|
| 51 | #define SMB_NTQUOTAS_NO_ENTRY   ((uint64_t)(-2)) | 
|---|
| 52 | #define SMB_NTQUOTAS_NO_SPACE   ((uint64_t)(0)) | 
|---|
| 53 | #define SMB_NTQUOTAS_1_B        (uint64_t)0x0000000000000001 | 
|---|
| 54 | #define SMB_NTQUOTAS_1KB        (uint64_t)0x0000000000000400 | 
|---|
| 55 | #define SMB_NTQUOTAS_1MB        (uint64_t)0x0000000000100000 | 
|---|
| 56 | #define SMB_NTQUOTAS_1GB        (uint64_t)0x0000000040000000 | 
|---|
| 57 | #define SMB_NTQUOTAS_1TB        (uint64_t)0x0000010000000000 | 
|---|
| 58 | #define SMB_NTQUOTAS_1PB        (uint64_t)0x0004000000000000 | 
|---|
| 59 | #define SMB_NTQUOTAS_1EB        (uint64_t)0x1000000000000000 | 
|---|
| 60 |  | 
|---|
| 61 | enum SMB_QUOTA_TYPE { | 
|---|
| 62 | SMB_INVALID_QUOTA_TYPE = -1, | 
|---|
| 63 | SMB_USER_FS_QUOTA_TYPE = 1, | 
|---|
| 64 | SMB_USER_QUOTA_TYPE = 2, | 
|---|
| 65 | SMB_GROUP_FS_QUOTA_TYPE = 3,/* not used yet */ | 
|---|
| 66 | SMB_GROUP_QUOTA_TYPE = 4 /* not in use yet, maybe for disk_free queries */ | 
|---|
| 67 | }; | 
|---|
| 68 |  | 
|---|
| 69 | typedef struct _SMB_NTQUOTA_STRUCT { | 
|---|
| 70 | enum SMB_QUOTA_TYPE qtype; | 
|---|
| 71 | uint64_t usedspace; | 
|---|
| 72 | uint64_t softlim; | 
|---|
| 73 | uint64_t hardlim; | 
|---|
| 74 | uint32 qflags; | 
|---|
| 75 | struct dom_sid sid; | 
|---|
| 76 | } SMB_NTQUOTA_STRUCT; | 
|---|
| 77 |  | 
|---|
| 78 | typedef struct _SMB_NTQUOTA_LIST { | 
|---|
| 79 | struct _SMB_NTQUOTA_LIST *prev,*next; | 
|---|
| 80 | TALLOC_CTX *mem_ctx; | 
|---|
| 81 | uid_t uid; | 
|---|
| 82 | SMB_NTQUOTA_STRUCT *quotas; | 
|---|
| 83 | } SMB_NTQUOTA_LIST; | 
|---|
| 84 |  | 
|---|
| 85 | typedef struct _SMB_NTQUOTA_HANDLE { | 
|---|
| 86 | bool valid; | 
|---|
| 87 | SMB_NTQUOTA_LIST *quota_list; | 
|---|
| 88 | SMB_NTQUOTA_LIST *tmp_list; | 
|---|
| 89 | } SMB_NTQUOTA_HANDLE; | 
|---|
| 90 |  | 
|---|
| 91 | #endif /*_NTQUOTAS_H */ | 
|---|