common.h revision 131823
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.4 2004/07/08 08:22:27 brandt Exp $ 30 * 31 * Common declaration for the SAAL programs. 32 */ 33#ifndef _SAAL_COMMON_H_ 34#define _SAAL_COMMON_H_ 35 36/* 37 * Writes to a pipe must be in messages (if we don't use framing). 38 * It is not clear, what is the maximum message size for this. It seems 39 * to be PIPE_BUF, but be conservative. 40 */ 41#define MAXUSRMSG 4096 42#define MAXMSG (MAXUSRMSG+4) 43 44extern int useframe; /* use frame functions */ 45extern int sscopframe; /* use sscop framing */ 46extern u_int sscop_vflag; /* be talkative */ 47extern int sscop_fd; /* file descriptor for SSCOP protocol */ 48extern int user_fd; /* file descriptor for USER */ 49extern int loose; /* loose messages */ 50extern int user_out_fd; /* file descriptor for output to user */ 51extern u_int verbose; /* talk to me */ 52extern evContext evctx; 53extern evFileID sscop_h; 54extern evFileID user_h; 55 56void dump_buf(const char *, const u_char *, size_t); 57struct uni_msg *proto_msgin(int); 58struct uni_msg *user_msgin(int); 59void proto_msgout(struct uni_msg *); 60void user_msgout(struct uni_msg *); 61void parse_param(struct sscop_param *, u_int *, int, char *); 62 63void verb(const char *, ...) __printflike(1, 2); 64 65void sscop_verbose(struct sscop *, void *, const char *, ...) 66 __printflike(3, 4); 67void *sscop_start_timer(struct sscop *, void *, u_int, void (*)(void *)); 68void sscop_stop_timer(struct sscop *, void *, void *); 69 70#define VERBOSE(P) do { if (verbose & 0x0001) verb P; } while(0) 71 72#endif /* _SAAL_COMMON_H_ */ 73