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 #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    /* Unused bits in SSID for standard AX.25 */
  32 #define ESSID_SPARE     0x20    /* Unused bits in SSID for extended AX.25 */
  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  * These headers are taken from the KA9Q package by Phil Karn. These specific
  47  * files have been placed under the GPL (not the whole package) by Phil.
  48  *
  49  *
  50  * Copyright 1991 Phil Karn, KA9Q
  51  *
  52  * This program is free software; you can redistribute it and/or modify
  53  * it under the terms of the GNU General Public License as published by
  54  * the Free Software Foundation; version 2 dated June, 1991.
  55  * 
  56  * This program is distributed in the hope that it will be useful,
  57  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  58  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  59  * GNU General Public License for more details.
  60  * 
  61  * You should have received a copy of the GNU General Public License
  62  * along with this program;  if not, write to the Free Software
  63  * Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA.
  64  */
  65 
  66 /* Upper sub-layer (LAPB) definitions */
  67 
  68 /* Control field templates */
  69 #define I       0x00    /* Information frames */
  70 #define S       0x01    /* Supervisory frames */
  71 #define RR      0x01    /* Receiver ready */
  72 #define RNR     0x05    /* Receiver not ready */
  73 #define REJ     0x09    /* Reject */
  74 #define U       0x03    /* Unnumbered frames */
  75 #define SABM    0x2f    /* Set Asynchronous Balanced Mode */
  76 #define SABME   0x6f    /* Set Asynchronous Balanced Mode Extended */
  77 #define DISC    0x43    /* Disconnect */
  78 #define DM      0x0f    /* Disconnected mode */
  79 #define UA      0x63    /* Unnumbered acknowledge */
  80 #define FRMR    0x87    /* Frame reject */
  81 #define UI      0x03    /* Unnumbered information */
  82 #define PF      0x10    /* Poll/final bit for standard AX.25 */
  83 #define EPF     0x01    /* Poll/final bit for extended AX.25 */
  84 
  85 #define ILLEGAL 0x100   /* Impossible to be a real frame type */
  86 
  87 #define POLLOFF         0
  88 #define POLLON          1
  89 
  90 /* AX25 L2 C-bit */
  91 
  92 #define C_COMMAND       1       /* C_ otherwise it clashes with the de600 defines (sigh)) */
  93 #define C_RESPONSE      2
  94 
  95 /* Define Link State constants. */
  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                      /*  Run timing at 1/10 second - gives us better resolution for 56kbit links */
 104 #define DEFAULT_T1      (10  * PR_SLOWHZ)       /*  Outstanding frames - 10 seconds */
 105 #define DEFAULT_T2      (3   * PR_SLOWHZ)       /*  Response delay     - 3 seconds */
 106 #define DEFAULT_T3      (300 * PR_SLOWHZ)       /*  Idle supervision   - 300 seconds */
 107 #define DEFAULT_N2      10                      /*  Number of retries */
 108 #define DEFAULT_WINDOW  2                       /*  Default window size */
 109 #define MODULUS         8                       /*  Standard AX.25 modulus */
 110 #define EMODULUS        128                     /*  Extended AX.25 modulus */
 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;            /* Backlink to socket */
 144 } ax25_cb;
 145 
 146 /* af_ax25.c */
 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, 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 /* ax25_in.c */
 164 extern int  ax25_process_rx_frame(ax25_cb *, struct sk_buff *, int);
 165 
 166 /* ax25_out.c */
 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 /* ax25_route.c */
 178 extern void ax25_rt_rx_frame(ax25_address *, struct device *);
 179 extern int  ax25_rt_get_info(char *, char **, off_t, int, int);
 180 extern int  ax25_cs_get_info(char *, char **, off_t, int, 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 /* ax25_subr.c */
 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 /* ax25_timer */
 203 extern void ax25_set_timer(ax25_cb *);
 204 
 205 /* slip.c */
 206 extern int  sl_get_ax25_mode(struct device *);
 207 
 208 #endif

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