10Sstevel@tonic-gate #ifndef ISC_CTL_H 20Sstevel@tonic-gate #define ISC_CTL_H 30Sstevel@tonic-gate 40Sstevel@tonic-gate /* 5*11038SRao.Shoaib@Sun.COM * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 60Sstevel@tonic-gate * Copyright (c) 1998,1999 by Internet Software Consortium. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * Permission to use, copy, modify, and distribute this software for any 90Sstevel@tonic-gate * purpose with or without fee is hereby granted, provided that the above 100Sstevel@tonic-gate * copyright notice and this permission notice appear in all copies. 110Sstevel@tonic-gate * 12*11038SRao.Shoaib@Sun.COM * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 13*11038SRao.Shoaib@Sun.COM * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14*11038SRao.Shoaib@Sun.COM * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 15*11038SRao.Shoaib@Sun.COM * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16*11038SRao.Shoaib@Sun.COM * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17*11038SRao.Shoaib@Sun.COM * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 18*11038SRao.Shoaib@Sun.COM * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 190Sstevel@tonic-gate */ 200Sstevel@tonic-gate 210Sstevel@tonic-gate /* 22*11038SRao.Shoaib@Sun.COM * $Id: ctl.h,v 1.5 2005/04/27 04:56:17 sra Exp $ 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 25*11038SRao.Shoaib@Sun.COM /*! \file */ 26*11038SRao.Shoaib@Sun.COM 270Sstevel@tonic-gate #include <sys/types.h> 280Sstevel@tonic-gate #include <sys/socket.h> 290Sstevel@tonic-gate 300Sstevel@tonic-gate #include <isc/eventlib.h> 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* Macros. */ 330Sstevel@tonic-gate 34*11038SRao.Shoaib@Sun.COM #define CTL_MORE 0x0001 /*%< More will be / should be sent. */ 35*11038SRao.Shoaib@Sun.COM #define CTL_EXIT 0x0002 /*%< Close connection after this. */ 36*11038SRao.Shoaib@Sun.COM #define CTL_DATA 0x0004 /*%< Go into / this is DATA mode. */ 370Sstevel@tonic-gate /* Types. */ 380Sstevel@tonic-gate 390Sstevel@tonic-gate struct ctl_cctx; 400Sstevel@tonic-gate struct ctl_sctx; 410Sstevel@tonic-gate struct ctl_sess; 420Sstevel@tonic-gate struct ctl_verb; 430Sstevel@tonic-gate 440Sstevel@tonic-gate enum ctl_severity { ctl_debug, ctl_warning, ctl_error }; 450Sstevel@tonic-gate 46*11038SRao.Shoaib@Sun.COM typedef void (*ctl_logfunc)(enum ctl_severity, const char *, ...); 470Sstevel@tonic-gate 480Sstevel@tonic-gate typedef void (*ctl_verbfunc)(struct ctl_sctx *, struct ctl_sess *, 49*11038SRao.Shoaib@Sun.COM const struct ctl_verb *, const char *, 50*11038SRao.Shoaib@Sun.COM u_int, const void *, void *); 510Sstevel@tonic-gate 520Sstevel@tonic-gate typedef void (*ctl_srvrdone)(struct ctl_sctx *, struct ctl_sess *, void *); 530Sstevel@tonic-gate 540Sstevel@tonic-gate typedef void (*ctl_clntdone)(struct ctl_cctx *, void *, const char *, u_int); 550Sstevel@tonic-gate 560Sstevel@tonic-gate struct ctl_verb { 570Sstevel@tonic-gate const char * name; 580Sstevel@tonic-gate ctl_verbfunc func; 590Sstevel@tonic-gate const char * help; 600Sstevel@tonic-gate }; 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* General symbols. */ 630Sstevel@tonic-gate 640Sstevel@tonic-gate #define ctl_logger __ctl_logger 650Sstevel@tonic-gate 660Sstevel@tonic-gate #ifdef __GNUC__ 670Sstevel@tonic-gate void ctl_logger(enum ctl_severity, const char *, ...) 680Sstevel@tonic-gate __attribute__((__format__(__printf__, 2, 3))); 690Sstevel@tonic-gate #else 700Sstevel@tonic-gate void ctl_logger(enum ctl_severity, const char *, ...); 710Sstevel@tonic-gate #endif 720Sstevel@tonic-gate 730Sstevel@tonic-gate /* Client symbols. */ 740Sstevel@tonic-gate 750Sstevel@tonic-gate #define ctl_client __ctl_client 760Sstevel@tonic-gate #define ctl_endclient __ctl_endclient 770Sstevel@tonic-gate #define ctl_command __ctl_command 780Sstevel@tonic-gate 790Sstevel@tonic-gate struct ctl_cctx * ctl_client(evContext, const struct sockaddr *, size_t, 800Sstevel@tonic-gate const struct sockaddr *, size_t, 810Sstevel@tonic-gate ctl_clntdone, void *, 820Sstevel@tonic-gate u_int, ctl_logfunc); 830Sstevel@tonic-gate void ctl_endclient(struct ctl_cctx *); 840Sstevel@tonic-gate int ctl_command(struct ctl_cctx *, const char *, size_t, 850Sstevel@tonic-gate ctl_clntdone, void *); 860Sstevel@tonic-gate 870Sstevel@tonic-gate /* Server symbols. */ 880Sstevel@tonic-gate 890Sstevel@tonic-gate #define ctl_server __ctl_server 900Sstevel@tonic-gate #define ctl_endserver __ctl_endserver 910Sstevel@tonic-gate #define ctl_response __ctl_response 920Sstevel@tonic-gate #define ctl_sendhelp __ctl_sendhelp 930Sstevel@tonic-gate #define ctl_getcsctx __ctl_getcsctx 940Sstevel@tonic-gate #define ctl_setcsctx __ctl_setcsctx 950Sstevel@tonic-gate 960Sstevel@tonic-gate struct ctl_sctx * ctl_server(evContext, const struct sockaddr *, size_t, 970Sstevel@tonic-gate const struct ctl_verb *, 980Sstevel@tonic-gate u_int, u_int, 990Sstevel@tonic-gate u_int, int, int, 1000Sstevel@tonic-gate ctl_logfunc, void *); 1010Sstevel@tonic-gate void ctl_endserver(struct ctl_sctx *); 1020Sstevel@tonic-gate void ctl_response(struct ctl_sess *, u_int, 1030Sstevel@tonic-gate const char *, u_int, const void *, 1040Sstevel@tonic-gate ctl_srvrdone, void *, 1050Sstevel@tonic-gate const char *, size_t); 1060Sstevel@tonic-gate void ctl_sendhelp(struct ctl_sess *, u_int); 1070Sstevel@tonic-gate void * ctl_getcsctx(struct ctl_sess *); 1080Sstevel@tonic-gate void * ctl_setcsctx(struct ctl_sess *, void *); 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate #endif /*ISC_CTL_H*/ 111*11038SRao.Shoaib@Sun.COM 112*11038SRao.Shoaib@Sun.COM /*! \file */ 113