4 * This code REQUIRES 2.1.15 or higher/ NET3.038
7 * This module is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
12 * Most of this code is based on the SDL diagrams published in the 7th
13 * ARRL Computer Networking Conference papers. The diagrams have mistakes
14 * in them, but are mostly correct. Before you modify the code could you
15 * read the SDL diagrams as the code is not obvious and probably very
19 * AX.25 036 Jonathan(G4KLX) Split from ax25_out.c.
20 * AX.25 037 Jonathan(G4KLX) New timer architecture.
23 #include <linux/errno.h>
24 #include <linux/types.h>
25 #include <linux/socket.h>
27 #include <linux/kernel.h>
28 #include <linux/sched.h>
29 #include <linux/timer.h>
30 #include <linux/string.h>
31 #include <linux/sockios.h>
32 #include <linux/net.h>
34 #include <linux/inet.h>
35 #include <linux/netdevice.h>
36 #include <linux/skbuff.h>
38 #include <asm/uaccess.h>
39 #include <asm/system.h>
40 #include <linux/fcntl.h>
42 #include <linux/interrupt.h>
45 * The following routines are taken from page 170 of the 7th ARRL Computer
46 * Networking Conference paper, as is the whole state machine.
49 void ax25_std_nr_error_recovery(ax25_cb *ax25)
51 ax25_std_establish_data_link(ax25);
54 void ax25_std_establish_data_link(ax25_cb *ax25)
56 ax25->condition = 0x00;
59 if (ax25->modulus == AX25_MODULUS)
60 ax25_send_control(ax25, AX25_SABM, AX25_POLLON, AX25_COMMAND);
62 ax25_send_control(ax25, AX25_SABME, AX25_POLLON, AX25_COMMAND);
64 ax25_calculate_t1(ax25);
65 ax25_stop_idletimer(ax25);
66 ax25_stop_t3timer(ax25);
67 ax25_stop_t2timer(ax25);
68 ax25_start_t1timer(ax25);
71 void ax25_std_transmit_enquiry(ax25_cb *ax25)
73 if (ax25->condition & AX25_COND_OWN_RX_BUSY)
74 ax25_send_control(ax25, AX25_RNR, AX25_POLLON, AX25_COMMAND);
76 ax25_send_control(ax25, AX25_RR, AX25_POLLON, AX25_COMMAND);
78 ax25->condition &= ~AX25_COND_ACK_PENDING;
80 ax25_calculate_t1(ax25);
81 ax25_start_t1timer(ax25);
84 void ax25_std_enquiry_response(ax25_cb *ax25)
86 if (ax25->condition & AX25_COND_OWN_RX_BUSY)
87 ax25_send_control(ax25, AX25_RNR, AX25_POLLON, AX25_RESPONSE);
89 ax25_send_control(ax25, AX25_RR, AX25_POLLON, AX25_RESPONSE);
91 ax25->condition &= ~AX25_COND_ACK_PENDING;
94 void ax25_std_timeout_response(ax25_cb *ax25)
96 if (ax25->condition & AX25_COND_OWN_RX_BUSY)
97 ax25_send_control(ax25, AX25_RNR, AX25_POLLOFF, AX25_RESPONSE);
99 ax25_send_control(ax25, AX25_RR, AX25_POLLOFF, AX25_RESPONSE);
101 ax25->condition &= ~AX25_COND_ACK_PENDING;