common.h revision 121663
1/* 2 * Copyright (c) 2001-2003 3 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * Author: Harti Brandt <harti@freebsd.org> 28 * 29 * $Begemot: libunimsg/sscop/common.h,v 1.3 2003/09/19 13:10:35 hbb 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