1131826Sharti/*
2131826Sharti * Copyright (c) 2003-2004
3131826Sharti *	Hartmut Brandt
4131826Sharti *	All rights reserved.
5131826Sharti *
6131826Sharti * Author: Harti Brandt <harti@freebsd.org>
7131826Sharti *
8131826Sharti * Redistribution of this software and documentation and use in source and
9131826Sharti * binary forms, with or without modification, are permitted provided that
10131826Sharti * the following conditions are met:
11131826Sharti *
12131826Sharti * 1. Redistributions of source code or documentation must retain the above
13131826Sharti *    copyright notice, this list of conditions and the following disclaimer.
14131826Sharti * 2. Redistributions in binary form must reproduce the above copyright
15131826Sharti *    notice, this list of conditions and the following disclaimer in the
16131826Sharti *    documentation and/or other materials provided with the distribution.
17131826Sharti *
18131826Sharti * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
19131826Sharti * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20131826Sharti * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21131826Sharti * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
22131826Sharti * THE AUTHOR OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,
23131826Sharti * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24131826Sharti * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25131826Sharti * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26131826Sharti * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27131826Sharti * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28131826Sharti * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29131826Sharti *
30131826Sharti * $Begemot: libunimsg/netnatm/api/ccatm.h,v 1.1 2004/07/08 08:21:58 brandt Exp $
31131826Sharti *
32131826Sharti * ATM API as defined per af-saa-0108
33131826Sharti *
34131826Sharti * Interface to the supporting code.
35131826Sharti */
36131826Sharti
37131826Sharti#ifndef _API_CCATM_H_
38131826Sharti#define _API_CCATM_H_
39131826Sharti
40131826Shartistruct ccuser;
41131826Shartistruct ccconn;
42131826Shartistruct ccport;
43131826Shartistruct ccdata;
44131826Sharti
45131826Shartistruct cc_funcs {
46131826Sharti	/* send signal to API user */
47131826Sharti	void	(*send_user)(struct ccuser *, void *, u_int, void *, size_t);
48131826Sharti
49131826Sharti	/* respond API user */
50131826Sharti	void	(*respond_user)(struct ccuser *, void *, int, u_int,
51131826Sharti		    void *, size_t);
52131826Sharti
53131826Sharti	/* send signal to uni for connection */
54131826Sharti	void	(*send_uni)(struct ccconn *, void *, u_int, u_int,
55131826Sharti		    struct uni_msg *);
56131826Sharti
57131826Sharti	/* send global signal to uni */
58131826Sharti	void	(*send_uni_glob)(struct ccport *, void *, u_int, u_int,
59131826Sharti		    struct uni_msg *);
60131826Sharti
61131826Sharti	/* log a message */
62131826Sharti	void	(*log)(const char *, ...);
63131826Sharti};
64131826Sharti
65131826Shartienum {
66131826Sharti	CCLOG_USER_STATE	= 0x00000001,
67131826Sharti	CCLOG_USER_INST		= 0x00000002,
68131826Sharti	CCLOG_USER_SIG		= 0x00000004,
69131826Sharti	CCLOG_CONN_STATE	= 0x00000010,
70131826Sharti	CCLOG_CONN_INST		= 0x00000020,
71131826Sharti	CCLOG_CONN_SIG		= 0x00000040,
72131826Sharti	CCLOG_PARTY_STATE	= 0x00000100,
73131826Sharti	CCLOG_PARTY_INST	= 0x00000200,
74131826Sharti	CCLOG_PARTY_SIG		= 0x00000400,
75131826Sharti	CCLOG_SIGS		= 0x00001000,
76131826Sharti};
77131826Sharti
78131826Sharti/* instance handling */
79131826Shartistruct ccdata *cc_create(const struct cc_funcs *);
80131826Shartivoid cc_destroy(struct ccdata *);
81131826Shartivoid cc_reset(struct ccdata *);
82131826Sharti
83131826Sharti/* input a response from the UNI layer to CC */
84131826Shartiint cc_uni_response(struct ccport *, u_int cookie, u_int reason, u_int state);
85131826Sharti
86131826Sharti/* Signal from UNI on this port */
87131826Shartiint cc_uni_signal(struct ccport *, u_int cookie, u_int sig, struct uni_msg *);
88131826Sharti
89131826Sharti/* retrieve addresses */
90131826Shartiint cc_get_addrs(struct ccdata *, u_int, struct uni_addr **, u_int **, u_int *);
91131826Sharti
92131826Sharti/* dump state */
93131826Shartitypedef int (*cc_dump_f)(struct ccdata *, void *, const char *);
94131826Shartiint cc_dump(struct ccdata *, size_t, cc_dump_f, void *);
95131826Sharti
96131826Sharti/* start/stop port */
97131826Shartiint cc_port_stop(struct ccdata *, u_int);
98131826Shartiint cc_port_start(struct ccdata *, u_int);
99131826Sharti
100131826Sharti/* is port running? */
101131826Shartiint cc_port_isrunning(struct ccdata *, u_int, int *);
102131826Sharti
103131826Sharti/* return port number */
104131826Shartiu_int cc_port_no(struct ccport *);
105131826Sharti
106131826Sharti/* Clear address and prefix information from the named port. */
107131826Shartiint cc_port_clear(struct ccdata *, u_int);
108131826Sharti
109131826Sharti/* Address registered.  */
110131826Shartiint cc_addr_register(struct ccdata *, u_int, const struct uni_addr *);
111131826Sharti
112131826Sharti/* Address unregistered. */
113131826Shartiint cc_addr_unregister(struct ccdata *, u_int, const struct uni_addr *);
114131826Sharti
115131826Sharti/* get port info */
116131826Shartiint cc_port_get_param(struct ccdata *, u_int, struct atm_port_info *);
117131826Sharti
118131826Sharti/* set port info */
119131826Shartiint cc_port_set_param(struct ccdata *, const struct atm_port_info *);
120131826Sharti
121131826Sharti/* get port list */
122131826Shartiint cc_port_getlist(struct ccdata *, u_int *, u_int **);
123131826Sharti
124131826Sharti/* create a port */
125131826Shartistruct ccport *cc_port_create(struct ccdata *, void *, u_int);
126131826Sharti
127131826Sharti/* destroy a port */
128131826Shartivoid cc_port_destroy(struct ccport *, int);
129131826Sharti
130131826Sharti/* New endpoint created */
131131826Shartistruct ccuser *cc_user_create(struct ccdata *, void *, const char *);
132131826Sharti
133131826Sharti/* destroy user endpoint */
134131826Shartivoid cc_user_destroy(struct ccuser *);
135131826Sharti
136131826Sharti/* signal from user */
137131826Shartiint cc_user_signal(struct ccuser *, u_int, struct uni_msg *);
138131826Sharti
139131826Sharti/* Management is given up on this node. */
140131826Shartivoid cc_unmanage(struct ccdata *);
141131826Sharti
142131826Sharti/* handle all queued signals */
143131826Shartivoid cc_work(struct ccdata *);
144131826Sharti
145131826Sharti/* set/get logging flags */
146131826Shartivoid cc_set_log(struct ccdata *, u_int);
147131826Shartiu_int cc_get_log(const struct ccdata *);
148131826Sharti
149131826Sharti/* get extended status */
150131826Shartiint cc_get_extended_status(const struct ccdata *, struct atm_exstatus *,
151131826Sharti    struct atm_exstatus_ep **, struct atm_exstatus_port **,
152131826Sharti    struct atm_exstatus_conn **, struct atm_exstatus_party **);
153131826Sharti
154131826Sharti#endif
155