xref: /f-stack/freebsd/contrib/ngatm/netnatm/sig/uni.h (revision a9643ea8)
1 /*
2  * Copyright (c) 2001-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/sig/uni.h,v 1.5 2004/07/08 08:22:24 brandt Exp $
30  *
31  * Public UNI interface
32  */
33 #ifndef _NETNATM_SIG_UNI_H_
34 #define _NETNATM_SIG_UNI_H_
35 
36 #include <netnatm/sig/unidef.h>
37 
38 struct uni;
39 
40 /* functions to be supplied by the user */
41 struct uni_funcs {
42 	/* output to the upper layer */
43 	void	(*uni_output)(struct uni *, void *, enum uni_sig,
44 		    uint32_t, struct uni_msg *);
45 
46 	/* output to the SAAL */
47 	void	(*saal_output)(struct uni *, void *, enum saal_sig,
48 		    struct uni_msg *);
49 
50 	/* verbosity */
51 	void	(*verbose)(struct uni *, void *, enum uni_verb,
52 		    const char *, ...) __printflike(4, 5);
53 
54 	/* function to 'print' status */
55 	void	(*status)(struct uni *, void *, void *,
56 		    const char *, ...) __printflike(4, 5);
57 
58 #ifndef _KERNEL
59 	/* start a timer */
60 	void	*(*start_timer)(struct uni *, void *, u_int,
61 		    void (*)(void *), void *);
62 
63 	/* stop a timer */
64 	void	(*stop_timer)(struct uni *, void *, void *);
65 #endif
66 };
67 
68 /* create a UNI instance */
69 struct uni *uni_create(void *, const struct uni_funcs *);
70 
71 /* destroy a UNI instance, free all resources */
72 void uni_destroy(struct uni *);
73 
74 /* generate a status report */
75 void uni_status(struct uni *, void *);
76 
77 /* get current instance configuration */
78 void uni_get_config(const struct uni *, struct uni_config *);
79 
80 /* set new instance configuration */
81 void uni_set_config(struct uni *, const struct uni_config *,
82 	uint32_t *, uint32_t *, uint32_t *);
83 
84 /* input from the SAAL to the instance */
85 void  uni_saal_input(struct uni *, enum saal_sig, struct uni_msg *);
86 
87 /* input from the upper layer to the instance */
88 void uni_uni_input(struct uni *, enum uni_sig, uint32_t, struct uni_msg *);
89 
90 /* do work on pending signals */
91 void uni_work(struct uni *);
92 
93 /* set debuging level */
94 void uni_set_debug(struct uni *, enum uni_verb, u_int level);
95 u_int uni_get_debug(const struct uni *, enum uni_verb);
96 
97 /* reset a UNI instance */
98 void uni_reset(struct uni *);
99 
100 /* states */
101 u_int uni_getcustate(const struct uni *);
102 
103 /* return a reference to the coding/decoding context */
104 struct unicx *uni_context(struct uni *);
105 
106 #endif
107