1122205Sharti/*
2122205Sharti * Copyright (c) 2001-2003
3122205Sharti *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4122205Sharti * 	All rights reserved.
5122205Sharti *
6122205Sharti * Redistribution and use in source and binary forms, with or without
7122205Sharti * modification, are permitted provided that the following conditions
8122205Sharti * are met:
9122205Sharti * 1. Redistributions of source code must retain the above copyright
10122205Sharti *    notice, this list of conditions and the following disclaimer.
11122205Sharti * 2. Redistributions in binary form must reproduce the above copyright
12122205Sharti *    notice, this list of conditions and the following disclaimer in the
13122205Sharti *    documentation and/or other materials provided with the distribution.
14122205Sharti *
15122205Sharti * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16122205Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17122205Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18122205Sharti * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19122205Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20122205Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21122205Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22122205Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23122205Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24122205Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25122205Sharti * SUCH DAMAGE.
26122205Sharti *
27122205Sharti * Author: Hartmut Brandt <harti@freebsd.org>
28122205Sharti *
29131826Sharti * $Begemot: libunimsg/netnatm/sig/uni.h,v 1.5 2004/07/08 08:22:24 brandt Exp $
30122205Sharti *
31122205Sharti * Public UNI interface
32122205Sharti */
33122205Sharti#ifndef _NETNATM_SIG_UNI_H_
34122205Sharti#define _NETNATM_SIG_UNI_H_
35122205Sharti
36122205Sharti#include <netnatm/sig/unidef.h>
37122205Sharti
38122205Shartistruct uni;
39122205Sharti
40122205Sharti/* functions to be supplied by the user */
41122205Shartistruct uni_funcs {
42122205Sharti	/* output to the upper layer */
43122205Sharti	void	(*uni_output)(struct uni *, void *, enum uni_sig,
44131826Sharti		    uint32_t, struct uni_msg *);
45122205Sharti
46122205Sharti	/* output to the SAAL */
47122205Sharti	void	(*saal_output)(struct uni *, void *, enum saal_sig,
48122205Sharti		    struct uni_msg *);
49122205Sharti
50122205Sharti	/* verbosity */
51122205Sharti	void	(*verbose)(struct uni *, void *, enum uni_verb,
52122205Sharti		    const char *, ...) __printflike(4, 5);
53122205Sharti
54122205Sharti	/* function to 'print' status */
55122205Sharti	void	(*status)(struct uni *, void *, void *,
56122205Sharti		    const char *, ...) __printflike(4, 5);
57122205Sharti
58122205Sharti#ifndef _KERNEL
59122205Sharti	/* start a timer */
60122205Sharti	void	*(*start_timer)(struct uni *, void *, u_int,
61122205Sharti		    void (*)(void *), void *);
62122205Sharti
63122205Sharti	/* stop a timer */
64122205Sharti	void	(*stop_timer)(struct uni *, void *, void *);
65122205Sharti#endif
66122205Sharti};
67122205Sharti
68122205Sharti/* create a UNI instance */
69122205Shartistruct uni *uni_create(void *, const struct uni_funcs *);
70122205Sharti
71122205Sharti/* destroy a UNI instance, free all resources */
72122205Shartivoid uni_destroy(struct uni *);
73122205Sharti
74122205Sharti/* generate a status report */
75122205Shartivoid uni_status(struct uni *, void *);
76122205Sharti
77122205Sharti/* get current instance configuration */
78122205Shartivoid uni_get_config(const struct uni *, struct uni_config *);
79122205Sharti
80122205Sharti/* set new instance configuration */
81122205Shartivoid uni_set_config(struct uni *, const struct uni_config *,
82131826Sharti	uint32_t *, uint32_t *, uint32_t *);
83122205Sharti
84122205Sharti/* input from the SAAL to the instance */
85122205Shartivoid  uni_saal_input(struct uni *, enum saal_sig, struct uni_msg *);
86122205Sharti
87122205Sharti/* input from the upper layer to the instance */
88131826Shartivoid uni_uni_input(struct uni *, enum uni_sig, uint32_t, struct uni_msg *);
89122205Sharti
90122205Sharti/* do work on pending signals */
91122205Shartivoid uni_work(struct uni *);
92122205Sharti
93122205Sharti/* set debuging level */
94122205Shartivoid uni_set_debug(struct uni *, enum uni_verb, u_int level);
95122205Shartiu_int uni_get_debug(const struct uni *, enum uni_verb);
96122205Sharti
97122205Sharti/* reset a UNI instance */
98122205Shartivoid uni_reset(struct uni *);
99122205Sharti
100122205Sharti/* states */
101122205Shartiu_int uni_getcustate(const struct uni *);
102122205Sharti
103122205Sharti/* return a reference to the coding/decoding context */
104122205Shartistruct unicx *uni_context(struct uni *);
105122205Sharti
106122205Sharti#endif
107