Initial import from FreeBSD RELENG_4:
[dragonfly.git] / usr.sbin / atm / scspd / scsp_if.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/usr.sbin/atm/scspd/scsp_if.h,v 1.2 1999/08/28 01:15:33 peter Exp $
27  *
28  */
29
30 /*
31  * Server Cache Synchronization Protocol (SCSP) Support
32  * ----------------------------------------------------
33  *
34  * Interface to server clients of SCSP
35  *
36  */
37
38 #ifndef _SCSP_SCSP_IF_H
39 #define _SCSP_SCSP_IF_H
40
41
42 /*
43  * SCSP configuration message
44  */
45 struct scsp_cfg_msg {
46         char    atmarp_netif[IFNAMSIZ];
47 };
48 typedef struct scsp_cfg_msg     Scsp_cfg_msg;
49
50
51 /*
52  * SCSP cache summary
53  */
54 struct scsp_sum_msg {
55         u_short         ss_hops;        /* Hop count */
56         u_char          ss_null;        /* Null flag */
57         long            ss_seq;         /* CSA seq. no. */
58         Scsp_ckey       ss_key;         /* Cache key */
59         Scsp_id         ss_oid;         /* Originator ID */
60 };
61 typedef struct scsp_sum_msg     Scsp_sum_msg;
62
63
64 /*
65  * SCSP constants for ATMARP
66  */
67 #define SCSP_ATMARP_PROTO       1
68 #define SCSP_ATMARP_SIDL        4
69 #define SCSP_ATMARP_RIDL        4
70 #define SCSP_ATMARP_CKL         4
71 #define SCSP_ATMARP_OIDL        4
72
73
74 /*
75  * SCSP ATMARP message
76  */
77 struct scsp_atmarp_msg {
78         u_char          sa_state;       /* Cache entry state (below) */
79         struct in_addr  sa_cpa;         /* Cached protocol address */
80         Atm_addr        sa_cha;         /* Cached ATM address */
81         Atm_addr        sa_csa;         /* Cached ATM subaddress */
82         Scsp_ckey       sa_key;         /* Cache key for entry */
83         Scsp_id         sa_oid;         /* Originator ID */
84         long            sa_seq;         /* Sequence no. */
85 };
86 typedef struct scsp_atmarp_msg  Scsp_atmarp_msg;
87
88 #define SCSP_ASTATE_NEW 0       /* ATMARP new server registration */
89 #define SCSP_ASTATE_UPD 1       /* ATMARP server refreshed */
90 #define SCSP_ASTATE_DEL 2       /* ATMARP server data deleted */
91
92
93 /*
94  * SCSP constants for NHRP
95  */
96 #define SCSP_NHRP_PROTO         2
97 #define SCSP_NHRP_SIDL          4
98 #define SCSP_NHRP_RIDL          4
99 #define SCSP_NHRP_CKL           4
100 #define SCSP_NHRP_OIDL          4
101
102
103 /*
104  * SCSP NHRP message
105  */
106 struct scsp_nhrp_msg {
107         u_short sn_af;          /* Address family */
108         u_short sn_proto;       /* NHRP protocol type */
109         u_char  sn_snap[5];     /* SNAP */
110         u_char  sn_ver;         /* NHRP version number */
111         u_short sn_flags;       /* Flags */
112         u_long  sn_rid;         /* Request ID */
113         u_char  sn_state;       /* State */
114         u_char  sn_prel;        /* Prefix length */
115         u_short sn_mtu;         /* Maximum transmission unit */
116         u_short sn_hold;        /* Holding time */
117         Atm_addr        sn_addr;        /* Server network address */
118         Atm_addr        sn_saddr;       /* Server network subaddress */
119         struct in_addr  sn_paddr;       /* Server protocol address */
120         Scsp_ckey sn_key;       /* Cache key for entry */
121         Scsp_id sn_oid;         /* Originator ID */
122 };
123 typedef struct scsp_nhrp_msg    Scsp_nhrp_msg;
124
125 #define SCSP_NSTATE_NEW 0       /* New NHRP server */
126 #define SCSP_NSTATE_UPD 1       /* NHRP server re-registered */
127 #define SCSP_NSTATE_DEL 2       /* NHRP server data purged */
128 #define SCSP_NSTATE_NSD 3       /* NHRP no such data in server */
129
130
131 /*
132  * SCSP/server message header
133  */
134 struct scsp_if_msg_hdr {
135         u_char  sh_type;        /* Message type */
136         u_char  sh_rc;          /* Response code */
137         u_short sh_proto;       /* SCSP protocol ID */
138         int     sh_len;         /* Length of message */
139         u_long  sh_tok;         /* Token from SCSP daemon */
140 };
141 typedef struct scsp_if_msg_hdr  Scsp_if_msg_hdr;
142
143
144 /*
145  * SCSP-server message
146  */
147 struct scsp_if_msg {
148         Scsp_if_msg_hdr si_hdr; /* Header fields */
149         union {
150                 Scsp_cfg_msg    siu_cfg;        /* Config data */
151                 Scsp_sum_msg    siu_sum;        /* Cache summary */
152                 Scsp_atmarp_msg siu_atmarp;     /* ATMARP update */
153                 Scsp_nhrp_msg   siu_nhrp;       /* NHRP update */
154         } si_u;
155 };
156 typedef struct scsp_if_msg      Scsp_if_msg;
157
158 #define si_type         si_hdr.sh_type
159 #define si_rc           si_hdr.sh_rc
160 #define si_proto        si_hdr.sh_proto
161 #define si_len          si_hdr.sh_len
162 #define si_tok          si_hdr.sh_tok
163
164 #define si_cfg          si_u.siu_cfg
165 #define si_sum          si_u.siu_sum
166 #define si_atmarp       si_u.siu_atmarp
167 #define si_nhrp         si_u.siu_nhrp
168
169
170 /*
171  * Message types
172  */
173 #define SCSP_NOP_REQ            1
174 #define SCSP_CFG_REQ            2
175 #define SCSP_CFG_RSP            3
176 #define SCSP_CACHE_IND          4
177 #define SCSP_CACHE_RSP          5
178 #define SCSP_SOLICIT_IND        6
179 #define SCSP_SOLICIT_RSP        7
180 #define SCSP_UPDATE_IND         8
181 #define SCSP_UPDATE_REQ         9
182 #define SCSP_UPDATE_RSP         10
183
184
185 /*
186  * Response codes
187  */
188 #define SCSP_RSP_OK             0
189 #define SCSP_RSP_ERR            1
190 #define SCSP_RSP_REJ            2
191 #define SCSP_RSP_NOT_FOUND      3
192
193
194 #endif  /* _SCSP_SCSP_IF_H */