Root/
1 | /* |
2 | * This program is free software; you can redistribute it and/or modify |
3 | * it under the terms of the GNU General Public License as published by |
4 | * the Free Software Foundation; either version 2 of the License, or |
5 | * (at your option) any later version. |
6 | * |
7 | * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) |
8 | */ |
9 | #include <linux/errno.h> |
10 | #include <linux/types.h> |
11 | #include <linux/socket.h> |
12 | #include <linux/in.h> |
13 | #include <linux/kernel.h> |
14 | #include <linux/timer.h> |
15 | #include <linux/string.h> |
16 | #include <linux/sockios.h> |
17 | #include <linux/net.h> |
18 | #include <net/ax25.h> |
19 | #include <linux/inet.h> |
20 | #include <linux/netdevice.h> |
21 | #include <linux/skbuff.h> |
22 | #include <net/sock.h> |
23 | #include <asm/uaccess.h> |
24 | #include <linux/fcntl.h> |
25 | #include <linux/mm.h> |
26 | #include <linux/interrupt.h> |
27 | |
28 | /* |
29 | * The following routines are taken from page 170 of the 7th ARRL Computer |
30 | * Networking Conference paper, as is the whole state machine. |
31 | */ |
32 | |
33 | void ax25_std_nr_error_recovery(ax25_cb *ax25) |
34 | { |
35 | ax25_std_establish_data_link(ax25); |
36 | } |
37 | |
38 | void ax25_std_establish_data_link(ax25_cb *ax25) |
39 | { |
40 | ax25->condition = 0x00; |
41 | ax25->n2count = 0; |
42 | |
43 | if (ax25->modulus == AX25_MODULUS) |
44 | ax25_send_control(ax25, AX25_SABM, AX25_POLLON, AX25_COMMAND); |
45 | else |
46 | ax25_send_control(ax25, AX25_SABME, AX25_POLLON, AX25_COMMAND); |
47 | |
48 | ax25_calculate_t1(ax25); |
49 | ax25_stop_idletimer(ax25); |
50 | ax25_stop_t3timer(ax25); |
51 | ax25_stop_t2timer(ax25); |
52 | ax25_start_t1timer(ax25); |
53 | } |
54 | |
55 | void ax25_std_transmit_enquiry(ax25_cb *ax25) |
56 | { |
57 | if (ax25->condition & AX25_COND_OWN_RX_BUSY) |
58 | ax25_send_control(ax25, AX25_RNR, AX25_POLLON, AX25_COMMAND); |
59 | else |
60 | ax25_send_control(ax25, AX25_RR, AX25_POLLON, AX25_COMMAND); |
61 | |
62 | ax25->condition &= ~AX25_COND_ACK_PENDING; |
63 | |
64 | ax25_calculate_t1(ax25); |
65 | ax25_start_t1timer(ax25); |
66 | } |
67 | |
68 | void ax25_std_enquiry_response(ax25_cb *ax25) |
69 | { |
70 | if (ax25->condition & AX25_COND_OWN_RX_BUSY) |
71 | ax25_send_control(ax25, AX25_RNR, AX25_POLLON, AX25_RESPONSE); |
72 | else |
73 | ax25_send_control(ax25, AX25_RR, AX25_POLLON, AX25_RESPONSE); |
74 | |
75 | ax25->condition &= ~AX25_COND_ACK_PENDING; |
76 | } |
77 | |
78 | void ax25_std_timeout_response(ax25_cb *ax25) |
79 | { |
80 | if (ax25->condition & AX25_COND_OWN_RX_BUSY) |
81 | ax25_send_control(ax25, AX25_RNR, AX25_POLLOFF, AX25_RESPONSE); |
82 | else |
83 | ax25_send_control(ax25, AX25_RR, AX25_POLLOFF, AX25_RESPONSE); |
84 | |
85 | ax25->condition &= ~AX25_COND_ACK_PENDING; |
86 | } |
87 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9