xref: /dflybsd-src/sbin/rconfig/defs.h (revision 063db479f3174a9a9add20a81493257ff0e0d565)
186ed60a6SMatthew Dillon /*
286ed60a6SMatthew Dillon  * DEFS.H
386ed60a6SMatthew Dillon  *
47a25b4e0SMatthew Dillon  * Copyright (c) 2003,2004 The DragonFly Project.  All rights reserved.
57a25b4e0SMatthew Dillon  *
67a25b4e0SMatthew Dillon  * This code is derived from software contributed to The DragonFly Project
77a25b4e0SMatthew Dillon  * by Matthew Dillon <dillon@backplane.com>
87a25b4e0SMatthew Dillon  *
97a25b4e0SMatthew Dillon  * Redistribution and use in source and binary forms, with or without
107a25b4e0SMatthew Dillon  * modification, are permitted provided that the following conditions
117a25b4e0SMatthew Dillon  * are met:
127a25b4e0SMatthew Dillon  *
137a25b4e0SMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
147a25b4e0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
157a25b4e0SMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
167a25b4e0SMatthew Dillon  *    notice, this list of conditions and the following disclaimer in
177a25b4e0SMatthew Dillon  *    the documentation and/or other materials provided with the
187a25b4e0SMatthew Dillon  *    distribution.
197a25b4e0SMatthew Dillon  * 3. Neither the name of The DragonFly Project nor the names of its
207a25b4e0SMatthew Dillon  *    contributors may be used to endorse or promote products derived
217a25b4e0SMatthew Dillon  *    from this software without specific, prior written permission.
227a25b4e0SMatthew Dillon  *
237a25b4e0SMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
247a25b4e0SMatthew Dillon  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
257a25b4e0SMatthew Dillon  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
267a25b4e0SMatthew Dillon  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
277a25b4e0SMatthew Dillon  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
287a25b4e0SMatthew Dillon  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
297a25b4e0SMatthew Dillon  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
307a25b4e0SMatthew Dillon  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
317a25b4e0SMatthew Dillon  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
327a25b4e0SMatthew Dillon  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
337a25b4e0SMatthew Dillon  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
347a25b4e0SMatthew Dillon  * SUCH DAMAGE.
3586ed60a6SMatthew Dillon  */
3686ed60a6SMatthew Dillon 
37c267c24aSJoerg Sonnenberger #include <sys/param.h>
3886ed60a6SMatthew Dillon #include <sys/file.h>
3986ed60a6SMatthew Dillon #include <sys/stat.h>
4086ed60a6SMatthew Dillon #include <sys/ioctl.h>
4186ed60a6SMatthew Dillon #include <sys/socket.h>
4286ed60a6SMatthew Dillon #include <sys/sockio.h>
4386ed60a6SMatthew Dillon #include <sys/sysctl.h>
4486ed60a6SMatthew Dillon #include <sys/wait.h>
4586ed60a6SMatthew Dillon 
4686ed60a6SMatthew Dillon #include <net/ethernet.h>
4786ed60a6SMatthew Dillon #include <net/if.h>
4886ed60a6SMatthew Dillon #include <net/if_var.h>
4986ed60a6SMatthew Dillon #include <net/if_dl.h>
5086ed60a6SMatthew Dillon #include <net/if_types.h>
5186ed60a6SMatthew Dillon #include <net/route.h>
5286ed60a6SMatthew Dillon 
5386ed60a6SMatthew Dillon #include <netinet/in.h>
5486ed60a6SMatthew Dillon #include <netinet/in_var.h>
5586ed60a6SMatthew Dillon #include <arpa/inet.h>
5686ed60a6SMatthew Dillon #include <netdb.h>
5786ed60a6SMatthew Dillon 
5886ed60a6SMatthew Dillon #include <stdio.h>
5986ed60a6SMatthew Dillon #include <stdlib.h>
6086ed60a6SMatthew Dillon #include <stdarg.h>
6186ed60a6SMatthew Dillon #include <unistd.h>
6286ed60a6SMatthew Dillon #include <string.h>
6386ed60a6SMatthew Dillon #include <fcntl.h>
6486ed60a6SMatthew Dillon #include <errno.h>
6586ed60a6SMatthew Dillon #include <signal.h>
6686ed60a6SMatthew Dillon 
6786ed60a6SMatthew Dillon typedef struct tag {
6886ed60a6SMatthew Dillon     struct tag *next;
6986ed60a6SMatthew Dillon     const char *name;
7086ed60a6SMatthew Dillon     int flags;
7186ed60a6SMatthew Dillon } *tag_t;
7286ed60a6SMatthew Dillon 
7386ed60a6SMatthew Dillon #define PAS_ALPHA	0x0001
74*063db479SAaron LI #define PAS_SYMBOL	0x0002
75*063db479SAaron LI #define PAS_NUMERIC	0x0004
76*063db479SAaron LI #define PAS_ANY		0x0008
7786ed60a6SMatthew Dillon 
7886ed60a6SMatthew Dillon extern const char *TagDir;
7986ed60a6SMatthew Dillon extern const char *WorkDir;
8086ed60a6SMatthew Dillon extern const char *ConfigFiles;
8186ed60a6SMatthew Dillon extern tag_t AddrBase;
8286ed60a6SMatthew Dillon extern tag_t VarBase;
8386ed60a6SMatthew Dillon extern int VerboseOpt;
8486ed60a6SMatthew Dillon 
8586ed60a6SMatthew Dillon extern void doServer(void);
8686ed60a6SMatthew Dillon extern void doClient(void);
8786ed60a6SMatthew Dillon 
8886ed60a6SMatthew Dillon const char *parse_str(char **scanp, int flags);
8986ed60a6SMatthew Dillon int udp_transact(struct sockaddr_in *sain, struct sockaddr_in *rsin, int *pfd,
90b58f1e66SSascha Wildner 	char **bufp, int *lenp, const char *ctl, ...) __printflike(6, 7);
9186ed60a6SMatthew Dillon int tcp_transact(struct sockaddr_in *sain, FILE **pfi, FILE **pfo, char **bufp,
92b58f1e66SSascha Wildner 	int *lenp, const char *ctl, ...) __printf0like(6, 7);
9386ed60a6SMatthew Dillon 
9486ed60a6SMatthew Dillon 
95