1 /* 2 * Copyright (c) 1996-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: Hartmut Brandt <[email protected]> 28 * 29 * $Begemot: libunimsg/netnatm/saal/sscop.h,v 1.4 2004/07/08 08:22:16 brandt Exp $ 30 * 31 * External interface to sscop. 32 */ 33 #ifndef _NETNATM_SAAL_SSCOP_H_ 34 #define _NETNATM_SAAL_SSCOP_H_ 35 36 #include <netnatm/saal/sscopdef.h> 37 38 /* 39 * Define how a buffer looks like. 40 */ 41 #ifdef _KERNEL 42 #ifdef __FreeBSD__ 43 #define SSCOP_MBUF_T mbuf 44 #endif 45 #else 46 #define SSCOP_MBUF_T uni_msg 47 #endif 48 49 struct SSCOP_MBUF_T; 50 struct sscop; 51 52 /* 53 * Vector for user functions 54 */ 55 struct sscop_funcs { 56 /* management signal from SSCOP */ 57 void (*send_manage)(struct sscop *, void *, enum sscop_maasig, 58 struct SSCOP_MBUF_T *, u_int, u_int); 59 60 /* AAL signal from SSCOP */ 61 void (*send_upper)(struct sscop *, void *, enum sscop_aasig, 62 struct SSCOP_MBUF_T *, u_int); 63 64 /* send a PDU to the wire */ 65 void (*send_lower)(struct sscop *, void *, 66 struct SSCOP_MBUF_T *); 67 68 /* print a message */ 69 void (*verbose)(struct sscop *, void *, const char *, ...) 70 __printflike(3,4); 71 72 #ifndef _KERNEL 73 /* start a timer */ 74 void *(*start_timer)(struct sscop *, void *, u_int, 75 void (*)(void *)); 76 77 /* stop a timer */ 78 void (*stop_timer)(struct sscop *, void *, void *); 79 #endif 80 }; 81 82 /* Function defined by the SSCOP code */ 83 84 /* create a new SSCOP instance and initialize to default values */ 85 struct sscop *sscop_create(void *, const struct sscop_funcs *); 86 87 /* destroy an SSCOP instance */ 88 void sscop_destroy(struct sscop *); 89 90 /* get the current parameters of an SSCOP */ 91 void sscop_getparam(const struct sscop *, struct sscop_param *); 92 93 /* set new parameters in an SSCOP */ 94 int sscop_setparam(struct sscop *, struct sscop_param *, u_int *); 95 96 /* deliver an signal to the SSCOP */ 97 int sscop_aasig(struct sscop *, enum sscop_aasig, struct SSCOP_MBUF_T *, u_int); 98 99 /* deliver an management signal to the SSCOP */ 100 int sscop_maasig(struct sscop *, enum sscop_maasig, struct SSCOP_MBUF_T *); 101 102 /* SSCOP input function */ 103 void sscop_input(struct sscop *, struct SSCOP_MBUF_T *); 104 105 /* Move the window by a given number of messages. Return the new window */ 106 u_int sscop_window(struct sscop *, u_int); 107 108 /* declare the lower layer busy or not busy */ 109 u_int sscop_setbusy(struct sscop *, int); 110 111 /* retrieve the state */ 112 enum sscop_state sscop_getstate(const struct sscop *); 113 114 /* map signals to strings */ 115 const char *sscop_msigname(enum sscop_maasig); 116 const char *sscop_signame(enum sscop_aasig); 117 const char *sscop_statename(enum sscop_state); 118 119 /* set/get debugging state */ 120 void sscop_setdebug(struct sscop *, u_int); 121 u_int sscop_getdebug(const struct sscop *); 122 123 /* reset the instance */ 124 void sscop_reset(struct sscop *); 125 126 #endif 127