1/*-
2 * Copyright (c) 2001-2002
3 *	Fraunhofer Institute for Open Communication Systems (FhG Fokus).
4 *	All rights reserved.
5 * Copyright (c) 2003-2004
6 *	Hartmut Brandt
7 *	All rights reserved.
8 *
9 * Author: Harti Brandt <harti@freebsd.org>
10 *
11 * Redistribution of this software and documentation and use in source and
12 * binary forms, with or without modification, are permitted provided that
13 * the following conditions are met:
14 *
15 * 1. Redistributions of source code or documentation must retain the above
16 *    copyright notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in the
19 *    documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $FreeBSD$
34 */
35
36/*
37 * Interface to ng_ccatm
38 */
39#ifndef _NETGRAPH_ATM_NG_CCATM_H_
40#define _NETGRAPH_ATM_NG_CCATM_H_
41
42#define NG_CCATM_NODE_TYPE	"ccatm"
43#define NGM_CCATM_COOKIE	984046139
44
45enum {
46	NGM_CCATM_DUMP,			/* dump internal status */
47	NGM_CCATM_STOP,			/* stop all processing, close all */
48	NGM_CCATM_START,		/* start processing */
49	NGM_CCATM_CLEAR,		/* clear prefix/address table */
50	NGM_CCATM_GET_ADDRESSES,	/* get list of all addresses */
51	NGM_CCATM_ADDRESS_REGISTERED,	/* registration ok */
52	NGM_CCATM_ADDRESS_UNREGISTERED,	/* unregistration ok */
53	NGM_CCATM_SET_PORT_PARAM,	/* set port parameters */
54	NGM_CCATM_GET_PORT_PARAM,	/* get port parameters */
55	NGM_CCATM_GET_PORTLIST,		/* get list of port numbers */
56	NGM_CCATM_GETSTATE,		/* get port status */
57	NGM_CCATM_SETLOG,		/* set/get loglevel */
58	NGM_CCATM_RESET,		/* reset everything */
59	NGM_CCATM_GET_EXSTAT,		/* get extended status */
60};
61
62/*
63 * This must be synchronized with unistruct.h::struct uni_addr
64 */
65#define	NGM_CCATM_ADDR_ARRAY_INFO				\
66	{							\
67	  &ng_parse_hint8_type,					\
68	  UNI_ADDR_MAXLEN					\
69	}
70
71#define NGM_CCATM_UNI_ADDR_INFO 				\
72 	{							\
73	  { "type",	&ng_parse_uint32_type },		\
74	  { "plan",	&ng_parse_uint32_type },		\
75	  { "len",	&ng_parse_uint32_type },		\
76	  { "addr",	&ng_ccatm_addr_array_type },		\
77	  { NULL }						\
78	}
79
80/*
81 * Address request
82 */
83struct ngm_ccatm_addr_req {
84	uint32_t	port;
85	struct uni_addr	addr;
86};
87#define	NGM_CCATM_ADDR_REQ_INFO					\
88	{							\
89	  { "port",	&ng_parse_uint32_type },		\
90	  { "addr",	&ng_ccatm_uni_addr_type },		\
91	  { NULL },						\
92	}
93
94/*
95 * Get current address list
96 */
97struct ngm_ccatm_get_addresses {
98	uint32_t	count;
99	struct ngm_ccatm_addr_req addr[];
100};
101#define	NGM_CCATM_ADDR_REQ_ARRAY_INFO				\
102	{							\
103	  &ng_ccatm_addr_req_type,				\
104	  ng_ccatm_addr_req_array_getlen			\
105	}
106#define NGM_CCATM_GET_ADDRESSES_INFO 				\
107	{							\
108	  { "count",	&ng_parse_uint32_type },		\
109	  { "addr",	&ng_ccatm_addr_req_array_type },	\
110	  { NULL }						\
111	}
112
113/*
114 * Port as parameter
115 */
116struct ngm_ccatm_port {
117	uint32_t	port;
118};
119#define NGM_CCATM_PORT_INFO 					\
120	{							\
121	  { "port",	&ng_parse_uint32_type },		\
122	  { NULL }						\
123	}
124
125/*
126 * Port parameters.
127 * This must be synchronized with atmapi.h::struct atm_port_info.
128 */
129#define	NGM_CCATM_ESI_INFO						\
130	{								\
131	  &ng_parse_hint8_type,						\
132	  6								\
133	}
134#define NGM_CCATM_ATM_PORT_INFO 					\
135	{								\
136	  { "port",		&ng_parse_uint32_type },		\
137	  { "pcr",		&ng_parse_uint32_type },		\
138	  { "max_vpi_bits",	&ng_parse_uint32_type },		\
139	  { "max_vci_bits",	&ng_parse_uint32_type },		\
140	  { "max_svpc_vpi",	&ng_parse_uint32_type },		\
141	  { "max_svcc_vpi",	&ng_parse_uint32_type },		\
142	  { "min_svcc_vci",	&ng_parse_uint32_type },		\
143	  { "esi",		&ng_ccatm_esi_type },			\
144	  { "num_addr",		&ng_parse_uint32_type },		\
145	  { NULL }							\
146	}
147
148/*
149 * List of port numbers
150 */
151struct ngm_ccatm_portlist {
152	uint32_t	nports;
153	uint32_t	ports[];
154};
155#define	NGM_CCATM_PORT_ARRAY_INFO					\
156	{								\
157	  &ng_parse_uint32_type,					\
158	  ng_ccatm_port_array_getlen					\
159	}
160#define NGM_CCATM_PORTLIST_INFO 					\
161	{								\
162	  { "nports",	&ng_parse_uint32_type },			\
163	  { "ports",	&ng_ccatm_port_array_type },			\
164	  { NULL }							\
165	}
166
167struct ccatm_op {
168	uint32_t	op;	/* request code */
169};
170
171#endif
172