]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - usr.bin/csup/config.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / usr.bin / csup / config.h
1 /*-
2  * Copyright (c) 2003-2006, Maxime Henrion <mux@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 #ifndef _CONFIG_H_
29 #define _CONFIG_H_
30
31 #include <sys/types.h>
32 #include <sys/socket.h>
33
34 #include <time.h>
35
36 #include "fattr.h"
37 #include "queue.h"
38 #include "misc.h"
39
40 /*
41  * Collection options.
42  */
43 #define CO_BACKUP               0x00000001
44 #define CO_DELETE               0x00000002
45 #define CO_KEEP                 0x00000004
46 #define CO_OLD                  0x00000008
47 #define CO_UNLINKBUSY           0x00000010
48 #define CO_NOUPDATE             0x00000020
49 #define CO_COMPRESS             0x00000040
50 #define CO_USERELSUFFIX         0x00000080
51 #define CO_EXACTRCS             0x00000100
52 #define CO_CHECKRCS             0x00000200
53 #define CO_SKIP                 0x00000400
54 #define CO_CHECKOUTMODE         0x00000800
55 #define CO_NORSYNC              0x00001000
56 #define CO_KEEPBADFILES         0x00002000
57 #define CO_EXECUTE              0x00004000
58 #define CO_SETOWNER             0x00008000
59 #define CO_SETMODE              0x00010000
60 #define CO_SETFLAGS             0x00020000
61 #define CO_NORCS                0x00040000
62 #define CO_STRICTCHECKRCS       0x00080000
63 #define CO_TRUSTSTATUSFILE      0x00100000
64 #define CO_DODELETESONLY        0x00200000
65 #define CO_DETAILALLRCSFILES    0x00400000
66
67 #define CO_MASK                 0x007fffff
68
69 /* Options that the server is allowed to set. */
70 #define CO_SERVMAYSET           (CO_SKIP | CO_NORSYNC | CO_NORCS)
71 /* Options that the server is allowed to clear. */
72 #define CO_SERVMAYCLEAR         CO_CHECKRCS
73
74 struct coll {
75         char *co_name;
76         char *co_host;
77         char *co_base;
78         char *co_date;
79         char *co_prefix;
80         size_t co_prefixlen;
81         char *co_release;
82         char *co_tag;
83         char *co_cvsroot;
84         int co_attrignore;
85         struct pattlist *co_accepts;
86         struct pattlist *co_refusals;
87         struct globtree *co_dirfilter;
88         struct globtree *co_filefilter;
89         struct globtree *co_norsync;
90         const char *co_colldir;
91         char *co_listsuffix;
92         time_t co_scantime;             /* Set by the detailer thread. */
93         int co_options;
94         mode_t co_umask;
95         struct keyword *co_keyword;
96         STAILQ_ENTRY(coll) co_next;
97 };
98
99 struct config {
100         STAILQ_HEAD(, coll) colls;
101         struct fixups *fixups;
102         char *host;
103         struct sockaddr *laddr;
104         socklen_t laddrlen;
105         int deletelim;
106         int socket;
107         struct chan *chan0;
108         struct chan *chan1;
109         struct stream *server;
110         fattr_support_t fasupport;
111         int reqauth;
112 };
113
114 struct config   *config_init(const char *, struct coll *, int);
115 int              config_checkcolls(struct config *);
116 void             config_free(struct config *);
117
118 struct coll     *coll_new(struct coll *);
119 void             coll_override(struct coll *, struct coll *, int);
120 char            *coll_statuspath(struct coll *);
121 char            *coll_statussuffix(struct coll *);
122 void             coll_add(char *);
123 void             coll_free(struct coll *);
124 void             coll_setdef(void);
125 void             coll_setopt(int, char *);
126
127 #endif /* !_CONFIG_H_ */