Import bind 9.5.2 vendor sources.
[dragonfly.git] / contrib / bind-9.5.2 / lib / bind / include / isc / ctl.h
blobe2ba20201d0d7f3d70135bbea6ef178cdf307203
1 #ifndef ISC_CTL_H
2 #define ISC_CTL_H
4 /*
5 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
6 * Copyright (c) 1998,1999 by Internet Software Consortium.
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
18 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 * $Id: ctl.h,v 1.5 2005/04/27 04:56:17 sra Exp $
25 /*! \file */
27 #include <sys/types.h>
28 #include <sys/socket.h>
30 #include <isc/eventlib.h>
32 /* Macros. */
34 #define CTL_MORE 0x0001 /*%< More will be / should be sent. */
35 #define CTL_EXIT 0x0002 /*%< Close connection after this. */
36 #define CTL_DATA 0x0004 /*%< Go into / this is DATA mode. */
37 /* Types. */
39 struct ctl_cctx;
40 struct ctl_sctx;
41 struct ctl_sess;
42 struct ctl_verb;
44 enum ctl_severity { ctl_debug, ctl_warning, ctl_error };
46 typedef void (*ctl_logfunc)(enum ctl_severity, const char *, ...);
48 typedef void (*ctl_verbfunc)(struct ctl_sctx *, struct ctl_sess *,
49 const struct ctl_verb *, const char *,
50 u_int, const void *, void *);
52 typedef void (*ctl_srvrdone)(struct ctl_sctx *, struct ctl_sess *, void *);
54 typedef void (*ctl_clntdone)(struct ctl_cctx *, void *, const char *, u_int);
56 struct ctl_verb {
57 const char * name;
58 ctl_verbfunc func;
59 const char * help;
62 /* General symbols. */
64 #define ctl_logger __ctl_logger
66 #ifdef __GNUC__
67 void ctl_logger(enum ctl_severity, const char *, ...)
68 __attribute__((__format__(__printf__, 2, 3)));
69 #else
70 void ctl_logger(enum ctl_severity, const char *, ...);
71 #endif
73 /* Client symbols. */
75 #define ctl_client __ctl_client
76 #define ctl_endclient __ctl_endclient
77 #define ctl_command __ctl_command
79 struct ctl_cctx * ctl_client(evContext, const struct sockaddr *, size_t,
80 const struct sockaddr *, size_t,
81 ctl_clntdone, void *,
82 u_int, ctl_logfunc);
83 void ctl_endclient(struct ctl_cctx *);
84 int ctl_command(struct ctl_cctx *, const char *, size_t,
85 ctl_clntdone, void *);
87 /* Server symbols. */
89 #define ctl_server __ctl_server
90 #define ctl_endserver __ctl_endserver
91 #define ctl_response __ctl_response
92 #define ctl_sendhelp __ctl_sendhelp
93 #define ctl_getcsctx __ctl_getcsctx
94 #define ctl_setcsctx __ctl_setcsctx
96 struct ctl_sctx * ctl_server(evContext, const struct sockaddr *, size_t,
97 const struct ctl_verb *,
98 u_int, u_int,
99 u_int, int, int,
100 ctl_logfunc, void *);
101 void ctl_endserver(struct ctl_sctx *);
102 void ctl_response(struct ctl_sess *, u_int,
103 const char *, u_int, const void *,
104 ctl_srvrdone, void *,
105 const char *, size_t);
106 void ctl_sendhelp(struct ctl_sess *, u_int);
107 void * ctl_getcsctx(struct ctl_sess *);
108 void * ctl_setcsctx(struct ctl_sess *, void *);
110 #endif /*ISC_CTL_H*/
112 /*! \file */