Lines Matching refs:ax25

23 #include <net/ax25.h>
37 * Handling of state 0 and connection release is in ax25.c.
39 static int ax25_std_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type)
43 ax25->modulus = AX25_MODULUS;
44 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
45 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
49 ax25->modulus = AX25_EMODULUS;
50 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW];
51 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
55 ax25_send_control(ax25, AX25_DM, pf, AX25_RESPONSE);
60 ax25_calculate_rtt(ax25);
61 ax25_stop_t1timer(ax25);
62 ax25_start_t3timer(ax25);
63 ax25_start_idletimer(ax25);
64 ax25->vs = 0;
65 ax25->va = 0;
66 ax25->vr = 0;
67 ax25->state = AX25_STATE_3;
68 ax25->n2count = 0;
69 if (ax25->sk != NULL) {
70 bh_lock_sock(ax25->sk);
71 ax25->sk->sk_state = TCP_ESTABLISHED;
73 if (!sock_flag(ax25->sk, SOCK_DEAD))
74 ax25->sk->sk_state_change(ax25->sk);
75 bh_unlock_sock(ax25->sk);
82 if (ax25->modulus == AX25_MODULUS) {
83 ax25_disconnect(ax25, ECONNREFUSED);
85 ax25->modulus = AX25_MODULUS;
86 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
101 * Handling of state 0 and connection release is in ax25.c.
103 static int ax25_std_state2_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type)
108 ax25_send_control(ax25, AX25_DM, pf, AX25_RESPONSE);
112 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
113 ax25_disconnect(ax25, 0);
119 ax25_disconnect(ax25, 0);
126 if (pf) ax25_send_control(ax25, AX25_DM, AX25_POLLON, AX25_RESPONSE);
139 * Handling of state 0 and connection release is in ax25.c.
141 static int ax25_std_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type)
149 ax25->modulus = AX25_MODULUS;
150 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
152 ax25->modulus = AX25_EMODULUS;
153 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW];
155 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
156 ax25_stop_t1timer(ax25);
157 ax25_stop_t2timer(ax25);
158 ax25_start_t3timer(ax25);
159 ax25_start_idletimer(ax25);
160 ax25->condition = 0x00;
161 ax25->vs = 0;
162 ax25->va = 0;
163 ax25->vr = 0;
164 ax25_requeue_frames(ax25);
168 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
169 ax25_disconnect(ax25, 0);
173 ax25_disconnect(ax25, ECONNRESET);
179 ax25->condition &= ~AX25_COND_PEER_RX_BUSY;
181 ax25->condition |= AX25_COND_PEER_RX_BUSY;
183 ax25_std_enquiry_response(ax25);
184 if (ax25_validate_nr(ax25, nr)) {
185 ax25_check_iframes_acked(ax25, nr);
187 ax25_std_nr_error_recovery(ax25);
188 ax25->state = AX25_STATE_1;
193 ax25->condition &= ~AX25_COND_PEER_RX_BUSY;
195 ax25_std_enquiry_response(ax25);
196 if (ax25_validate_nr(ax25, nr)) {
197 ax25_frames_acked(ax25, nr);
198 ax25_calculate_rtt(ax25);
199 ax25_stop_t1timer(ax25);
200 ax25_start_t3timer(ax25);
201 ax25_requeue_frames(ax25);
203 ax25_std_nr_error_recovery(ax25);
204 ax25->state = AX25_STATE_1;
209 if (!ax25_validate_nr(ax25, nr)) {
210 ax25_std_nr_error_recovery(ax25);
211 ax25->state = AX25_STATE_1;
214 if (ax25->condition & AX25_COND_PEER_RX_BUSY) {
215 ax25_frames_acked(ax25, nr);
217 ax25_check_iframes_acked(ax25, nr);
219 if (ax25->condition & AX25_COND_OWN_RX_BUSY) {
220 if (pf) ax25_std_enquiry_response(ax25);
223 if (ns == ax25->vr) {
224 ax25->vr = (ax25->vr + 1) % ax25->modulus;
225 queued = ax25_rx_iframe(ax25, skb);
226 if (ax25->condition & AX25_COND_OWN_RX_BUSY)
227 ax25->vr = ns; /* ax25->vr - 1 */
228 ax25->condition &= ~AX25_COND_REJECT;
230 ax25_std_enquiry_response(ax25);
232 if (!(ax25->condition & AX25_COND_ACK_PENDING)) {
233 ax25->condition |= AX25_COND_ACK_PENDING;
234 ax25_start_t2timer(ax25);
238 if (ax25->condition & AX25_COND_REJECT) {
239 if (pf) ax25_std_enquiry_response(ax25);
241 ax25->condition |= AX25_COND_REJECT;
242 ax25_send_control(ax25, AX25_REJ, pf, AX25_RESPONSE);
243 ax25->condition &= ~AX25_COND_ACK_PENDING;
250 ax25_std_establish_data_link(ax25);
251 ax25->state = AX25_STATE_1;
264 * Handling of state 0 and connection release is in ax25.c.
266 static int ax25_std_state4_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type)
274 ax25->modulus = AX25_MODULUS;
275 ax25->window = ax25->ax25_dev->values[AX25_VALUES_WINDOW];
277 ax25->modulus = AX25_EMODULUS;
278 ax25->window = ax25->ax25_dev->values[AX25_VALUES_EWINDOW];
280 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
281 ax25_stop_t1timer(ax25);
282 ax25_stop_t2timer(ax25);
283 ax25_start_t3timer(ax25);
284 ax25_start_idletimer(ax25);
285 ax25->condition = 0x00;
286 ax25->vs = 0;
287 ax25->va = 0;
288 ax25->vr = 0;
289 ax25->state = AX25_STATE_3;
290 ax25->n2count = 0;
291 ax25_requeue_frames(ax25);
295 ax25_send_control(ax25, AX25_UA, pf, AX25_RESPONSE);
296 ax25_disconnect(ax25, 0);
300 ax25_disconnect(ax25, ECONNRESET);
306 ax25->condition &= ~AX25_COND_PEER_RX_BUSY;
308 ax25->condition |= AX25_COND_PEER_RX_BUSY;
310 ax25_stop_t1timer(ax25);
311 ax25->n2count = 0;
312 if (ax25_validate_nr(ax25, nr)) {
313 ax25_frames_acked(ax25, nr);
314 if (ax25->vs == ax25->va) {
315 ax25_start_t3timer(ax25);
316 ax25->state = AX25_STATE_3;
318 ax25_requeue_frames(ax25);
321 ax25_std_nr_error_recovery(ax25);
322 ax25->state = AX25_STATE_1;
327 ax25_std_enquiry_response(ax25);
328 if (ax25_validate_nr(ax25, nr)) {
329 ax25_frames_acked(ax25, nr);
331 ax25_std_nr_error_recovery(ax25);
332 ax25->state = AX25_STATE_1;
337 ax25->condition &= ~AX25_COND_PEER_RX_BUSY;
339 ax25_stop_t1timer(ax25);
340 ax25->n2count = 0;
341 if (ax25_validate_nr(ax25, nr)) {
342 ax25_frames_acked(ax25, nr);
343 if (ax25->vs == ax25->va) {
344 ax25_start_t3timer(ax25);
345 ax25->state = AX25_STATE_3;
347 ax25_requeue_frames(ax25);
350 ax25_std_nr_error_recovery(ax25);
351 ax25->state = AX25_STATE_1;
356 ax25_std_enquiry_response(ax25);
357 if (ax25_validate_nr(ax25, nr)) {
358 ax25_frames_acked(ax25, nr);
359 ax25_requeue_frames(ax25);
361 ax25_std_nr_error_recovery(ax25);
362 ax25->state = AX25_STATE_1;
367 if (!ax25_validate_nr(ax25, nr)) {
368 ax25_std_nr_error_recovery(ax25);
369 ax25->state = AX25_STATE_1;
372 ax25_frames_acked(ax25, nr);
373 if (ax25->condition & AX25_COND_OWN_RX_BUSY) {
375 ax25_std_enquiry_response(ax25);
378 if (ns == ax25->vr) {
379 ax25->vr = (ax25->vr + 1) % ax25->modulus;
380 queued = ax25_rx_iframe(ax25, skb);
381 if (ax25->condition & AX25_COND_OWN_RX_BUSY)
382 ax25->vr = ns; /* ax25->vr - 1 */
383 ax25->condition &= ~AX25_COND_REJECT;
385 ax25_std_enquiry_response(ax25);
387 if (!(ax25->condition & AX25_COND_ACK_PENDING)) {
388 ax25->condition |= AX25_COND_ACK_PENDING;
389 ax25_start_t2timer(ax25);
393 if (ax25->condition & AX25_COND_REJECT) {
394 if (pf) ax25_std_enquiry_response(ax25);
396 ax25->condition |= AX25_COND_REJECT;
397 ax25_send_control(ax25, AX25_REJ, pf, AX25_RESPONSE);
398 ax25->condition &= ~AX25_COND_ACK_PENDING;
405 ax25_std_establish_data_link(ax25);
406 ax25->state = AX25_STATE_1;
419 int ax25_std_frame_in(ax25_cb *ax25, struct sk_buff *skb, int type)
423 frametype = ax25_decode(ax25, skb, &ns, &nr, &pf);
425 switch (ax25->state) {
427 queued = ax25_std_state1_machine(ax25, skb, frametype, pf, type);
430 queued = ax25_std_state2_machine(ax25, skb, frametype, pf, type);
433 queued = ax25_std_state3_machine(ax25, skb, frametype, ns, nr, pf, type);
436 queued = ax25_std_state4_machine(ax25, skb, frametype, ns, nr, pf, type);
440 ax25_kick(ax25);