conf.h revision 303975
1139969Simp/*	$NetBSD: conf.h,v 1.6 2015/01/27 19:40:36 christos Exp $	*/
21556Srgrimes
31556Srgrimes/*-
41556Srgrimes * Copyright (c) 2015 The NetBSD Foundation, Inc.
51556Srgrimes * All rights reserved.
61556Srgrimes *
71556Srgrimes * This code is derived from software contributed to The NetBSD Foundation
81556Srgrimes * by Christos Zoulas.
91556Srgrimes *
101556Srgrimes * Redistribution and use in source and binary forms, with or without
111556Srgrimes * modification, are permitted provided that the following conditions
121556Srgrimes * are met:
131556Srgrimes * 1. Redistributions of source code must retain the above copyright
141556Srgrimes *    notice, this list of conditions and the following disclaimer.
151556Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161556Srgrimes *    notice, this list of conditions and the following disclaimer in the
171556Srgrimes *    documentation and/or other materials provided with the distribution.
181556Srgrimes *
191556Srgrimes * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201556Srgrimes * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211556Srgrimes * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221556Srgrimes * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231556Srgrimes * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241556Srgrimes * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251556Srgrimes * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261556Srgrimes * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271556Srgrimes * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281556Srgrimes * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291556Srgrimes * POSSIBILITY OF SUCH DAMAGE.
301556Srgrimes */
311556Srgrimes#ifndef _CONF_H
3217987Speter#define _CONF_H
3350471Speter
341556Srgrimes#include <sys/socket.h>
351556Srgrimes
361556Srgrimesstruct conf {
371556Srgrimes	struct sockaddr_storage	c_ss;
381556Srgrimes	int			c_lmask;
391556Srgrimes	int			c_port;
401556Srgrimes	int			c_proto;
411556Srgrimes	int			c_family;
421556Srgrimes	int			c_uid;
431556Srgrimes	int			c_nfail;
441556Srgrimes	char			c_name[128];
451556Srgrimes	int			c_rmask;
461556Srgrimes	int			c_duration;
471556Srgrimes};
481556Srgrimes
491556Srgrimesstruct confset {
501556Srgrimes	struct conf *cs_c;
511556Srgrimes	size_t cs_n;
521556Srgrimes	size_t cs_m;
531556Srgrimes};
541556Srgrimes
551556Srgrimes#define CONFNAMESZ sizeof(((struct conf *)0)->c_name)
561556Srgrimes
571556Srgrimes__BEGIN_DECLS
581556Srgrimesconst char *conf_print(char *, size_t, const char *, const char *,
591556Srgrimes    const struct conf *);
601556Srgrimesvoid conf_parse(const char *);
611556Srgrimesconst struct conf *conf_find(int, uid_t, const struct sockaddr_storage *,
621556Srgrimes    struct conf *);
631556Srgrimes__END_DECLS
641556Srgrimes
651556Srgrimes#endif /* _CONF_H */
661556Srgrimes