184865Sobrien/* 2218822Sdim * Copyright (c) 1996-2003 3218822Sdim * Fraunhofer Institute for Open Communication Systems (FhG Fokus). 484865Sobrien * All rights reserved. 584865Sobrien * 684865Sobrien * Redistribution and use in source and binary forms, with or without 784865Sobrien * modification, are permitted provided that the following conditions 884865Sobrien * are met: 984865Sobrien * 1. Redistributions of source code must retain the above copyright 1084865Sobrien * notice, this list of conditions and the following disclaimer. 1184865Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1284865Sobrien * notice, this list of conditions and the following disclaimer in the 1384865Sobrien * documentation and/or other materials provided with the distribution. 1484865Sobrien * 1584865Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1684865Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1784865Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1884865Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1984865Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2084865Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2184865Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2284865Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2384865Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2484865Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2584865Sobrien * SUCH DAMAGE. 2684865Sobrien * 2784865Sobrien * Author: Hartmut Brandt <harti@freebsd.org> 2884865Sobrien * 2984865Sobrien * $Begemot: libunimsg/netnatm/saal/sscop.h,v 1.4 2004/07/08 08:22:16 brandt Exp $ 3084865Sobrien * 3184865Sobrien * External interface to sscop. 3284865Sobrien */ 3384865Sobrien#ifndef _NETNATM_SAAL_SSCOP_H_ 3484865Sobrien#define _NETNATM_SAAL_SSCOP_H_ 3584865Sobrien 3684865Sobrien#include <netnatm/saal/sscopdef.h> 3784865Sobrien 3884865Sobrien/* 3984865Sobrien * Define how a buffer looks like. 4084865Sobrien */ 4184865Sobrien#ifdef _KERNEL 4284865Sobrien#ifdef __FreeBSD__ 4384865Sobrien#define SSCOP_MBUF_T mbuf 4484865Sobrien#endif 4584865Sobrien#else 4684865Sobrien#define SSCOP_MBUF_T uni_msg 4784865Sobrien#endif 4884865Sobrien 4984865Sobrienstruct SSCOP_MBUF_T; 5084865Sobrienstruct sscop; 5184865Sobrien 5284865Sobrien/* 5384865Sobrien * Vector for user functions 5484865Sobrien */ 5584865Sobrienstruct sscop_funcs { 5684865Sobrien /* management signal from SSCOP */ 5784865Sobrien void (*send_manage)(struct sscop *, void *, enum sscop_maasig, 5884865Sobrien struct SSCOP_MBUF_T *, u_int, u_int); 5984865Sobrien 6084865Sobrien /* AAL signal from SSCOP */ 6184865Sobrien void (*send_upper)(struct sscop *, void *, enum sscop_aasig, 6284865Sobrien struct SSCOP_MBUF_T *, u_int); 6384865Sobrien 6484865Sobrien /* send a PDU to the wire */ 6584865Sobrien void (*send_lower)(struct sscop *, void *, 6684865Sobrien struct SSCOP_MBUF_T *); 6784865Sobrien 6884865Sobrien /* print a message */ 6984865Sobrien void (*verbose)(struct sscop *, void *, const char *, ...) 7084865Sobrien __printflike(3,4); 7184865Sobrien 7284865Sobrien#ifndef _KERNEL 7384865Sobrien /* start a timer */ 7484865Sobrien void *(*start_timer)(struct sscop *, void *, u_int, 7584865Sobrien void (*)(void *)); 7684865Sobrien 7784865Sobrien /* stop a timer */ 7884865Sobrien void (*stop_timer)(struct sscop *, void *, void *); 7984865Sobrien#endif 8084865Sobrien}; 8184865Sobrien 8284865Sobrien/* Function defined by the SSCOP code */ 8384865Sobrien 8484865Sobrien/* create a new SSCOP instance and initialize to default values */ 8584865Sobrienstruct sscop *sscop_create(void *, const struct sscop_funcs *); 8684865Sobrien 8784865Sobrien/* destroy an SSCOP instance */ 8884865Sobrienvoid sscop_destroy(struct sscop *); 8984865Sobrien 9084865Sobrien/* get the current parameters of an SSCOP */ 9184865Sobrienvoid sscop_getparam(const struct sscop *, struct sscop_param *); 9284865Sobrien 9384865Sobrien/* set new parameters in an SSCOP */ 9484865Sobrienint sscop_setparam(struct sscop *, struct sscop_param *, u_int *); 9584865Sobrien 9684865Sobrien/* deliver an signal to the SSCOP */ 9784865Sobrienint sscop_aasig(struct sscop *, enum sscop_aasig, struct SSCOP_MBUF_T *, u_int); 9884865Sobrien 9984865Sobrien/* deliver an management signal to the SSCOP */ 10084865Sobrienint sscop_maasig(struct sscop *, enum sscop_maasig, struct SSCOP_MBUF_T *); 10184865Sobrien 10284865Sobrien/* SSCOP input function */ 10384865Sobrienvoid sscop_input(struct sscop *, struct SSCOP_MBUF_T *); 10484865Sobrien 10584865Sobrien/* Move the window by a given number of messages. Return the new window */ 10684865Sobrienu_int sscop_window(struct sscop *, u_int); 10784865Sobrien 10884865Sobrien/* declare the lower layer busy or not busy */ 10984865Sobrienu_int sscop_setbusy(struct sscop *, int); 11084865Sobrien 11184865Sobrien/* retrieve the state */ 11284865Sobrienenum sscop_state sscop_getstate(const struct sscop *); 11384865Sobrien 11484865Sobrien/* map signals to strings */ 11584865Sobrienconst char *sscop_msigname(enum sscop_maasig); 11684865Sobrienconst char *sscop_signame(enum sscop_aasig); 11784865Sobrienconst char *sscop_statename(enum sscop_state); 11884865Sobrien 11984865Sobrien/* set/get debugging state */ 12084865Sobrienvoid sscop_setdebug(struct sscop *, u_int); 12184865Sobrienu_int sscop_getdebug(const struct sscop *); 12284865Sobrien 12384865Sobrien/* reset the instance */ 12484865Sobrienvoid sscop_reset(struct sscop *); 12584865Sobrien 12684865Sobrien#endif 12784865Sobrien