Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / netproto / atm / ipatm / ipatm_var.h
1 /*
2  *
3  * ===================================
4  * HARP  |  Host ATM Research Platform
5  * ===================================
6  *
7  *
8  * This Host ATM Research Platform ("HARP") file (the "Software") is
9  * made available by Network Computing Services, Inc. ("NetworkCS")
10  * "AS IS".  NetworkCS does not provide maintenance, improvements or
11  * support of any kind.
12  *
13  * NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED,
14  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
15  * AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE
16  * SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE.
17  * In no event shall NetworkCS be responsible for any damages, including
18  * but not limited to consequential damages, arising from or relating to
19  * any use of the Software or related support.
20  *
21  * Copyright 1994-1998 Network Computing Services, Inc.
22  *
23  * Copies of this Software may be made, however, the above copyright
24  * notice must be reproduced on all copies.
25  *
26  *      @(#) $FreeBSD: src/sys/netatm/ipatm/ipatm_var.h,v 1.2 1999/08/28 00:48:45 peter Exp $
27  *      @(#) $DragonFly: src/sys/netproto/atm/ipatm/ipatm_var.h,v 1.2 2003/06/17 04:28:49 dillon Exp $
28  *
29  */
30
31 /*
32  * IP Over ATM Support
33  * -------------------
34  *
35  * Protocol control blocks
36  *
37  */
38
39 #ifndef _IPATM_IPATM_VAR_H
40 #define _IPATM_IPATM_VAR_H
41
42 #ifdef ATM_KERNEL
43 /*
44  * Structure containing information for each VCC, both SVC and PVC, which
45  * supports IP traffic.
46  */
47 struct ipvcc {
48         Qelem_t         iv_elem;        /* ip_nif queueing links */
49         u_short         iv_flags;       /* VCC flags (see below) */
50         u_char          iv_state;       /* VCC state (see below) */
51         Atm_connection  *iv_conn;       /* Connection manager token */
52         struct in_addr  iv_dst;         /* Peer's IP address */
53         struct ip_nif   *iv_ipnif;      /* IP network interface */
54         struct atm_time iv_time;        /* Timer controls */
55         short           iv_idle;        /* VCC idle timer */
56         u_char          iv_parmx;       /* Index into provider's vcc params */ 
57         KBuffer         *iv_queue;      /* Packet waiting for VCC */
58         struct arpmap   *iv_arpent;     /* ARP entry for VCC */
59         struct ipvcc    *iv_arpnext;    /* ARP link field */
60         Atm_connection  *iv_arpconn;    /* ARP connection manager token */
61 };
62 #define iv_forw         iv_elem.q_forw
63 #define iv_back         iv_elem.q_back
64 #endif  /* ATM_KERNEL */
65
66 /*
67  * VCC Flags
68  */
69 #define IVF_PVC         0x0001          /* PVC */
70 #define IVF_SVC         0x0002          /* SVC */
71 #define IVF_LLC         0x0004          /* VCC uses LLC/SNAP encapsulation */
72 #define IVF_MAPOK       0x0008          /* VCC ARP mapping is valid */
73 #define IVF_NOIDLE      0x0010          /* Do not idle-timeout this VCC */
74
75 /*
76  * VCC States
77  */
78 #define IPVCC_FREE      0               /* No VCC associated with entry */
79 #define IPVCC_PMAP      1               /* SVC waiting for ARP mapping */
80 #define IPVCC_POPEN     2               /* Pending SVC open completion */
81 #define IPVCC_PACCEPT   3               /* Pending SVC accept completion */
82 #define IPVCC_ACTPENT   4               /* PVC open - waiting for ARP entry */
83 #define IPVCC_ACTIVE    5               /* VCC open - available */
84 #define IPVCC_CLOSED    6               /* VCC has been closed */
85
86
87 #ifdef ATM_KERNEL
88 /*
89  * Structure containing IP-specific information for each ATM network
90  * interface in the system.
91  */
92 struct ip_nif {
93         struct ip_nif   *inf_next;      /* Next on interface chain */
94         struct atm_nif  *inf_nif;       /* ATM network interface */
95         u_short         inf_state;      /* Interface state (see below) */
96         struct in_ifaddr *inf_addr;     /* Interface's IP address */
97         Queue_t         inf_vcq;        /* VCC connections queue */
98         struct ip_serv  *inf_serv;      /* Interface service provider */
99
100 /* For use by IP interface service provider (ie signalling manager) */
101         caddr_t         inf_isintf;     /* Interface control block */
102
103 /* IP/ATM provided interface services */
104         void            (*inf_arpnotify)/* ARP event notification */
105                                 __P((struct ipvcc *, int));
106         int             (*inf_ipinput)  /* IP packet input */
107                                 __P((struct ip_nif *, KBuffer *));
108         int             (*inf_createsvc)/* Create an IP SVC */
109                                 __P((struct ifnet *, u_short, caddr_t,
110                                      struct ipvcc **));
111 };
112
113 /*
114  * Network Interface States
115  */
116 #define IPNIF_ADDR      1               /* Waiting for i/f address */
117 #define IPNIF_SIGMGR    2               /* Waiting for sigmgr attach */
118 #define IPNIF_ACTIVE    3               /* Active */
119
120
121 /*
122  * Global IP/ATM Statistics
123  */
124 struct ipatm_stat {
125         u_long          ias_rcvstate;   /* Packets received, bad vcc state */
126         u_long          ias_rcvnobuf;   /* Packets received, no buf avail */
127 };
128
129
130 /*
131  * Structure to pass parameters for ipatm_openpvc()
132  */
133 struct ipatmpvc {
134         struct ip_nif   *ipp_ipnif;     /* PVC's IP network interface */
135         u_short         ipp_vpi;        /* VPI value */
136         u_short         ipp_vci;        /* VCI value */
137         Aal_t           ipp_aal;        /* AAL type */
138         Encaps_t        ipp_encaps;     /* VCC encapsulation */
139         struct sockaddr_in ipp_dst;     /* Destination's IP address */
140 };
141
142
143 /*
144  * Timer macros
145  */
146 #define IPVCC_TIMER(s, t)       atm_timeout(&(s)->iv_time, (t), ipatm_timeout)
147 #define IPVCC_CANCEL(s)         atm_untimeout(&(s)->iv_time)
148
149 /*
150  * Misc useful macros
151  */
152 #define SATOSIN(sa)     ((struct sockaddr_in *)(sa))
153
154
155 /*
156  * Global function declarations
157  */
158         /* ipatm_event.c */
159 void            ipatm_timeout __P((struct atm_time *));
160 void            ipatm_connected __P((void *));
161 void            ipatm_cleared __P((void *, struct t_atm_cause *));
162 void            ipatm_arpnotify __P((struct ipvcc *, int));
163 void            ipatm_itimeout __P((struct atm_time *));
164
165         /* ipatm_if.c */
166 int             ipatm_nifstat __P((int, struct atm_nif *, int));
167
168         /* ipatm_input.c */
169 void            ipatm_cpcs_data __P((void *, KBuffer *));
170 int             ipatm_ipinput __P((struct ip_nif *, KBuffer *));
171
172         /* ipatm_load.c */
173
174         /* ipatm_output.c */
175 int             ipatm_ifoutput __P((struct ifnet *, KBuffer *,
176                         struct sockaddr *));
177
178         /* ipatm_usrreq.c */
179 int             ipatm_ioctl __P((int, caddr_t, caddr_t));
180 caddr_t         ipatm_getname __P((void *));
181
182         /* ipatm_vcm.c */
183 int             ipatm_openpvc __P((struct ipatmpvc *, struct ipvcc **));
184 int             ipatm_createsvc __P((struct ifnet *, u_short, caddr_t,
185                         struct ipvcc **));
186 int             ipatm_opensvc __P((struct ipvcc *));
187 int             ipatm_retrysvc __P((struct ipvcc *));
188 void            ipatm_activate __P((struct ipvcc *));
189 int             ipatm_incoming __P((void *, Atm_connection *, Atm_attributes *,
190                         void **));
191 int             ipatm_closevc __P((struct ipvcc *, int));
192 int             ipatm_chknif __P((struct in_addr, struct ip_nif *));
193 struct ipvcc    *ipatm_iptovc __P((struct sockaddr_in *, struct atm_nif *));
194  
195
196 /*
197  * External variables
198  */
199 extern int              ipatm_vccnt;
200 extern int              ipatm_vcidle;
201 extern int              ipatm_print;
202 extern u_long           last_map_ipdst;
203 extern struct ipvcc     *last_map_ipvcc;
204 extern struct ip_nif    *ipatm_nif_head;
205 extern struct sp_info   ipatm_vcpool;
206 extern struct sp_info   ipatm_nifpool;
207 extern struct ipatm_stat        ipatm_stat;
208 extern struct atm_time  ipatm_itimer;
209 extern Atm_endpoint     ipatm_endpt;
210 extern Atm_attributes   ipatm_aal5llc;
211 extern Atm_attributes   ipatm_aal5null;
212 extern Atm_attributes   ipatm_aal4null;
213
214 #endif  /* ATM_KERNEL */
215
216 #endif  /* _IPATM_IPATM_VAR_H */