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 <harti@freebsd.org>
28 *
29 * $Begemot: libunimsg/netnatm/saal/sscfu.h,v 1.4 2004/07/08 08:22:15 brandt Exp $
30 *
31 * Public include file for UNI SSCF
32 */
33#ifndef _NETNATM_SAAL_SSCFU_H_
34#define _NETNATM_SAAL_SSCFU_H_
35
36#include <sys/types.h>
37#include <netnatm/saal/sscopdef.h>
38#include <netnatm/saal/sscfudef.h>
39
40/*
41 * Define how a buffer looks like.
42 */
43#ifdef _KERNEL
44#ifdef __FreeBSD__
45#define SSCFU_MBUF_T mbuf
46#endif
47#else
48#define SSCFU_MBUF_T uni_msg
49#endif
50
51struct SSCFU_MBUF_T;
52struct sscfu;
53
54/* functions to be supplied by the SSCOP user */
55struct sscfu_funcs {
56	/* upper (SAAL) interface output */
57	void	(*send_upper)(struct sscfu *, void *, enum saal_sig,
58		    struct SSCFU_MBUF_T *);
59
60	/* lower (SSCOP) interface output */
61	void	(*send_lower)(struct sscfu *, void *, enum sscop_aasig,
62		    struct SSCFU_MBUF_T *, u_int);
63
64	/* function to move the SSCOP window */
65	void	(*window)(struct sscfu *, void *, u_int);
66
67	/* debugging function */
68	void	(*verbose)(struct sscfu *, void *, const char *, ...)
69		    __printflike(3, 4);
70};
71
72/* Function defined by the SSCF-UNI code */
73
74/* allocate and initialize a new SSCF instance */
75struct sscfu *sscfu_create(void *, const struct sscfu_funcs *);
76
77/* destroy an SSCF instance and free all resources */
78void sscfu_destroy(struct sscfu *);
79
80/* reset the SSCF to the released state */
81void sscfu_reset(struct sscfu *);
82
83/* lower input interface (SSCOP signals) */
84void sscfu_input(struct sscfu *, enum sscop_aasig, struct SSCFU_MBUF_T *, u_int);
85
86/* upper input interface (SAAL) */
87int sscfu_saalsig(struct sscfu *, enum saal_sig, struct SSCFU_MBUF_T *);
88
89/* retrieve the current state */
90enum sscfu_state sscfu_getstate(const struct sscfu *);
91
92/* char'ify signals and states */
93const char *sscfu_signame(enum saal_sig);
94const char *sscfu_statename(enum sscfu_state);
95
96/* retrieve the default set of parameters for SSCOP */
97u_int sscfu_getdefparam(struct sscop_param *);
98
99/* get/set debugging flags */
100void sscfu_setdebug(struct sscfu *, u_int);
101u_int sscfu_getdebug(const struct sscfu *);
102
103#endif
104