1121663Sharti/* 2121663Sharti * Copyright (c) 2001-2003 3121663Sharti * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4121663Sharti * All rights reserved. 5121663Sharti * 6131823Sharti * Author: Harti Brandt <harti@freebsd.org> 7131823Sharti * 8121663Sharti * Redistribution and use in source and binary forms, with or without 9121663Sharti * modification, are permitted provided that the following conditions 10121663Sharti * are met: 11121663Sharti * 1. Redistributions of source code must retain the above copyright 12121663Sharti * notice, this list of conditions and the following disclaimer. 13121663Sharti * 2. Redistributions in binary form must reproduce the above copyright 14121663Sharti * notice, this list of conditions and the following disclaimer in the 15121663Sharti * documentation and/or other materials provided with the distribution. 16121663Sharti * 17121663Sharti * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18121663Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19121663Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20121663Sharti * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21121663Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22121663Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23121663Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24121663Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25121663Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26121663Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27121663Sharti * SUCH DAMAGE. 28121663Sharti * 29146532Sharti * $Begemot: libunimsg/sscop/common.h,v 1.5 2005/05/23 11:46:16 brandt_h Exp $ 30121663Sharti * 31121663Sharti * Common declaration for the SAAL programs. 32121663Sharti */ 33121663Sharti#ifndef _SAAL_COMMON_H_ 34121663Sharti#define _SAAL_COMMON_H_ 35121663Sharti 36135923Strhodes#ifdef USE_LIBBEGEMOT 37135923Strhodes#include <rpoll.h> 38135923Strhodes#define evFileID int 39135923Strhodes#define evTimerID int 40135923Strhodes#else 41135923Strhodes#include <isc/eventlib.h> 42135923Strhodes#endif 43135923Strhodes 44121663Sharti/* 45121663Sharti * Writes to a pipe must be in messages (if we don't use framing). 46121663Sharti * It is not clear, what is the maximum message size for this. It seems 47121663Sharti * to be PIPE_BUF, but be conservative. 48121663Sharti */ 49121663Sharti#define MAXUSRMSG 4096 50121663Sharti#define MAXMSG (MAXUSRMSG+4) 51121663Sharti 52121663Shartiextern int useframe; /* use frame functions */ 53121663Shartiextern int sscopframe; /* use sscop framing */ 54121663Shartiextern u_int sscop_vflag; /* be talkative */ 55121663Shartiextern int sscop_fd; /* file descriptor for SSCOP protocol */ 56121663Shartiextern int user_fd; /* file descriptor for USER */ 57121663Shartiextern int loose; /* loose messages */ 58121663Shartiextern int user_out_fd; /* file descriptor for output to user */ 59121663Shartiextern u_int verbose; /* talk to me */ 60135923Strhodes#ifndef USE_LIBBEGEMOT 61121663Shartiextern evContext evctx; 62135923Strhodes#endif 63121663Shartiextern evFileID sscop_h; 64121663Shartiextern evFileID user_h; 65121663Sharti 66121663Shartivoid dump_buf(const char *, const u_char *, size_t); 67121663Shartistruct uni_msg *proto_msgin(int); 68121663Shartistruct uni_msg *user_msgin(int); 69121663Shartivoid proto_msgout(struct uni_msg *); 70121663Shartivoid user_msgout(struct uni_msg *); 71121663Shartivoid parse_param(struct sscop_param *, u_int *, int, char *); 72121663Sharti 73121663Shartivoid verb(const char *, ...) __printflike(1, 2); 74121663Sharti 75121663Shartivoid sscop_verbose(struct sscop *, void *, const char *, ...) 76121663Sharti __printflike(3, 4); 77121663Shartivoid *sscop_start_timer(struct sscop *, void *, u_int, void (*)(void *)); 78121663Shartivoid sscop_stop_timer(struct sscop *, void *, void *); 79121663Sharti 80121663Sharti#define VERBOSE(P) do { if (verbose & 0x0001) verb P; } while(0) 81121663Sharti 82121663Sharti#endif /* _SAAL_COMMON_H_ */ 83