5 #include <asm/byteorder.h>
7 typedef unsigned short dn_address
;
9 #define dn_ntohs(x) le16_to_cpu(x)
10 #define dn_htons(x) cpu_to_le16(x)
12 struct dn_scp
/* Session Control Port */
15 #define DN_O 1 /* Open */
16 #define DN_CR 2 /* Connect Receive */
17 #define DN_DR 3 /* Disconnect Reject */
18 #define DN_DRC 4 /* Discon. Rej. Complete*/
19 #define DN_CC 5 /* Connect Confirm */
20 #define DN_CI 6 /* Connect Initiate */
21 #define DN_NR 7 /* No resources */
22 #define DN_NC 8 /* No communication */
23 #define DN_CD 9 /* Connect Delivery */
24 #define DN_RJ 10 /* Rejected */
25 #define DN_RUN 11 /* Running */
26 #define DN_DI 12 /* Disconnect Initiate */
27 #define DN_DIC 13 /* Disconnect Complete */
28 #define DN_DN 14 /* Disconnect Notificat */
29 #define DN_CL 15 /* Closed */
30 #define DN_CN 16 /* Closed Notification */
32 unsigned short addrloc
;
33 unsigned short addrrem
;
34 unsigned short numdat
;
35 unsigned short numoth
;
36 unsigned short numoth_rcv
;
37 unsigned short numdat_rcv
;
38 unsigned short ackxmt_dat
;
39 unsigned short ackxmt_oth
;
40 unsigned short ackrcv_dat
;
41 unsigned short ackrcv_oth
;
42 unsigned char flowrem_sw
;
43 unsigned char flowloc_sw
;
47 unsigned char accept_mode
;
49 unsigned long seg_size
; /* Running total of current segment */
51 struct optdata_dn conndata_in
;
52 struct optdata_dn conndata_out
;
53 struct optdata_dn discdata_in
;
54 struct optdata_dn discdata_out
;
55 struct accessdata_dn accessdata
;
57 struct sockaddr_dn addr
; /* Local address */
58 struct sockaddr_dn peer
; /* Remote address */
61 * In this case the RTT estimation is not specified in the
62 * docs, nor is any back off algorithm. Here we follow well
63 * known tcp algorithms with a few small variations.
65 * snd_window: Max number of packets we send before we wait for
66 * an ack to come back. This will become part of a
67 * more complicated scheme when we support flow
70 * nsp_srtt: Round-Trip-Time (x8) in jiffies. This is a rolling
72 * nsp_rttvar: Round-Trip-Time-Varience (x4) in jiffies. This is the
73 * varience of the smoothed average (but calculated in
74 * a simpler way than for normal statistical varience
77 * nsp_rxtshift: Backoff counter. Value is zero normally, each time
78 * a packet is lost is increases by one until an ack
79 * is received. Its used to index an array of backoff
82 #define NSP_MIN_WINDOW 1
83 #define NSP_MAX_WINDOW 512
84 unsigned long snd_window
;
85 #define NSP_INITIAL_SRTT (HZ)
86 unsigned long nsp_srtt
;
87 #define NSP_INITIAL_RTTVAR (HZ*3)
88 unsigned long nsp_rttvar
;
89 #define NSP_MAXRXTSHIFT 12
90 unsigned long nsp_rxtshift
;
93 * Output queues, one for data, one for otherdata/linkservice
95 struct sk_buff_head data_xmit_queue
;
96 struct sk_buff_head other_xmit_queue
;
99 * Input queue for other data
101 struct sk_buff_head other_receive_queue
;
105 * Stuff to do with the slow timer
107 unsigned long stamp
; /* time of last transmit */
108 unsigned long persist
;
109 int (*persist_fxn
)(struct sock
*sk
);
110 unsigned long keepalive
;
111 void (*keepalive_fxn
)(struct sock
*sk
);
114 * This stuff is for the fast timer for delayed acks
116 struct timer_list delack_timer
;
118 void (*delack_fxn
)(struct sock
*sk
);
122 * src,dst : Source and Destination DECnet addresses
123 * neigh: Address from which we've just got this skb.
124 * hops : Number of hops through the network
125 * dst_port, src_port : NSP port numbers
126 * services, info : Useful data extracted from conninit messages
127 * rt_flags : Routing flags byte
128 * nsp_flags : NSP layer flags byte
129 * segsize : Size of segment
130 * segnum : Number, for data, otherdata and linkservice
131 * xmit_count : Number of times we've transmitted this skb
132 * stamp : Time stamp of first transmission, used in RTT calculations
133 * iif: Input interface number
135 * As a general policy, this structure keeps all addresses in network
136 * byte order, and all else in host byte order. Thus dst, src, dst_port
137 * src_port and neigh are in network order. All else is in host order.
143 unsigned short neigh
;
145 unsigned short dst_port
;
146 unsigned short src_port
;
147 unsigned char services
;
149 unsigned char rt_flags
;
150 unsigned char nsp_flags
;
151 unsigned short segsize
;
152 unsigned short segnum
;
153 unsigned short xmit_count
;
158 static __inline__ dn_address
dn_eth2dn(unsigned char *ethaddr
)
160 return ethaddr
[4] | (ethaddr
[5] << 8);
163 static __inline__ dn_address
dn_saddr2dn(struct sockaddr_dn
*saddr
)
165 return *(dn_address
*)saddr
->sdn_nodeaddr
;
168 static __inline__
void dn_dn2eth(unsigned char *ethaddr
, dn_address addr
)
174 ethaddr
[4] = (unsigned char)(addr
& 0xff);
175 ethaddr
[5] = (unsigned char)(addr
>> 8);
178 #define DN_MENUVER_ACC 0x01
179 #define DN_MENUVER_USR 0x02
180 #define DN_MENUVER_PRX 0x04
181 #define DN_MENUVER_UIC 0x08
183 extern struct sock
*dn_sklist_find_listener(struct sockaddr_dn
*addr
);
184 extern struct sock
*dn_find_by_skb(struct sk_buff
*skb
);
185 #define DN_ASCBUF_LEN 7
186 extern char *dn_addr2asc(dn_address
, char *);
187 extern void dn_destroy_sock(struct sock
*sk
);
189 extern int dn_sockaddr2username(struct sockaddr_dn
*addr
, unsigned char *buf
, unsigned char type
);
190 extern int dn_username2sockaddr(unsigned char *data
, int len
, struct sockaddr_dn
*addr
, unsigned char *type
);
192 extern void dn_start_slow_timer(struct sock
*sk
);
193 extern void dn_stop_slow_timer(struct sock
*sk
);
194 extern void dn_start_fast_timer(struct sock
*sk
);
195 extern void dn_stop_fast_timer(struct sock
*sk
);
197 extern dn_address decnet_address
;
198 extern unsigned char decnet_ether_address
[6];
199 extern int decnet_node_type
;
200 extern int decnet_debug_level
;
201 extern int decnet_time_wait
;
202 extern int decnet_dn_count
;
203 extern int decnet_di_count
;
204 extern int decnet_dr_count
;
206 #endif /* _NET_DN_H */