root/include/net/ax25.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  *      Declarations of AX.25 type objects.
   3  *
   4  *      Alan Cox (GW4PTS)       10/11/93
   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 
  23 #define LAPB_UI 0x03
  24 #define LAPB_C  0x80
  25 #define LAPB_E  0x01
  26 
  27 #define SSID_SPARE      0x60            /* Unused bits (DAMA bit and spare must be 1) */
  28 
  29 #define AX25_REPEATED   0x80
  30 
  31 #define ACK_PENDING_CONDITION           0x01
  32 #define REJECT_CONDITION                0x02
  33 #define PEER_RX_BUSY_CONDITION          0x04
  34 #define OWN_RX_BUSY_CONDITION           0x08
  35 
  36 #ifndef _LINUX_NETDEVICE_H
  37 #include <linux/netdevice.h>
  38 #endif
  39 
  40 /*
  41  * These headers are taken from the KA9Q package by Phil Karn. These specific
  42  * files have been placed under the GPL (not the whole package) by Phil.
  43  *
  44  *
  45  * Copyright 1991 Phil Karn, KA9Q
  46  *
  47  * This program is free software; you can redistribute it and/or modify
  48  * it under the terms of the GNU General Public License as published by
  49  * the Free Software Foundation; version 2 dated June, 1991.
  50  * 
  51  * This program is distributed in the hope that it will be useful,
  52  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  53  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  54  * GNU General Public License for more details.
  55  * 
  56  * You should have received a copy of the GNU General Public License
  57  * along with this program;  if not, write to the Free Software
  58  * Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA.
  59  */
  60 
  61 /* Upper sub-layer (LAPB) definitions */
  62 
  63 /* Control field templates */
  64 #define I       0x00    /* Information frames */
  65 #define S       0x01    /* Supervisory frames */
  66 #define RR      0x01    /* Receiver ready */
  67 #define RNR     0x05    /* Receiver not ready */
  68 #define REJ     0x09    /* Reject */
  69 #define U       0x03    /* Unnumbered frames */
  70 #define SABM    0x2f    /* Set Asynchronous Balanced Mode */
  71 #define SABME   0x6f    /* Set Asynchronous Balanced Mode Extended */
  72 #define DISC    0x43    /* Disconnect */
  73 #define DM      0x0f    /* Disconnected mode */
  74 #define UA      0x63    /* Unnumbered acknowledge */
  75 #define FRMR    0x87    /* Frame reject */
  76 #define UI      0x03    /* Unnumbered information */
  77 #define PF      0x10    /* Poll/final bit */
  78 
  79 #define ILLEGAL 0x100   /* Impossible to be a real frame type */
  80 
  81 #define MMASK   7       /* Mask for modulo-8 sequence numbers */
  82 
  83 /* AX25 L2 C-bit */
  84 
  85 #define C_COMMAND       1       /* C_ otherwise it clashes with the de600 defines (sigh)) */
  86 #define C_RESPONSE      2
  87 
  88 /* Define Link State constants. */
  89 
  90 #define AX25_STATE_0    0
  91 #define AX25_STATE_1    1
  92 #define AX25_STATE_2    2
  93 #define AX25_STATE_3    3
  94 #define AX25_STATE_4    4
  95 
  96 #define PR_SLOWHZ       10                      /*  Run timing at 1/10 second - gives us better resolution for 56kbit links */
  97 #define DEFAULT_T1      (10  * PR_SLOWHZ)       /*  Outstanding frames - 10 seconds */
  98 #define DEFAULT_T2      (3   * PR_SLOWHZ)       /*  Response delay     - 3 seconds */
  99 #define DEFAULT_T3      (300 * PR_SLOWHZ)       /*  Idle supervision   - 300 seconds */
 100 #define DEFAULT_N2      10                      /*  Number of retries */
 101 #define DEFAULT_WINDOW  2                       /*  Default window size */
 102 #define MODULUS         8
 103 #define MAX_WINDOW_SIZE 7                       /*  Maximum window allowable */
 104 
 105 typedef struct ax25_uid_assoc {
 106         struct ax25_uid_assoc *next;
 107         uid_t uid;
 108         ax25_address call;
 109 } ax25_uid_assoc;
 110 
 111 typedef struct {
 112         ax25_address calls[6];
 113         unsigned char repeated[6];
 114         unsigned char ndigi;
 115         char lastrepeat;
 116 } ax25_digi;
 117 
 118 typedef struct ax25_cb {
 119         struct ax25_cb          *next;
 120         ax25_address            source_addr, dest_addr;
 121         struct device           *device;
 122         unsigned char           state;
 123         unsigned short          vs, vr, va;
 124         unsigned char           condition, backoff;
 125         unsigned char           n2, n2count;
 126         unsigned short          t1, t2, t3, rtt;
 127         unsigned short          t1timer, t2timer, t3timer;
 128         ax25_digi               *digipeat;
 129         struct sk_buff_head     write_queue;
 130         struct sk_buff_head     ack_queue;
 131         unsigned char           window;
 132         struct timer_list       timer;
 133         struct sock             *sk;            /* Backlink to socket */
 134 } ax25_cb;
 135 
 136 /* af_ax25.c */
 137 extern char *ax2asc(ax25_address *);
 138 extern int  ax25cmp(ax25_address *, ax25_address *);
 139 extern int  ax25_send_frame(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *, struct device *);
 140 extern void ax25_destroy_socket(ax25_cb *);
 141 extern struct device *ax25rtr_get_dev(ax25_address *);
 142 extern int  ax25_encapsulate(struct sk_buff *, struct device *, unsigned short,
 143         void *, void *, unsigned int);
 144 extern int  ax25_rebuild_header(unsigned char *, struct device *, unsigned long, struct sk_buff *);
 145 extern int  ax25_get_info(char *, char **, off_t, int);
 146 extern ax25_uid_assoc *ax25_uid_list;
 147 extern int  ax25_uid_policy;
 148 extern ax25_address *ax25_findbyuid(uid_t);
 149 extern void ax25_queue_xmit(struct sk_buff *, struct device *, int);
 150 
 151 #include "ax25call.h"
 152 
 153 /* ax25_in.c */
 154 extern int  ax25_process_rx_frame(ax25_cb *, struct sk_buff *, int);
 155 
 156 /* ax25_out.c */
 157 extern int  ax25_output(ax25_cb *, struct sk_buff *);
 158 extern void ax25_kick(ax25_cb *);
 159 extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
 160 extern void ax25_nr_error_recovery(ax25_cb *);
 161 extern void ax25_establish_data_link(ax25_cb *);
 162 extern void ax25_transmit_enquiry(ax25_cb *);
 163 extern void ax25_enquiry_response(ax25_cb *);
 164 extern void ax25_check_iframes_acked(ax25_cb *, unsigned short);
 165 extern void ax25_check_need_response(ax25_cb *, int, int);
 166 
 167 /* ax25_route.c */
 168 extern void ax25_rt_rx_frame(ax25_address *, struct device *);
 169 extern int  ax25_rt_get_info(char *, char **, off_t, int);
 170 extern int  ax25_cs_get_info(char *, char **, off_t, int);
 171 extern int  ax25_rt_autobind(ax25_cb *, ax25_address *);
 172 extern void ax25_rt_device_down(struct device *);
 173 extern void ax25_ip_mode_set(ax25_address *, struct device *, char);
 174 extern char ax25_ip_mode_get(ax25_address *, struct device *);
 175 
 176 /* ax25_subr.c */
 177 extern void ax25_clear_tx_queue(ax25_cb *);
 178 extern void ax25_frames_acked(ax25_cb *, unsigned short);
 179 extern int  ax25_validate_nr(ax25_cb *, unsigned short);
 180 extern int  ax25_decode(unsigned char *);
 181 extern void ax25_send_control(ax25_cb *, int, int);
 182 extern unsigned short ax25_calculate_t1(ax25_cb *);
 183 extern void ax25_calculate_rtt(ax25_cb *);
 184 extern unsigned char *ax25_parse_addr(unsigned char *, int, ax25_address *,
 185         ax25_address *, ax25_digi *, int *);
 186 extern int  build_ax25_addr(unsigned char *, ax25_address *, ax25_address *,
 187         ax25_digi *, int);
 188 extern int  size_ax25_addr(ax25_digi *);
 189 extern void ax25_digi_invert(ax25_digi *, ax25_digi *);
 190 extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25_digi *);
 191 
 192 /* ax25_timer */
 193 extern void ax25_set_timer(ax25_cb *);
 194 
 195 /* slip.c */
 196 extern int  sl_get_ax25_mode(struct device *);
 197 
 198 #endif

/* [previous][next][first][last][top][bottom][index][help] */