1156230Smux/*-
2156230Smux * Copyright (c) 2003-2006, Maxime Henrion <mux@FreeBSD.org>
3156230Smux * All rights reserved.
4156230Smux *
5156230Smux * Redistribution and use in source and binary forms, with or without
6156230Smux * modification, are permitted provided that the following conditions
7156230Smux * are met:
8156230Smux * 1. Redistributions of source code must retain the above copyright
9156230Smux *    notice, this list of conditions and the following disclaimer.
10156230Smux * 2. Redistributions in binary form must reproduce the above copyright
11156230Smux *    notice, this list of conditions and the following disclaimer in the
12156230Smux *    documentation and/or other materials provided with the distribution.
13156230Smux *
14156230Smux * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15156230Smux * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16156230Smux * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17156230Smux * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18156230Smux * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19156230Smux * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20156230Smux * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21156230Smux * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22156230Smux * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23156230Smux * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24156230Smux * SUCH DAMAGE.
25156230Smux *
26156230Smux * $FreeBSD$
27156230Smux */
28156230Smux#ifndef _CONFIG_H_
29156230Smux#define _CONFIG_H_
30156230Smux
31156230Smux#include <sys/types.h>
32156230Smux#include <sys/socket.h>
33156230Smux
34156230Smux#include <time.h>
35156230Smux
36156230Smux#include "fattr.h"
37156230Smux#include "queue.h"
38156230Smux#include "misc.h"
39156230Smux
40156230Smux/*
41156230Smux * Collection options.
42156230Smux */
43156230Smux#define	CO_BACKUP		0x00000001
44156230Smux#define	CO_DELETE		0x00000002
45156230Smux#define	CO_KEEP			0x00000004
46156230Smux#define	CO_OLD			0x00000008
47156230Smux#define	CO_UNLINKBUSY		0x00000010
48156230Smux#define	CO_NOUPDATE		0x00000020
49156230Smux#define	CO_COMPRESS		0x00000040
50156230Smux#define	CO_USERELSUFFIX		0x00000080
51156230Smux#define	CO_EXACTRCS		0x00000100
52156230Smux#define	CO_CHECKRCS		0x00000200
53156230Smux#define	CO_SKIP			0x00000400
54156230Smux#define	CO_CHECKOUTMODE		0x00000800
55156230Smux#define	CO_NORSYNC		0x00001000
56156230Smux#define	CO_KEEPBADFILES		0x00002000
57156230Smux#define	CO_EXECUTE		0x00004000
58156230Smux#define	CO_SETOWNER		0x00008000
59156230Smux#define	CO_SETMODE		0x00010000
60156230Smux#define	CO_SETFLAGS		0x00020000
61156230Smux#define	CO_NORCS		0x00040000
62156230Smux#define	CO_STRICTCHECKRCS	0x00080000
63156230Smux#define	CO_TRUSTSTATUSFILE	0x00100000
64156230Smux#define	CO_DODELETESONLY	0x00200000
65156230Smux#define	CO_DETAILALLRCSFILES	0x00400000
66156230Smux
67156230Smux#define	CO_MASK			0x007fffff
68156230Smux
69156230Smux/* Options that the server is allowed to set. */
70156230Smux#define	CO_SERVMAYSET		(CO_SKIP | CO_NORSYNC | CO_NORCS)
71156230Smux/* Options that the server is allowed to clear. */
72156230Smux#define	CO_SERVMAYCLEAR		CO_CHECKRCS
73156230Smux
74156230Smuxstruct coll {
75156230Smux	char *co_name;
76156230Smux	char *co_host;
77156230Smux	char *co_base;
78156230Smux	char *co_date;
79156230Smux	char *co_prefix;
80156230Smux	size_t co_prefixlen;
81156230Smux	char *co_release;
82156230Smux	char *co_tag;
83156230Smux	char *co_cvsroot;
84156230Smux	int co_attrignore;
85156230Smux	struct pattlist *co_accepts;
86156230Smux	struct pattlist *co_refusals;
87156230Smux	struct globtree *co_dirfilter;
88156230Smux	struct globtree *co_filefilter;
89156701Smux	struct globtree *co_norsync;
90156230Smux	const char *co_colldir;
91156230Smux	char *co_listsuffix;
92156230Smux	time_t co_scantime;		/* Set by the detailer thread. */
93156230Smux	int co_options;
94156230Smux	mode_t co_umask;
95156230Smux	struct keyword *co_keyword;
96156230Smux	STAILQ_ENTRY(coll) co_next;
97156230Smux};
98156230Smux
99156230Smuxstruct config {
100156230Smux	STAILQ_HEAD(, coll) colls;
101156230Smux	struct fixups *fixups;
102156230Smux	char *host;
103156230Smux	struct sockaddr *laddr;
104156230Smux	socklen_t laddrlen;
105156701Smux	int deletelim;
106156230Smux	int socket;
107156230Smux	struct chan *chan0;
108156230Smux	struct chan *chan1;
109156230Smux	struct stream *server;
110156230Smux	fattr_support_t fasupport;
111203368Slulf	int reqauth;
112156230Smux};
113156230Smux
114156230Smuxstruct config	*config_init(const char *, struct coll *, int);
115156230Smuxint		 config_checkcolls(struct config *);
116156230Smuxvoid		 config_free(struct config *);
117156230Smux
118156230Smuxstruct coll	*coll_new(struct coll *);
119156230Smuxvoid		 coll_override(struct coll *, struct coll *, int);
120156230Smuxchar		*coll_statuspath(struct coll *);
121156230Smuxchar		*coll_statussuffix(struct coll *);
122156230Smuxvoid		 coll_add(char *);
123156230Smuxvoid		 coll_free(struct coll *);
124156230Smuxvoid		 coll_setdef(void);
125156230Smuxvoid		 coll_setopt(int, char *);
126156230Smux
127156230Smux#endif /* !_CONFIG_H_ */
128