Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
safe_id_range_list.h
1 /* safe_id_range_list.h. Generated by configure. */
2 #ifndef SAFE_ID_RANGE_LIST_H_
3 #define SAFE_ID_RANGE_LIST_H_
4 
5 /*
6  * safefile package http://www.cs.wisc.edu/~kupsch/safefile
7  *
8  * Copyright 2007-2008 James A. Kupsch
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 
24 #include <sys/stat.h>
25 #include <sys/types.h>
26 #include <unistd.h>
27 #include <limits.h>
28 
29 
30 /* define id_t to uid_t if not defined */
31 /* #undef id_t */
32 
33 
34 /* id used when an error occurs */
35 extern const id_t safe_err_id;
36 
37 
38 /* declare implementation data structure type */
39 struct safe_id_range_list_elem;
40 
41 
42 typedef struct safe_id_range_list
43 {
44  size_t count;
45  size_t capacity;
46  struct safe_id_range_list_elem *list;
47 } safe_id_range_list;
48 
49 
50 int safe_init_id_range_list(safe_id_range_list *list);
51 int safe_add_id_range_to_list(safe_id_range_list *list, id_t min_id, id_t max_id);
52 int safe_add_id_to_list(safe_id_range_list *list, id_t id);
53 void safe_destroy_id_range_list(safe_id_range_list *list);
54 int safe_is_id_in_list(safe_id_range_list *list, id_t id);
55 int safe_is_id_list_empty(safe_id_range_list *list);
56 
57 uid_t safe_strto_uid(const char *value, const char **endptr);
58 gid_t safe_strto_gid(const char *value, const char **endptr);
59 id_t safe_strto_id(const char *value, const char **endptr);
60 void safe_strto_id_list(safe_id_range_list *list, const char *value, const char **endptr);
61 void safe_strto_uid_list(safe_id_range_list *list, const char *value, const char **endptr);
62 void safe_strto_gid_list(safe_id_range_list *list, const char *value, const char **endptr);
63 int safe_parse_id_list(safe_id_range_list *list, const char *value);
64 int safe_parse_uid_list(safe_id_range_list *list, const char *value);
65 int safe_parse_gid_list(safe_id_range_list *list, const char *value);
66 
67 
68 #endif