1 |
1275 |
phoenix |
#ifndef _NET_DN_H
|
2 |
|
|
#define _NET_DN_H
|
3 |
|
|
|
4 |
|
|
#include <linux/dn.h>
|
5 |
|
|
#include <asm/byteorder.h>
|
6 |
|
|
|
7 |
|
|
typedef unsigned short dn_address;
|
8 |
|
|
|
9 |
|
|
#define dn_ntohs(x) le16_to_cpu((unsigned short)(x))
|
10 |
|
|
#define dn_htons(x) cpu_to_le16((unsigned short)(x))
|
11 |
|
|
|
12 |
|
|
#define DN_SK(sk) (&sk->protinfo.dn)
|
13 |
|
|
|
14 |
|
|
struct dn_scp /* Session Control Port */
|
15 |
|
|
{
|
16 |
|
|
unsigned char state;
|
17 |
|
|
#define DN_O 1 /* Open */
|
18 |
|
|
#define DN_CR 2 /* Connect Receive */
|
19 |
|
|
#define DN_DR 3 /* Disconnect Reject */
|
20 |
|
|
#define DN_DRC 4 /* Discon. Rej. Complete*/
|
21 |
|
|
#define DN_CC 5 /* Connect Confirm */
|
22 |
|
|
#define DN_CI 6 /* Connect Initiate */
|
23 |
|
|
#define DN_NR 7 /* No resources */
|
24 |
|
|
#define DN_NC 8 /* No communication */
|
25 |
|
|
#define DN_CD 9 /* Connect Delivery */
|
26 |
|
|
#define DN_RJ 10 /* Rejected */
|
27 |
|
|
#define DN_RUN 11 /* Running */
|
28 |
|
|
#define DN_DI 12 /* Disconnect Initiate */
|
29 |
|
|
#define DN_DIC 13 /* Disconnect Complete */
|
30 |
|
|
#define DN_DN 14 /* Disconnect Notificat */
|
31 |
|
|
#define DN_CL 15 /* Closed */
|
32 |
|
|
#define DN_CN 16 /* Closed Notification */
|
33 |
|
|
|
34 |
|
|
unsigned short addrloc;
|
35 |
|
|
unsigned short addrrem;
|
36 |
|
|
unsigned short numdat;
|
37 |
|
|
unsigned short numoth;
|
38 |
|
|
unsigned short numoth_rcv;
|
39 |
|
|
unsigned short numdat_rcv;
|
40 |
|
|
unsigned short ackxmt_dat;
|
41 |
|
|
unsigned short ackxmt_oth;
|
42 |
|
|
unsigned short ackrcv_dat;
|
43 |
|
|
unsigned short ackrcv_oth;
|
44 |
|
|
unsigned char flowrem_sw;
|
45 |
|
|
unsigned char flowloc_sw;
|
46 |
|
|
#define DN_SEND 2
|
47 |
|
|
#define DN_DONTSEND 1
|
48 |
|
|
#define DN_NOCHANGE 0
|
49 |
|
|
unsigned short flowrem_dat;
|
50 |
|
|
unsigned short flowrem_oth;
|
51 |
|
|
unsigned short flowloc_dat;
|
52 |
|
|
unsigned short flowloc_oth;
|
53 |
|
|
unsigned char services_rem;
|
54 |
|
|
unsigned char services_loc;
|
55 |
|
|
unsigned char info_rem;
|
56 |
|
|
unsigned char info_loc;
|
57 |
|
|
|
58 |
|
|
unsigned short segsize_rem;
|
59 |
|
|
unsigned short segsize_loc;
|
60 |
|
|
|
61 |
|
|
unsigned char nonagle;
|
62 |
|
|
unsigned char multi_ireq;
|
63 |
|
|
unsigned char accept_mode;
|
64 |
|
|
unsigned long seg_total; /* Running total of current segment */
|
65 |
|
|
|
66 |
|
|
struct optdata_dn conndata_in;
|
67 |
|
|
struct optdata_dn conndata_out;
|
68 |
|
|
struct optdata_dn discdata_in;
|
69 |
|
|
struct optdata_dn discdata_out;
|
70 |
|
|
struct accessdata_dn accessdata;
|
71 |
|
|
|
72 |
|
|
struct sockaddr_dn addr; /* Local address */
|
73 |
|
|
struct sockaddr_dn peer; /* Remote address */
|
74 |
|
|
|
75 |
|
|
/*
|
76 |
|
|
* In this case the RTT estimation is not specified in the
|
77 |
|
|
* docs, nor is any back off algorithm. Here we follow well
|
78 |
|
|
* known tcp algorithms with a few small variations.
|
79 |
|
|
*
|
80 |
|
|
* snd_window: Max number of packets we send before we wait for
|
81 |
|
|
* an ack to come back. This will become part of a
|
82 |
|
|
* more complicated scheme when we support flow
|
83 |
|
|
* control.
|
84 |
|
|
*
|
85 |
|
|
* nsp_srtt: Round-Trip-Time (x8) in jiffies. This is a rolling
|
86 |
|
|
* average.
|
87 |
|
|
* nsp_rttvar: Round-Trip-Time-Varience (x4) in jiffies. This is the
|
88 |
|
|
* varience of the smoothed average (but calculated in
|
89 |
|
|
* a simpler way than for normal statistical varience
|
90 |
|
|
* calculations).
|
91 |
|
|
*
|
92 |
|
|
* nsp_rxtshift: Backoff counter. Value is zero normally, each time
|
93 |
|
|
* a packet is lost is increases by one until an ack
|
94 |
|
|
* is received. Its used to index an array of backoff
|
95 |
|
|
* multipliers.
|
96 |
|
|
*/
|
97 |
|
|
#define NSP_MIN_WINDOW 1
|
98 |
|
|
#define NSP_MAX_WINDOW (0x07fe)
|
99 |
|
|
unsigned long max_window;
|
100 |
|
|
unsigned long snd_window;
|
101 |
|
|
#define NSP_INITIAL_SRTT (HZ)
|
102 |
|
|
unsigned long nsp_srtt;
|
103 |
|
|
#define NSP_INITIAL_RTTVAR (HZ*3)
|
104 |
|
|
unsigned long nsp_rttvar;
|
105 |
|
|
#define NSP_MAXRXTSHIFT 12
|
106 |
|
|
unsigned long nsp_rxtshift;
|
107 |
|
|
|
108 |
|
|
/*
|
109 |
|
|
* Output queues, one for data, one for otherdata/linkservice
|
110 |
|
|
*/
|
111 |
|
|
struct sk_buff_head data_xmit_queue;
|
112 |
|
|
struct sk_buff_head other_xmit_queue;
|
113 |
|
|
|
114 |
|
|
/*
|
115 |
|
|
* Input queue for other data
|
116 |
|
|
*/
|
117 |
|
|
struct sk_buff_head other_receive_queue;
|
118 |
|
|
int other_report;
|
119 |
|
|
|
120 |
|
|
/*
|
121 |
|
|
* Stuff to do with the slow timer
|
122 |
|
|
*/
|
123 |
|
|
unsigned long stamp; /* time of last transmit */
|
124 |
|
|
unsigned long persist;
|
125 |
|
|
int (*persist_fxn)(struct sock *sk);
|
126 |
|
|
unsigned long keepalive;
|
127 |
|
|
void (*keepalive_fxn)(struct sock *sk);
|
128 |
|
|
|
129 |
|
|
/*
|
130 |
|
|
* This stuff is for the fast timer for delayed acks
|
131 |
|
|
*/
|
132 |
|
|
struct timer_list delack_timer;
|
133 |
|
|
int delack_pending;
|
134 |
|
|
void (*delack_fxn)(struct sock *sk);
|
135 |
|
|
|
136 |
|
|
};
|
137 |
|
|
|
138 |
|
|
/*
|
139 |
|
|
* src,dst : Source and Destination DECnet addresses
|
140 |
|
|
* hops : Number of hops through the network
|
141 |
|
|
* dst_port, src_port : NSP port numbers
|
142 |
|
|
* services, info : Useful data extracted from conninit messages
|
143 |
|
|
* rt_flags : Routing flags byte
|
144 |
|
|
* nsp_flags : NSP layer flags byte
|
145 |
|
|
* segsize : Size of segment
|
146 |
|
|
* segnum : Number, for data, otherdata and linkservice
|
147 |
|
|
* xmit_count : Number of times we've transmitted this skb
|
148 |
|
|
* stamp : Time stamp of most recent transmission, used in RTT calculations
|
149 |
|
|
* iif: Input interface number
|
150 |
|
|
*
|
151 |
|
|
* As a general policy, this structure keeps all addresses in network
|
152 |
|
|
* byte order, and all else in host byte order. Thus dst, src, dst_port
|
153 |
|
|
* and src_port are in network order. All else is in host order.
|
154 |
|
|
*
|
155 |
|
|
*/
|
156 |
|
|
#define DN_SKB_CB(skb) ((struct dn_skb_cb *)(skb)->cb)
|
157 |
|
|
struct dn_skb_cb {
|
158 |
|
|
unsigned short dst;
|
159 |
|
|
unsigned short src;
|
160 |
|
|
unsigned short hops;
|
161 |
|
|
unsigned short dst_port;
|
162 |
|
|
unsigned short src_port;
|
163 |
|
|
unsigned char services;
|
164 |
|
|
unsigned char info;
|
165 |
|
|
unsigned char rt_flags;
|
166 |
|
|
unsigned char nsp_flags;
|
167 |
|
|
unsigned short segsize;
|
168 |
|
|
unsigned short segnum;
|
169 |
|
|
unsigned short xmit_count;
|
170 |
|
|
unsigned long stamp;
|
171 |
|
|
int iif;
|
172 |
|
|
};
|
173 |
|
|
|
174 |
|
|
static __inline__ dn_address dn_eth2dn(unsigned char *ethaddr)
|
175 |
|
|
{
|
176 |
|
|
return ethaddr[4] | (ethaddr[5] << 8);
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
static __inline__ dn_address dn_saddr2dn(struct sockaddr_dn *saddr)
|
180 |
|
|
{
|
181 |
|
|
return *(dn_address *)saddr->sdn_nodeaddr;
|
182 |
|
|
}
|
183 |
|
|
|
184 |
|
|
static __inline__ void dn_dn2eth(unsigned char *ethaddr, dn_address addr)
|
185 |
|
|
{
|
186 |
|
|
ethaddr[0] = 0xAA;
|
187 |
|
|
ethaddr[1] = 0x00;
|
188 |
|
|
ethaddr[2] = 0x04;
|
189 |
|
|
ethaddr[3] = 0x00;
|
190 |
|
|
ethaddr[4] = (unsigned char)(addr & 0xff);
|
191 |
|
|
ethaddr[5] = (unsigned char)(addr >> 8);
|
192 |
|
|
}
|
193 |
|
|
|
194 |
|
|
#define DN_MENUVER_ACC 0x01
|
195 |
|
|
#define DN_MENUVER_USR 0x02
|
196 |
|
|
#define DN_MENUVER_PRX 0x04
|
197 |
|
|
#define DN_MENUVER_UIC 0x08
|
198 |
|
|
|
199 |
|
|
extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr);
|
200 |
|
|
extern struct sock *dn_find_by_skb(struct sk_buff *skb);
|
201 |
|
|
#define DN_ASCBUF_LEN 9
|
202 |
|
|
extern char *dn_addr2asc(dn_address, char *);
|
203 |
|
|
extern int dn_destroy_timer(struct sock *sk);
|
204 |
|
|
|
205 |
|
|
extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type);
|
206 |
|
|
extern int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *addr, unsigned char *type);
|
207 |
|
|
|
208 |
|
|
extern void dn_start_slow_timer(struct sock *sk);
|
209 |
|
|
extern void dn_stop_slow_timer(struct sock *sk);
|
210 |
|
|
extern void dn_start_fast_timer(struct sock *sk);
|
211 |
|
|
extern void dn_stop_fast_timer(struct sock *sk);
|
212 |
|
|
|
213 |
|
|
extern dn_address decnet_address;
|
214 |
|
|
extern unsigned char decnet_ether_address[6];
|
215 |
|
|
extern int decnet_debug_level;
|
216 |
|
|
extern int decnet_time_wait;
|
217 |
|
|
extern int decnet_dn_count;
|
218 |
|
|
extern int decnet_di_count;
|
219 |
|
|
extern int decnet_dr_count;
|
220 |
|
|
extern int decnet_no_fc_max_cwnd;
|
221 |
|
|
|
222 |
|
|
#endif /* _NET_DN_H */
|