Lines Matching refs:ax25
32 static int ax25_ds_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int ty… in ax25_ds_state1_machine() argument
36 ax25->modulus = AX25_MODULUS; in ax25_ds_state1_machine()
37 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_ds_state1_machine()
38 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE); in ax25_ds_state1_machine()
42 ax25->modulus = AX25_EMODULUS; in ax25_ds_state1_machine()
43 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW]; in ax25_ds_state1_machine()
44 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE); in ax25_ds_state1_machine()
48 ax25_send_control(ax25, AX25_DM, pf, AX25_RESPONSE); in ax25_ds_state1_machine()
52 ax25_calculate_rtt(ax25); in ax25_ds_state1_machine()
53 ax25_stop_t1timer(ax25); in ax25_ds_state1_machine()
54 ax25_start_t3timer(ax25); in ax25_ds_state1_machine()
55 ax25_start_idletimer(ax25); in ax25_ds_state1_machine()
56 ax25->vs = 0; in ax25_ds_state1_machine()
57 ax25->va = 0; in ax25_ds_state1_machine()
58 ax25->vr = 0; in ax25_ds_state1_machine()
59 ax25->state = AX25_STATE_3; in ax25_ds_state1_machine()
60 ax25->n2count = 0; in ax25_ds_state1_machine()
61 if (ax25->sk != NULL) { in ax25_ds_state1_machine()
62 bh_lock_sock(ax25->sk); in ax25_ds_state1_machine()
63 ax25->sk->sk_state = TCP_ESTABLISHED; in ax25_ds_state1_machine()
68 if (!sock_flag(ax25->sk, SOCK_DEAD)) in ax25_ds_state1_machine()
69 ax25->sk->sk_state_change(ax25->sk); in ax25_ds_state1_machine()
70 bh_unlock_sock(ax25->sk); in ax25_ds_state1_machine()
72 ax25_dama_on(ax25); in ax25_ds_state1_machine()
78 ax25_std_enquiry_response(ax25); in ax25_ds_state1_machine()
83 ax25_disconnect(ax25, ECONNREFUSED); in ax25_ds_state1_machine()
88 ax25_send_control(ax25, AX25_SABM, AX25_POLLON, AX25_COMMAND); in ax25_ds_state1_machine()
100 static int ax25_ds_state2_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int ty… in ax25_ds_state2_machine() argument
105 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_ds_state2_machine()
106 ax25_dama_off(ax25); in ax25_ds_state2_machine()
110 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE); in ax25_ds_state2_machine()
111 ax25_dama_off(ax25); in ax25_ds_state2_machine()
112 ax25_disconnect(ax25, 0); in ax25_ds_state2_machine()
118 ax25_dama_off(ax25); in ax25_ds_state2_machine()
119 ax25_disconnect(ax25, 0); in ax25_ds_state2_machine()
128 ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); in ax25_ds_state2_machine()
129 ax25_dama_off(ax25); in ax25_ds_state2_machine()
145 static int ax25_ds_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int ns, int nr… in ax25_ds_state3_machine() argument
153 ax25->modulus = AX25_MODULUS; in ax25_ds_state3_machine()
154 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW]; in ax25_ds_state3_machine()
156 ax25->modulus = AX25_EMODULUS; in ax25_ds_state3_machine()
157 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW]; in ax25_ds_state3_machine()
159 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE); in ax25_ds_state3_machine()
160 ax25_stop_t1timer(ax25); in ax25_ds_state3_machine()
161 ax25_start_t3timer(ax25); in ax25_ds_state3_machine()
162 ax25_start_idletimer(ax25); in ax25_ds_state3_machine()
163 ax25->condition = 0x00; in ax25_ds_state3_machine()
164 ax25->vs = 0; in ax25_ds_state3_machine()
165 ax25->va = 0; in ax25_ds_state3_machine()
166 ax25->vr = 0; in ax25_ds_state3_machine()
167 ax25_requeue_frames(ax25); in ax25_ds_state3_machine()
168 ax25_dama_on(ax25); in ax25_ds_state3_machine()
172 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE); in ax25_ds_state3_machine()
173 ax25_dama_off(ax25); in ax25_ds_state3_machine()
174 ax25_disconnect(ax25, 0); in ax25_ds_state3_machine()
178 ax25_dama_off(ax25); in ax25_ds_state3_machine()
179 ax25_disconnect(ax25, ECONNRESET); in ax25_ds_state3_machine()
185 ax25->condition &= ~AX25_COND_PEER_RX_BUSY; in ax25_ds_state3_machine()
187 ax25->condition |= AX25_COND_PEER_RX_BUSY; in ax25_ds_state3_machine()
189 if (ax25_validate_nr(ax25, nr)) { in ax25_ds_state3_machine()
190 if (ax25_check_iframes_acked(ax25, nr)) in ax25_ds_state3_machine()
191 ax25->n2count=0; in ax25_ds_state3_machine()
193 ax25_ds_enquiry_response(ax25); in ax25_ds_state3_machine()
195 ax25_ds_nr_error_recovery(ax25); in ax25_ds_state3_machine()
196 ax25->state = AX25_STATE_1; in ax25_ds_state3_machine()
201 ax25->condition &= ~AX25_COND_PEER_RX_BUSY; in ax25_ds_state3_machine()
203 if (ax25_validate_nr(ax25, nr)) { in ax25_ds_state3_machine()
204 if (ax25->va != nr) in ax25_ds_state3_machine()
205 ax25->n2count=0; in ax25_ds_state3_machine()
207 ax25_frames_acked(ax25, nr); in ax25_ds_state3_machine()
208 ax25_calculate_rtt(ax25); in ax25_ds_state3_machine()
209 ax25_stop_t1timer(ax25); in ax25_ds_state3_machine()
210 ax25_start_t3timer(ax25); in ax25_ds_state3_machine()
211 ax25_requeue_frames(ax25); in ax25_ds_state3_machine()
214 ax25_ds_enquiry_response(ax25); in ax25_ds_state3_machine()
216 ax25_ds_nr_error_recovery(ax25); in ax25_ds_state3_machine()
217 ax25->state = AX25_STATE_1; in ax25_ds_state3_machine()
222 if (!ax25_validate_nr(ax25, nr)) { in ax25_ds_state3_machine()
223 ax25_ds_nr_error_recovery(ax25); in ax25_ds_state3_machine()
224 ax25->state = AX25_STATE_1; in ax25_ds_state3_machine()
227 if (ax25->condition & AX25_COND_PEER_RX_BUSY) { in ax25_ds_state3_machine()
228 ax25_frames_acked(ax25, nr); in ax25_ds_state3_machine()
229 ax25->n2count = 0; in ax25_ds_state3_machine()
231 if (ax25_check_iframes_acked(ax25, nr)) in ax25_ds_state3_machine()
232 ax25->n2count = 0; in ax25_ds_state3_machine()
234 if (ax25->condition & AX25_COND_OWN_RX_BUSY) { in ax25_ds_state3_machine()
235 if (pf) ax25_ds_enquiry_response(ax25); in ax25_ds_state3_machine()
238 if (ns == ax25->vr) { in ax25_ds_state3_machine()
239 ax25->vr = (ax25->vr + 1) % ax25->modulus; in ax25_ds_state3_machine()
240 queued = ax25_rx_iframe(ax25, skb); in ax25_ds_state3_machine()
241 if (ax25->condition & AX25_COND_OWN_RX_BUSY) in ax25_ds_state3_machine()
242 ax25->vr = ns; /* ax25->vr - 1 */ in ax25_ds_state3_machine()
243 ax25->condition &= ~AX25_COND_REJECT; in ax25_ds_state3_machine()
245 ax25_ds_enquiry_response(ax25); in ax25_ds_state3_machine()
247 if (!(ax25->condition & AX25_COND_ACK_PENDING)) { in ax25_ds_state3_machine()
248 ax25->condition |= AX25_COND_ACK_PENDING; in ax25_ds_state3_machine()
249 ax25_start_t2timer(ax25); in ax25_ds_state3_machine()
253 if (ax25->condition & AX25_COND_REJECT) { in ax25_ds_state3_machine()
254 if (pf) ax25_ds_enquiry_response(ax25); in ax25_ds_state3_machine()
256 ax25->condition |= AX25_COND_REJECT; in ax25_ds_state3_machine()
257 ax25_ds_enquiry_response(ax25); in ax25_ds_state3_machine()
258 ax25->condition &= ~AX25_COND_ACK_PENDING; in ax25_ds_state3_machine()
265 ax25_ds_establish_data_link(ax25); in ax25_ds_state3_machine()
266 ax25->state = AX25_STATE_1; in ax25_ds_state3_machine()
279 int ax25_ds_frame_in(ax25_cb *ax25, struct sk_buff *skb, int type) in ax25_ds_frame_in() argument
283 frametype = ax25_decode(ax25, skb, &ns, &nr, &pf); in ax25_ds_frame_in()
285 switch (ax25->state) { in ax25_ds_frame_in()
287 queued = ax25_ds_state1_machine(ax25, skb, frametype, pf, type); in ax25_ds_frame_in()
290 queued = ax25_ds_state2_machine(ax25, skb, frametype, pf, type); in ax25_ds_frame_in()
293 queued = ax25_ds_state3_machine(ax25, skb, frametype, ns, nr, pf, type); in ax25_ds_frame_in()