~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/ax25/ax25_std_subr.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 /*
  3  *
  4  * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
  5  */
  6 #include <linux/errno.h>
  7 #include <linux/types.h>
  8 #include <linux/socket.h>
  9 #include <linux/in.h>
 10 #include <linux/kernel.h>
 11 #include <linux/timer.h>
 12 #include <linux/string.h>
 13 #include <linux/sockios.h>
 14 #include <linux/net.h>
 15 #include <net/ax25.h>
 16 #include <linux/inet.h>
 17 #include <linux/netdevice.h>
 18 #include <linux/skbuff.h>
 19 #include <net/sock.h>
 20 #include <linux/uaccess.h>
 21 #include <linux/fcntl.h>
 22 #include <linux/mm.h>
 23 #include <linux/interrupt.h>
 24 
 25 /*
 26  * The following routines are taken from page 170 of the 7th ARRL Computer
 27  * Networking Conference paper, as is the whole state machine.
 28  */
 29 
 30 void ax25_std_nr_error_recovery(ax25_cb *ax25)
 31 {
 32         ax25_std_establish_data_link(ax25);
 33 }
 34 
 35 void ax25_std_establish_data_link(ax25_cb *ax25)
 36 {
 37         ax25->condition = 0x00;
 38         ax25->n2count   = 0;
 39 
 40         if (ax25->modulus == AX25_MODULUS)
 41                 ax25_send_control(ax25, AX25_SABM, AX25_POLLON, AX25_COMMAND);
 42         else
 43                 ax25_send_control(ax25, AX25_SABME, AX25_POLLON, AX25_COMMAND);
 44 
 45         ax25_calculate_t1(ax25);
 46         ax25_stop_idletimer(ax25);
 47         ax25_stop_t3timer(ax25);
 48         ax25_stop_t2timer(ax25);
 49         ax25_start_t1timer(ax25);
 50 }
 51 
 52 void ax25_std_transmit_enquiry(ax25_cb *ax25)
 53 {
 54         if (ax25->condition & AX25_COND_OWN_RX_BUSY)
 55                 ax25_send_control(ax25, AX25_RNR, AX25_POLLON, AX25_COMMAND);
 56         else
 57                 ax25_send_control(ax25, AX25_RR, AX25_POLLON, AX25_COMMAND);
 58 
 59         ax25->condition &= ~AX25_COND_ACK_PENDING;
 60 
 61         ax25_calculate_t1(ax25);
 62         ax25_start_t1timer(ax25);
 63 }
 64 
 65 void ax25_std_enquiry_response(ax25_cb *ax25)
 66 {
 67         if (ax25->condition & AX25_COND_OWN_RX_BUSY)
 68                 ax25_send_control(ax25, AX25_RNR, AX25_POLLON, AX25_RESPONSE);
 69         else
 70                 ax25_send_control(ax25, AX25_RR, AX25_POLLON, AX25_RESPONSE);
 71 
 72         ax25->condition &= ~AX25_COND_ACK_PENDING;
 73 }
 74 
 75 void ax25_std_timeout_response(ax25_cb *ax25)
 76 {
 77         if (ax25->condition & AX25_COND_OWN_RX_BUSY)
 78                 ax25_send_control(ax25, AX25_RNR, AX25_POLLOFF, AX25_RESPONSE);
 79         else
 80                 ax25_send_control(ax25, AX25_RR, AX25_POLLOFF, AX25_RESPONSE);
 81 
 82         ax25->condition &= ~AX25_COND_ACK_PENDING;
 83 }
 84 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php