^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Declarations of AX.25 type objects.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Alan Cox (GW4PTS) 10/11/93
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef _AX25_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define _AX25_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/ax25.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/refcount.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <net/neighbour.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <net/sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define AX25_T1CLAMPLO 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define AX25_T1CLAMPHI (30 * HZ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define AX25_BPQ_HEADER_LEN 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define AX25_KISS_HEADER_LEN 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define AX25_HEADER_LEN 17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define AX25_ADDR_LEN 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define AX25_DIGI_HEADER_LEN (AX25_MAX_DIGIS * AX25_ADDR_LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define AX25_MAX_HEADER_LEN (AX25_HEADER_LEN + AX25_DIGI_HEADER_LEN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* AX.25 Protocol IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define AX25_P_ROSE 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define AX25_P_VJCOMP 0x06 /* Compressed TCP/IP packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* Van Jacobsen (RFC 1144) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define AX25_P_VJUNCOMP 0x07 /* Uncompressed TCP/IP packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /* Van Jacobsen (RFC 1144) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define AX25_P_SEGMENT 0x08 /* Segmentation fragment */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define AX25_P_TEXNET 0xc3 /* TEXTNET datagram protocol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define AX25_P_LQ 0xc4 /* Link Quality Protocol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define AX25_P_ATALK 0xca /* Appletalk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define AX25_P_ATALK_ARP 0xcb /* Appletalk ARP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define AX25_P_IP 0xcc /* ARPA Internet Protocol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define AX25_P_ARP 0xcd /* ARPA Address Resolution */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define AX25_P_FLEXNET 0xce /* FlexNet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define AX25_P_NETROM 0xcf /* NET/ROM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define AX25_P_TEXT 0xF0 /* No layer 3 protocol impl. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /* AX.25 Segment control values */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define AX25_SEG_REM 0x7F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define AX25_SEG_FIRST 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define AX25_CBIT 0x80 /* Command/Response bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define AX25_EBIT 0x01 /* HDLC Address Extension bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define AX25_HBIT 0x80 /* Has been repeated bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define AX25_SSSID_SPARE 0x60 /* Unused bits in SSID for standard AX.25 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define AX25_ESSID_SPARE 0x20 /* Unused bits in SSID for extended AX.25 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define AX25_DAMA_FLAG 0x20 /* Well, it is *NOT* unused! (dl1bke 951121 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define AX25_COND_ACK_PENDING 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define AX25_COND_REJECT 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define AX25_COND_PEER_RX_BUSY 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define AX25_COND_OWN_RX_BUSY 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define AX25_COND_DAMA_MODE 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #ifndef _LINUX_NETDEVICE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) /* Upper sub-layer (LAPB) definitions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /* Control field templates */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define AX25_I 0x00 /* Information frames */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define AX25_S 0x01 /* Supervisory frames */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define AX25_RR 0x01 /* Receiver ready */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define AX25_RNR 0x05 /* Receiver not ready */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define AX25_REJ 0x09 /* Reject */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #define AX25_U 0x03 /* Unnumbered frames */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define AX25_SABM 0x2f /* Set Asynchronous Balanced Mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define AX25_SABME 0x6f /* Set Asynchronous Balanced Mode Extended */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define AX25_DISC 0x43 /* Disconnect */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define AX25_DM 0x0f /* Disconnected mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define AX25_UA 0x63 /* Unnumbered acknowledge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define AX25_FRMR 0x87 /* Frame reject */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define AX25_UI 0x03 /* Unnumbered information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define AX25_XID 0xaf /* Exchange information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define AX25_TEST 0xe3 /* Test */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #define AX25_PF 0x10 /* Poll/final bit for standard AX.25 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define AX25_EPF 0x01 /* Poll/final bit for extended AX.25 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define AX25_ILLEGAL 0x100 /* Impossible to be a real frame type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #define AX25_POLLOFF 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define AX25_POLLON 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /* AX25 L2 C-bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #define AX25_COMMAND 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define AX25_RESPONSE 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /* Define Link State constants. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) AX25_STATE_0, /* Listening */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) AX25_STATE_1, /* SABM sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) AX25_STATE_2, /* DISC sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) AX25_STATE_3, /* Established */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) AX25_STATE_4 /* Recovery */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define AX25_MODULUS 8 /* Standard AX.25 modulus */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define AX25_EMODULUS 128 /* Extended AX.25 modulus */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) AX25_PROTO_STD_SIMPLEX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) AX25_PROTO_STD_DUPLEX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #ifdef CONFIG_AX25_DAMA_SLAVE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) AX25_PROTO_DAMA_SLAVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #ifdef CONFIG_AX25_DAMA_MASTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) AX25_PROTO_DAMA_MASTER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define AX25_PROTO_MAX AX25_PROTO_DAMA_MASTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) __AX25_PROTO_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) AX25_PROTO_MAX = __AX25_PROTO_MAX -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) AX25_VALUES_IPDEFMODE, /* 0=DG 1=VC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) AX25_VALUES_AXDEFMODE, /* 0=Normal 1=Extended Seq Nos */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) AX25_VALUES_BACKOFF, /* 0=None 1=Linear 2=Exponential */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) AX25_VALUES_CONMODE, /* Allow connected modes - 0=No 1=no "PID text" 2=all PIDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) AX25_VALUES_WINDOW, /* Default window size for standard AX.25 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) AX25_VALUES_EWINDOW, /* Default window size for extended AX.25 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) AX25_VALUES_T1, /* Default T1 timeout value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) AX25_VALUES_T2, /* Default T2 timeout value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) AX25_VALUES_T3, /* Default T3 timeout value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) AX25_VALUES_IDLE, /* Connected mode idle timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) AX25_VALUES_N2, /* Default N2 value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) AX25_VALUES_PACLEN, /* AX.25 MTU */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) AX25_VALUES_PROTOCOL, /* Std AX.25, DAMA Slave, DAMA Master */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) AX25_VALUES_DS_TIMEOUT, /* DAMA Slave timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) AX25_MAX_VALUES /* THIS MUST REMAIN THE LAST ENTRY OF THIS LIST */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #define AX25_DEF_IPDEFMODE 0 /* Datagram */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #define AX25_DEF_AXDEFMODE 0 /* Normal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #define AX25_DEF_BACKOFF 1 /* Linear backoff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) #define AX25_DEF_CONMODE 2 /* Connected mode allowed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define AX25_DEF_WINDOW 2 /* Window=2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #define AX25_DEF_EWINDOW 32 /* Module-128 Window=32 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #define AX25_DEF_T1 10000 /* T1=10s */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) #define AX25_DEF_T2 3000 /* T2=3s */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) #define AX25_DEF_T3 300000 /* T3=300s */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define AX25_DEF_N2 10 /* N2=10 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #define AX25_DEF_IDLE 0 /* Idle=None */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) #define AX25_DEF_PACLEN 256 /* Paclen=256 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) #define AX25_DEF_PROTOCOL AX25_PROTO_STD_SIMPLEX /* Standard AX.25 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) #define AX25_DEF_DS_TIMEOUT 180000 /* DAMA timeout 3 minutes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) typedef struct ax25_uid_assoc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct hlist_node uid_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) refcount_t refcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) kuid_t uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) ax25_address call;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) } ax25_uid_assoc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #define ax25_uid_for_each(__ax25, list) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) hlist_for_each_entry(__ax25, list, uid_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #define ax25_uid_hold(ax25) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) refcount_inc(&((ax25)->refcount))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static inline void ax25_uid_put(ax25_uid_assoc *assoc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) if (refcount_dec_and_test(&assoc->refcount)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) kfree(assoc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) ax25_address calls[AX25_MAX_DIGIS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) unsigned char repeated[AX25_MAX_DIGIS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) unsigned char ndigi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) signed char lastrepeat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) } ax25_digi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) typedef struct ax25_route {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) struct ax25_route *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) refcount_t refcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) ax25_address callsign;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) struct net_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) ax25_digi *digipeat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) char ip_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) } ax25_route;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline void ax25_hold_route(ax25_route *ax25_rt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) refcount_inc(&ax25_rt->refcount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) void __ax25_put_route(ax25_route *ax25_rt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) extern rwlock_t ax25_route_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static inline void ax25_route_lock_use(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) read_lock(&ax25_route_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static inline void ax25_route_lock_unuse(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) read_unlock(&ax25_route_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) static inline void ax25_put_route(ax25_route *ax25_rt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) if (refcount_dec_and_test(&ax25_rt->refcount))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) __ax25_put_route(ax25_rt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) char slave; /* slave_mode? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) struct timer_list slave_timer; /* timeout timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) unsigned short slave_timeout; /* when? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) } ax25_dama_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) struct ctl_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) typedef struct ax25_dev {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) struct ax25_dev *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) struct net_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) struct net_device *forward;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) struct ctl_table_header *sysheader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) int values[AX25_MAX_VALUES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) #if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) ax25_dama_info dama;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) } ax25_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) typedef struct ax25_cb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) struct hlist_node ax25_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) ax25_address source_addr, dest_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) ax25_digi *digipeat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) ax25_dev *ax25_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) unsigned char iamdigi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) unsigned char state, modulus, pidincl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) unsigned short vs, vr, va;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) unsigned char condition, backoff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) unsigned char n2, n2count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) struct timer_list t1timer, t2timer, t3timer, idletimer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) unsigned long t1, t2, t3, idle, rtt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) unsigned short paclen, fragno, fraglen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) struct sk_buff_head write_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) struct sk_buff_head reseq_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) struct sk_buff_head ack_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) struct sk_buff_head frag_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) unsigned char window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) struct timer_list timer, dtimer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) struct sock *sk; /* Backlink to socket */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) refcount_t refcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) } ax25_cb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) struct ax25_sock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) struct sock sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) struct ax25_cb *cb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) static inline struct ax25_sock *ax25_sk(const struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) return (struct ax25_sock *) sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) static inline struct ax25_cb *sk_to_ax25(const struct sock *sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) return ax25_sk(sk)->cb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) #define ax25_for_each(__ax25, list) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) hlist_for_each_entry(__ax25, list, ax25_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) #define ax25_cb_hold(__ax25) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) refcount_inc(&((__ax25)->refcount))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) static __inline__ void ax25_cb_put(ax25_cb *ax25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) if (refcount_dec_and_test(&ax25->refcount)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) kfree(ax25->digipeat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) kfree(ax25);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) skb->dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) skb_reset_mac_header(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) skb->pkt_type = PACKET_HOST;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) return htons(ETH_P_AX25);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) /* af_ax25.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) extern struct hlist_head ax25_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) extern spinlock_t ax25_list_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) void ax25_cb_add(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) struct sock *ax25_find_listener(ax25_address *, int, struct net_device *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) struct sock *ax25_get_socket(ax25_address *, ax25_address *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) ax25_cb *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) void ax25_send_to_raw(ax25_address *, struct sk_buff *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) void ax25_destroy_socket(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) ax25_cb * __must_check ax25_create_cb(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) void ax25_fillin_cb(ax25_cb *, ax25_dev *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) struct sock *ax25_make_new(struct sock *, struct ax25_dev *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) /* ax25_addr.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) extern const ax25_address ax25_bcast;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) extern const ax25_address ax25_defaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) extern const ax25_address null_ax25_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) char *ax2asc(char *buf, const ax25_address *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) void asc2ax(ax25_address *addr, const char *callsign);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) int ax25cmp(const ax25_address *, const ax25_address *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) int ax25digicmp(const ax25_digi *, const ax25_digi *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) const unsigned char *ax25_addr_parse(const unsigned char *, int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) ax25_address *, ax25_address *, ax25_digi *, int *, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) int ax25_addr_build(unsigned char *, const ax25_address *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) const ax25_address *, const ax25_digi *, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) int ax25_addr_size(const ax25_digi *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) void ax25_digi_invert(const ax25_digi *, ax25_digi *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) /* ax25_dev.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) extern ax25_dev *ax25_dev_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) extern spinlock_t ax25_dev_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) #if IS_ENABLED(CONFIG_AX25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) static inline ax25_dev *ax25_dev_ax25dev(struct net_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) return dev->ax25_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) ax25_dev *ax25_addr_ax25dev(ax25_address *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) void ax25_dev_device_up(struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) void ax25_dev_device_down(struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) int ax25_fwd_ioctl(unsigned int, struct ax25_fwd_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) struct net_device *ax25_fwd_dev(struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) void ax25_dev_free(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) /* ax25_ds_in.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) int ax25_ds_frame_in(ax25_cb *, struct sk_buff *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) /* ax25_ds_subr.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) void ax25_ds_nr_error_recovery(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) void ax25_ds_enquiry_response(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) void ax25_ds_establish_data_link(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) void ax25_dev_dama_off(ax25_dev *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) void ax25_dama_on(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) void ax25_dama_off(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) /* ax25_ds_timer.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) void ax25_ds_setup_timer(ax25_dev *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) void ax25_ds_set_timer(ax25_dev *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) void ax25_ds_del_timer(ax25_dev *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) void ax25_ds_timer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) void ax25_ds_t1_timeout(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) void ax25_ds_heartbeat_expiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) void ax25_ds_t3timer_expiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) void ax25_ds_idletimer_expiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) /* ax25_iface.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) struct ax25_protocol {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) struct ax25_protocol *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) unsigned int pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) int (*func)(struct sk_buff *, ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) void ax25_register_pid(struct ax25_protocol *ap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) void ax25_protocol_release(unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) struct ax25_linkfail {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) struct hlist_node lf_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) void (*func)(ax25_cb *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) void ax25_linkfail_register(struct ax25_linkfail *lf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) void ax25_linkfail_release(struct ax25_linkfail *lf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) int __must_check ax25_listen_register(ax25_address *, struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) void ax25_listen_release(ax25_address *, struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) int(*ax25_protocol_function(unsigned int))(struct sk_buff *, ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) int ax25_listen_mine(ax25_address *, struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) void ax25_link_failed(ax25_cb *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) int ax25_protocol_is_registered(unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) /* ax25_in.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) int ax25_rx_iframe(ax25_cb *, struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) /* ax25_ip.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) netdev_tx_t ax25_ip_xmit(struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) extern const struct header_ops ax25_header_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) /* ax25_out.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) ax25_digi *, struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) void ax25_output(ax25_cb *, int, struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) void ax25_kick(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) void ax25_queue_xmit(struct sk_buff *skb, struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) int ax25_check_iframes_acked(ax25_cb *, unsigned short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) /* ax25_route.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) void ax25_rt_device_down(struct net_device *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) int ax25_rt_ioctl(unsigned int, void __user *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) extern const struct seq_operations ax25_rt_seqops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) int ax25_rt_autobind(ax25_cb *, ax25_address *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) ax25_address *, ax25_digi *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) void ax25_rt_free(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) /* ax25_std_in.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) /* ax25_std_subr.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) void ax25_std_nr_error_recovery(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) void ax25_std_establish_data_link(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) void ax25_std_transmit_enquiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) void ax25_std_enquiry_response(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) void ax25_std_timeout_response(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) /* ax25_std_timer.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) void ax25_std_heartbeat_expiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) void ax25_std_t1timer_expiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) void ax25_std_t2timer_expiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) void ax25_std_t3timer_expiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) void ax25_std_idletimer_expiry(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) /* ax25_subr.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) void ax25_clear_queues(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) void ax25_frames_acked(ax25_cb *, unsigned short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) void ax25_requeue_frames(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) int ax25_validate_nr(ax25_cb *, unsigned short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) int ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) void ax25_send_control(ax25_cb *, int, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) void ax25_return_dm(struct net_device *, ax25_address *, ax25_address *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) ax25_digi *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) void ax25_calculate_t1(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) void ax25_calculate_rtt(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) void ax25_disconnect(ax25_cb *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) /* ax25_timer.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) void ax25_setup_timers(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) void ax25_start_heartbeat(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) void ax25_start_t1timer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) void ax25_start_t2timer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) void ax25_start_t3timer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) void ax25_start_idletimer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) void ax25_stop_heartbeat(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) void ax25_stop_t1timer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) void ax25_stop_t2timer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) void ax25_stop_t3timer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) void ax25_stop_idletimer(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) int ax25_t1timer_running(ax25_cb *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) unsigned long ax25_display_timer(struct timer_list *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) /* ax25_uid.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) extern int ax25_uid_policy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) ax25_uid_assoc *ax25_findbyuid(kuid_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) extern const struct seq_operations ax25_uid_seqops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) void ax25_uid_free(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) /* sysctl_net_ax25.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) #ifdef CONFIG_SYSCTL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) int ax25_register_dev_sysctl(ax25_dev *ax25_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) void ax25_unregister_dev_sysctl(ax25_dev *ax25_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) static inline int ax25_register_dev_sysctl(ax25_dev *ax25_dev) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) static inline void ax25_unregister_dev_sysctl(ax25_dev *ax25_dev) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) #endif /* CONFIG_SYSCTL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) #endif