1 
   2 
   3 
   4 
   5 
   6  
   7 #ifndef _AX25_H
   8 #define _AX25_H 
   9 #include <linux/ax25.h>
  10 
  11 #define AX25_BPQ_HEADER_LEN     16
  12 #define AX25_KISS_HEADER_LEN    1
  13 
  14 #define AX25_MAX_HEADER_LEN     56
  15 #define AX25_HEADER_LEN         17
  16 #define AX25_ADDR_LEN           7
  17  
  18 #define AX25_P_IP       0xCC
  19 #define AX25_P_ARP      0xCD
  20 #define AX25_P_TEXT     0xF0
  21 #define AX25_P_NETROM   0xCF
  22 #define AX25_P_SEGMENT  0x08
  23 
  24 #define SEG_REM         0x7F
  25 #define SEG_FIRST       0x80
  26 
  27 #define LAPB_UI         0x03
  28 #define LAPB_C          0x80
  29 #define LAPB_E          0x01
  30 
  31 #define SSSID_SPARE     0x60    
  32 #define ESSID_SPARE     0x20    
  33 
  34 #define AX25_REPEATED   0x80
  35 
  36 #define ACK_PENDING_CONDITION           0x01
  37 #define REJECT_CONDITION                0x02
  38 #define PEER_RX_BUSY_CONDITION          0x04
  39 #define OWN_RX_BUSY_CONDITION           0x08
  40 
  41 #ifndef _LINUX_NETDEVICE_H
  42 #include <linux/netdevice.h>
  43 #endif
  44 
  45 
  46 
  47 
  48 
  49 
  50 
  51 
  52 
  53 
  54 
  55 
  56 
  57 
  58 
  59 
  60 
  61 
  62 
  63 
  64 
  65 
  66 
  67 
  68 
  69 #define I       0x00    
  70 #define S       0x01    
  71 #define RR      0x01    
  72 #define RNR     0x05    
  73 #define REJ     0x09    
  74 #define U       0x03    
  75 #define SABM    0x2f    
  76 #define SABME   0x6f    
  77 #define DISC    0x43    
  78 #define DM      0x0f    
  79 #define UA      0x63    
  80 #define FRMR    0x87    
  81 #define UI      0x03    
  82 #define PF      0x10    
  83 #define EPF     0x01    
  84 
  85 #define ILLEGAL 0x100   
  86 
  87 #define POLLOFF         0
  88 #define POLLON          1
  89 
  90 
  91 
  92 #define C_COMMAND       1       
  93 #define C_RESPONSE      2
  94 
  95 
  96 
  97 #define AX25_STATE_0    0
  98 #define AX25_STATE_1    1
  99 #define AX25_STATE_2    2
 100 #define AX25_STATE_3    3
 101 #define AX25_STATE_4    4
 102 
 103 #define PR_SLOWHZ       10                      
 104 #define DEFAULT_T1      (10  * PR_SLOWHZ)       
 105 #define DEFAULT_T2      (3   * PR_SLOWHZ)       
 106 #define DEFAULT_T3      (300 * PR_SLOWHZ)       
 107 #define DEFAULT_N2      10                      
 108 #define DEFAULT_WINDOW  2                       
 109 #define MODULUS         8                       
 110 #define EMODULUS        128                     
 111 
 112 typedef struct ax25_uid_assoc {
 113         struct ax25_uid_assoc *next;
 114         uid_t uid;
 115         ax25_address call;
 116 } ax25_uid_assoc;
 117 
 118 typedef struct {
 119         ax25_address calls[6];
 120         unsigned char repeated[6];
 121         unsigned char ndigi;
 122         char lastrepeat;
 123 } ax25_digi;
 124 
 125 typedef struct ax25_cb {
 126         struct ax25_cb          *next;
 127         ax25_address            source_addr, dest_addr;
 128         struct device           *device;
 129         unsigned char           state, modulus;
 130         unsigned short          vs, vr, va;
 131         unsigned char           condition, backoff;
 132         unsigned char           n2, n2count;
 133         unsigned short          t1, t2, t3, rtt;
 134         unsigned short          t1timer, t2timer, t3timer;
 135         unsigned short          fragno, fraglen;
 136         ax25_digi               *digipeat;
 137         struct sk_buff_head     write_queue;
 138         struct sk_buff_head     reseq_queue;
 139         struct sk_buff_head     ack_queue;
 140         struct sk_buff_head     frag_queue;
 141         unsigned char           window;
 142         struct timer_list       timer;
 143         struct sock             *sk;            
 144 } ax25_cb;
 145 
 146 
 147 extern char *ax2asc(ax25_address *);
 148 extern int  ax25cmp(ax25_address *, ax25_address *);
 149 extern int  ax25_send_frame(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *, struct device *);
 150 extern void ax25_destroy_socket(ax25_cb *);
 151 extern struct device *ax25rtr_get_dev(ax25_address *);
 152 extern int  ax25_encapsulate(struct sk_buff *, struct device *, unsigned short,
 153         void *, void *, unsigned int);
 154 extern int  ax25_rebuild_header(unsigned char *, struct device *, unsigned long, struct sk_buff *);
 155 extern int  ax25_get_info(char *, char **, off_t, int);
 156 extern ax25_uid_assoc *ax25_uid_list;
 157 extern int  ax25_uid_policy;
 158 extern ax25_address *ax25_findbyuid(uid_t);
 159 extern void ax25_queue_xmit(struct sk_buff *, struct device *, int);
 160 
 161 #include "ax25call.h"
 162 
 163 
 164 extern int  ax25_process_rx_frame(ax25_cb *, struct sk_buff *, int);
 165 
 166 
 167 extern void ax25_output(ax25_cb *, struct sk_buff *);
 168 extern void ax25_kick(ax25_cb *);
 169 extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
 170 extern void ax25_nr_error_recovery(ax25_cb *);
 171 extern void ax25_establish_data_link(ax25_cb *);
 172 extern void ax25_transmit_enquiry(ax25_cb *);
 173 extern void ax25_enquiry_response(ax25_cb *);
 174 extern void ax25_check_iframes_acked(ax25_cb *, unsigned short);
 175 extern void ax25_check_need_response(ax25_cb *, int, int);
 176 
 177 
 178 extern void ax25_rt_rx_frame(ax25_address *, struct device *);
 179 extern int  ax25_rt_get_info(char *, char **, off_t, int);
 180 extern int  ax25_cs_get_info(char *, char **, off_t, int);
 181 extern int  ax25_rt_autobind(ax25_cb *, ax25_address *);
 182 extern void ax25_rt_device_down(struct device *);
 183 extern void ax25_ip_mode_set(ax25_address *, struct device *, char);
 184 extern char ax25_ip_mode_get(ax25_address *, struct device *);
 185 
 186 
 187 extern void ax25_clear_queues(ax25_cb *);
 188 extern void ax25_frames_acked(ax25_cb *, unsigned short);
 189 extern int  ax25_validate_nr(ax25_cb *, unsigned short);
 190 extern int  ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *);
 191 extern void ax25_send_control(ax25_cb *, int, int, int);
 192 extern unsigned short ax25_calculate_t1(ax25_cb *);
 193 extern void ax25_calculate_rtt(ax25_cb *);
 194 extern unsigned char *ax25_parse_addr(unsigned char *, int, ax25_address *,
 195         ax25_address *, ax25_digi *, int *);
 196 extern int  build_ax25_addr(unsigned char *, ax25_address *, ax25_address *,
 197         ax25_digi *, int, int);
 198 extern int  size_ax25_addr(ax25_digi *);
 199 extern void ax25_digi_invert(ax25_digi *, ax25_digi *);
 200 extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25_digi *);
 201 
 202 
 203 extern void ax25_set_timer(ax25_cb *);
 204 
 205 
 206 extern int  sl_get_ax25_mode(struct device *);
 207 
 208 #endif