]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/contrib/ngatm/netnatm/api/ccatm.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / contrib / ngatm / netnatm / api / ccatm.h
1 /*
2  * Copyright (c) 2003-2004
3  *      Hartmut Brandt
4  *      All rights reserved.
5  *
6  * Author: Harti Brandt <harti@freebsd.org>
7  *
8  * Redistribution of this software and documentation and use in source and
9  * binary forms, with or without modification, are permitted provided that
10  * the following conditions are met:
11  *
12  * 1. Redistributions of source code or documentation must retain the above
13  *    copyright notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR
19  * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
22  * THE AUTHOR OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * $Begemot: libunimsg/netnatm/api/ccatm.h,v 1.1 2004/07/08 08:21:58 brandt Exp $
31  *
32  * ATM API as defined per af-saa-0108
33  *
34  * Interface to the supporting code.
35  */
36
37 #ifndef _API_CCATM_H_
38 #define _API_CCATM_H_
39
40 struct ccuser;
41 struct ccconn;
42 struct ccport;
43 struct ccdata;
44
45 struct cc_funcs {
46         /* send signal to API user */
47         void    (*send_user)(struct ccuser *, void *, u_int, void *, size_t);
48
49         /* respond API user */
50         void    (*respond_user)(struct ccuser *, void *, int, u_int,
51                     void *, size_t);
52
53         /* send signal to uni for connection */
54         void    (*send_uni)(struct ccconn *, void *, u_int, u_int,
55                     struct uni_msg *);
56
57         /* send global signal to uni */
58         void    (*send_uni_glob)(struct ccport *, void *, u_int, u_int,
59                     struct uni_msg *);
60
61         /* log a message */
62         void    (*log)(const char *, ...);
63 };
64
65 enum {
66         CCLOG_USER_STATE        = 0x00000001,
67         CCLOG_USER_INST         = 0x00000002,
68         CCLOG_USER_SIG          = 0x00000004,
69         CCLOG_CONN_STATE        = 0x00000010,
70         CCLOG_CONN_INST         = 0x00000020,
71         CCLOG_CONN_SIG          = 0x00000040,
72         CCLOG_PARTY_STATE       = 0x00000100,
73         CCLOG_PARTY_INST        = 0x00000200,
74         CCLOG_PARTY_SIG         = 0x00000400,
75         CCLOG_SIGS              = 0x00001000,
76 };
77
78 /* instance handling */
79 struct ccdata *cc_create(const struct cc_funcs *);
80 void cc_destroy(struct ccdata *);
81 void cc_reset(struct ccdata *);
82
83 /* input a response from the UNI layer to CC */
84 int cc_uni_response(struct ccport *, u_int cookie, u_int reason, u_int state);
85
86 /* Signal from UNI on this port */
87 int cc_uni_signal(struct ccport *, u_int cookie, u_int sig, struct uni_msg *);
88
89 /* retrieve addresses */
90 int cc_get_addrs(struct ccdata *, u_int, struct uni_addr **, u_int **, u_int *);
91
92 /* dump state */
93 typedef int (*cc_dump_f)(struct ccdata *, void *, const char *);
94 int cc_dump(struct ccdata *, size_t, cc_dump_f, void *);
95
96 /* start/stop port */
97 int cc_port_stop(struct ccdata *, u_int);
98 int cc_port_start(struct ccdata *, u_int);
99
100 /* is port running? */
101 int cc_port_isrunning(struct ccdata *, u_int, int *);
102
103 /* return port number */
104 u_int cc_port_no(struct ccport *);
105
106 /* Clear address and prefix information from the named port. */
107 int cc_port_clear(struct ccdata *, u_int);
108
109 /* Address registered.  */
110 int cc_addr_register(struct ccdata *, u_int, const struct uni_addr *);
111
112 /* Address unregistered. */
113 int cc_addr_unregister(struct ccdata *, u_int, const struct uni_addr *);
114
115 /* get port info */
116 int cc_port_get_param(struct ccdata *, u_int, struct atm_port_info *);
117
118 /* set port info */
119 int cc_port_set_param(struct ccdata *, const struct atm_port_info *);
120
121 /* get port list */
122 int cc_port_getlist(struct ccdata *, u_int *, u_int **);
123
124 /* create a port */
125 struct ccport *cc_port_create(struct ccdata *, void *, u_int);
126
127 /* destroy a port */
128 void cc_port_destroy(struct ccport *, int);
129
130 /* New endpoint created */
131 struct ccuser *cc_user_create(struct ccdata *, void *, const char *);
132
133 /* destroy user endpoint */
134 void cc_user_destroy(struct ccuser *);
135
136 /* signal from user */
137 int cc_user_signal(struct ccuser *, u_int, struct uni_msg *);
138
139 /* Management is given up on this node. */
140 void cc_unmanage(struct ccdata *);
141
142 /* handle all queued signals */
143 void cc_work(struct ccdata *);
144
145 /* set/get logging flags */
146 void cc_set_log(struct ccdata *, u_int);
147 u_int cc_get_log(const struct ccdata *);
148
149 /* get extended status */
150 int cc_get_extended_status(const struct ccdata *, struct atm_exstatus *,
151     struct atm_exstatus_ep **, struct atm_exstatus_port **,
152     struct atm_exstatus_conn **, struct atm_exstatus_party **);
153
154 #endif