1 #ifndef _PROJENT_PROJENT_H
2 #define _PROJENT_PROJENT_H
3
4 #include <sys/types.h>
5 #include <regex.h>
6 #include <project.h>
7 #include <sys/varargs.h>
8
9 #include "lst.h"
10
11 #define F_PAR_VLD 0x0001 /* Run validation after parsing */
12 #define F_PAR_SPC 0x0002 /* Allow spaces between names */
13 #define F_PAR_UNT 0x0004 /* Allow units in attribs values */
14 #define F_PAR_RES 0x0008 /* Allow projid < 100 */
15 #define F_PAR_DUP 0x0010 /* Allow duplicate projids */
16
17 #define F_MOD_ADD 0x0100
18 #define F_MOD_REM 0x0200
19 #define F_MOD_SUB 0x0400
20 #define F_MOD_REP 0x0800
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26
27 typedef struct projent {
28 char *projname;
29 projid_t projid;
30 char *comment;
31 char *userlist;
32 char *grouplist;
33 lst_t *attrs;
34 } projent_t;
35
36
37 extern void projent_free(projent_t *);
38 extern projent_t *projent_parse(char *, int, lst_t *);
39 extern projent_t *projent_parse_components(char *, char *, char *, char *,
40 char *, char *, int, lst_t *);
41 extern int projent_validate(projent_t *, int, lst_t *);
42 extern lst_t *projent_get_lst(char *, int, lst_t *);
43 extern void projent_free_lst(lst_t *);
44 extern int projent_parse_name(char *, lst_t *);
45 extern int projent_validate_unique_name(lst_t *, char *, lst_t *);
46 extern int projent_parse_projid(char *, projid_t *, lst_t *);
47 extern int projent_validate_projid(projid_t, int, lst_t *);
48 extern int projent_validate_unique_id(lst_t *, projid_t, lst_t *);
49 extern int projent_parse_comment(char *, lst_t *);
50 extern void projent_merge_usrgrp(char *, char **, char *, int, lst_t *);
51 extern char *projent_parse_users(char *, int, lst_t *);
52 extern char *projent_parse_groups(char *, int, lst_t *);
53 extern void projent_merge_attributes(lst_t **, lst_t *, int, lst_t *);
54 extern lst_t *projent_parse_attributes(char *, int, lst_t *);
55 extern void projent_sort_attributes(lst_t *);
56 extern void projent_free_attributes(lst_t *);
57 extern char *projent_attrib_tostring(void *);
58 extern char *projent_attrib_lst_tostring(lst_t *);
59 extern void projent_put_lst(char *, lst_t *, lst_t *);
60
61 #ifdef __cplusplus
62 }
63 #endif
64
65 #endif /* _PROJENT_PROJENT_H */