1 /* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Author: Harti Brandt <harti@freebsd.org> 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * $Begemot: libunimsg/sscop/common.h,v 1.5 2005/05/23 11:46:16 brandt_h Exp $ 30 * 31 * Common declaration for the SAAL programs. 32 */ 33 #ifndef _SAAL_COMMON_H_ 34 #define _SAAL_COMMON_H_ 35 36 #ifdef USE_LIBBEGEMOT 37 #include <rpoll.h> 38 #define evFileID int 39 #define evTimerID int 40 #else 41 #include <isc/eventlib.h> 42 #endif 43 44 /* 45 * Writes to a pipe must be in messages (if we don't use framing). 46 * It is not clear, what is the maximum message size for this. It seems 47 * to be PIPE_BUF, but be conservative. 48 */ 49 #define MAXUSRMSG 4096 50 #define MAXMSG (MAXUSRMSG+4) 51 52 extern int useframe; /* use frame functions */ 53 extern int sscopframe; /* use sscop framing */ 54 extern u_int sscop_vflag; /* be talkative */ 55 extern int sscop_fd; /* file descriptor for SSCOP protocol */ 56 extern int user_fd; /* file descriptor for USER */ 57 extern int loose; /* loose messages */ 58 extern int user_out_fd; /* file descriptor for output to user */ 59 extern u_int verbose; /* talk to me */ 60 #ifndef USE_LIBBEGEMOT 61 extern evContext evctx; 62 #endif 63 extern evFileID sscop_h; 64 extern evFileID user_h; 65 66 void dump_buf(const char *, const u_char *, size_t); 67 struct uni_msg *proto_msgin(int); 68 struct uni_msg *user_msgin(int); 69 void proto_msgout(struct uni_msg *); 70 void user_msgout(struct uni_msg *); 71 void parse_param(struct sscop_param *, u_int *, int, char *); 72 73 void verb(const char *, ...) __printflike(1, 2); 74 75 void sscop_verbose(struct sscop *, void *, const char *, ...) 76 __printflike(3, 4); 77 void *sscop_start_timer(struct sscop *, void *, u_int, void (*)(void *)); 78 void sscop_stop_timer(struct sscop *, void *, void *); 79 80 #define VERBOSE(P) do { if (verbose & 0x0001) verb P; } while(0) 81 82 #endif /* _SAAL_COMMON_H_ */ 83