1121326Sharti/* 2121326Sharti * Copyright (c) 1996-2003 3121326Sharti * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 4121326Sharti * All rights reserved. 5121326Sharti * 6121326Sharti * Redistribution and use in source and binary forms, with or without 7121326Sharti * modification, are permitted provided that the following conditions 8121326Sharti * are met: 9121326Sharti * 1. Redistributions of source code must retain the above copyright 10121326Sharti * notice, this list of conditions and the following disclaimer. 11121326Sharti * 2. Redistributions in binary form must reproduce the above copyright 12121326Sharti * notice, this list of conditions and the following disclaimer in the 13121326Sharti * documentation and/or other materials provided with the distribution. 14121326Sharti * 15121326Sharti * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16121326Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17121326Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18121326Sharti * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19121326Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20121326Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21121326Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22121326Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23121326Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24121326Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25121326Sharti * SUCH DAMAGE. 26121326Sharti * 27121326Sharti * Author: Hartmut Brandt <harti@freebsd.org> 28121326Sharti * 29131826Sharti * $Begemot: libunimsg/netnatm/saal/sscop.h,v 1.4 2004/07/08 08:22:16 brandt Exp $ 30121326Sharti * 31121326Sharti * External interface to sscop. 32121326Sharti */ 33121326Sharti#ifndef _NETNATM_SAAL_SSCOP_H_ 34121326Sharti#define _NETNATM_SAAL_SSCOP_H_ 35121326Sharti 36121326Sharti#include <netnatm/saal/sscopdef.h> 37121326Sharti 38121326Sharti/* 39121326Sharti * Define how a buffer looks like. 40121326Sharti */ 41121326Sharti#ifdef _KERNEL 42121326Sharti#ifdef __FreeBSD__ 43121326Sharti#define SSCOP_MBUF_T mbuf 44121326Sharti#endif 45121326Sharti#else 46121326Sharti#define SSCOP_MBUF_T uni_msg 47121326Sharti#endif 48121326Sharti 49121326Shartistruct SSCOP_MBUF_T; 50121326Shartistruct sscop; 51121326Sharti 52121326Sharti/* 53121326Sharti * Vector for user functions 54121326Sharti */ 55121326Shartistruct sscop_funcs { 56121326Sharti /* management signal from SSCOP */ 57121326Sharti void (*send_manage)(struct sscop *, void *, enum sscop_maasig, 58121326Sharti struct SSCOP_MBUF_T *, u_int, u_int); 59121326Sharti 60121326Sharti /* AAL signal from SSCOP */ 61121326Sharti void (*send_upper)(struct sscop *, void *, enum sscop_aasig, 62121326Sharti struct SSCOP_MBUF_T *, u_int); 63121326Sharti 64121326Sharti /* send a PDU to the wire */ 65121326Sharti void (*send_lower)(struct sscop *, void *, 66121326Sharti struct SSCOP_MBUF_T *); 67121326Sharti 68121326Sharti /* print a message */ 69121326Sharti void (*verbose)(struct sscop *, void *, const char *, ...) 70121326Sharti __printflike(3,4); 71121326Sharti 72121326Sharti#ifndef _KERNEL 73121326Sharti /* start a timer */ 74121326Sharti void *(*start_timer)(struct sscop *, void *, u_int, 75121326Sharti void (*)(void *)); 76121326Sharti 77121326Sharti /* stop a timer */ 78121326Sharti void (*stop_timer)(struct sscop *, void *, void *); 79121326Sharti#endif 80121326Sharti}; 81121326Sharti 82121326Sharti/* Function defined by the SSCOP code */ 83121326Sharti 84121326Sharti/* create a new SSCOP instance and initialize to default values */ 85121326Shartistruct sscop *sscop_create(void *, const struct sscop_funcs *); 86121326Sharti 87121326Sharti/* destroy an SSCOP instance */ 88121326Shartivoid sscop_destroy(struct sscop *); 89121326Sharti 90121326Sharti/* get the current parameters of an SSCOP */ 91121326Shartivoid sscop_getparam(const struct sscop *, struct sscop_param *); 92121326Sharti 93121326Sharti/* set new parameters in an SSCOP */ 94121326Shartiint sscop_setparam(struct sscop *, struct sscop_param *, u_int *); 95121326Sharti 96121326Sharti/* deliver an signal to the SSCOP */ 97121326Shartiint sscop_aasig(struct sscop *, enum sscop_aasig, struct SSCOP_MBUF_T *, u_int); 98121326Sharti 99121326Sharti/* deliver an management signal to the SSCOP */ 100121326Shartiint sscop_maasig(struct sscop *, enum sscop_maasig, struct SSCOP_MBUF_T *); 101121326Sharti 102121326Sharti/* SSCOP input function */ 103121326Shartivoid sscop_input(struct sscop *, struct SSCOP_MBUF_T *); 104121326Sharti 105121326Sharti/* Move the window by a given number of messages. Return the new window */ 106121326Shartiu_int sscop_window(struct sscop *, u_int); 107121326Sharti 108121326Sharti/* declare the lower layer busy or not busy */ 109121326Shartiu_int sscop_setbusy(struct sscop *, int); 110121326Sharti 111121326Sharti/* retrieve the state */ 112121326Shartienum sscop_state sscop_getstate(const struct sscop *); 113121326Sharti 114121326Sharti/* map signals to strings */ 115121326Sharticonst char *sscop_msigname(enum sscop_maasig); 116121326Sharticonst char *sscop_signame(enum sscop_aasig); 117121326Sharticonst char *sscop_statename(enum sscop_state); 118121326Sharti 119121326Sharti/* set/get debugging state */ 120121326Shartivoid sscop_setdebug(struct sscop *, u_int); 121121326Shartiu_int sscop_getdebug(const struct sscop *); 122121326Sharti 123121326Sharti/* reset the instance */ 124121326Shartivoid sscop_reset(struct sscop *); 125121326Sharti 126121326Sharti#endif 127