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 PR_SLOWHZ       10              /*  Run timing at 1/10 second - gives us better resolution for 56kbit links */
  12 
  13 #define AX25_T1CLAMPLO  (1 * PR_SLOWHZ) /* If defined, clamp at 1 second **/
  14 #define AX25_T1CLAMPHI (30 * PR_SLOWHZ) /* If defined, clamp at 30 seconds **/
  15 
  16 #define AX25_BROKEN_NETMAC
  17 
  18 #define AX25_BPQ_HEADER_LEN     16
  19 #define AX25_KISS_HEADER_LEN    1
  20 
  21 #define AX25_HEADER_LEN         17
  22 #define AX25_ADDR_LEN           7
  23 #define AX25_DIGI_HEADER_LEN    (AX25_MAX_DIGIS * AX25_ADDR_LEN)
  24 #define AX25_MAX_HEADER_LEN     (AX25_HEADER_LEN + AX25_DIGI_HEADER_LEN)
  25  
  26 #define AX25_P_IP       0xCC
  27 #define AX25_P_ARP      0xCD
  28 #define AX25_P_TEXT     0xF0
  29 #define AX25_P_NETROM   0xCF
  30 #define AX25_P_SEGMENT  0x08
  31 
  32 #define SEG_REM         0x7F
  33 #define SEG_FIRST       0x80
  34 
  35 #define LAPB_UI         0x03
  36 #define LAPB_C          0x80
  37 #define LAPB_E          0x01
  38 
  39 #define SSSID_SPARE     0x60    /* Unused bits in SSID for standard AX.25 */
  40 #define ESSID_SPARE     0x20    /* Unused bits in SSID for extended AX.25 */
  41 
  42 #define AX25_REPEATED   0x80
  43 
  44 #define ACK_PENDING_CONDITION           0x01
  45 #define REJECT_CONDITION                0x02
  46 #define PEER_RX_BUSY_CONDITION          0x04
  47 #define OWN_RX_BUSY_CONDITION           0x08
  48 
  49 #ifndef _LINUX_NETDEVICE_H
  50 #include <linux/netdevice.h>
  51 #endif
  52 
  53 /*
  54  * These headers are taken from the KA9Q package by Phil Karn. These specific
  55  * files have been placed under the GPL (not the whole package) by Phil.
  56  *
  57  *
  58  * Copyright 1991 Phil Karn, KA9Q
  59  *
  60  * This program is free software; you can redistribute it and/or modify
  61  * it under the terms of the GNU General Public License as published by
  62  * the Free Software Foundation; version 2 dated June, 1991.
  63  * 
  64  * This program is distributed in the hope that it will be useful,
  65  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  66  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  67  * GNU General Public License for more details.
  68  * 
  69  * You should have received a copy of the GNU General Public License
  70  * along with this program;  if not, write to the Free Software
  71  * Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA.
  72  */
  73 
  74 /* Upper sub-layer (LAPB) definitions */
  75 
  76 /* Control field templates */
  77 #define I       0x00    /* Information frames */
  78 #define S       0x01    /* Supervisory frames */
  79 #define RR      0x01    /* Receiver ready */
  80 #define RNR     0x05    /* Receiver not ready */
  81 #define REJ     0x09    /* Reject */
  82 #define U       0x03    /* Unnumbered frames */
  83 #define SABM    0x2f    /* Set Asynchronous Balanced Mode */
  84 #define SABME   0x6f    /* Set Asynchronous Balanced Mode Extended */
  85 #define DISC    0x43    /* Disconnect */
  86 #define DM      0x0f    /* Disconnected mode */
  87 #define UA      0x63    /* Unnumbered acknowledge */
  88 #define FRMR    0x87    /* Frame reject */
  89 #define UI      0x03    /* Unnumbered information */
  90 #define PF      0x10    /* Poll/final bit for standard AX.25 */
  91 #define EPF     0x01    /* Poll/final bit for extended AX.25 */
  92 
  93 #define ILLEGAL 0x100   /* Impossible to be a real frame type */
  94 
  95 #define POLLOFF         0
  96 #define POLLON          1
  97 
  98 /* AX25 L2 C-bit */
  99 
 100 #define C_COMMAND       1       /* C_ otherwise it clashes with the de600 defines (sigh)) */
 101 #define C_RESPONSE      2
 102 
 103 /* Define Link State constants. */
 104 
 105 #define AX25_STATE_0    0
 106 #define AX25_STATE_1    1
 107 #define AX25_STATE_2    2
 108 #define AX25_STATE_3    3
 109 #define AX25_STATE_4    4
 110 
 111 #define MODULUS         8                       /*  Standard AX.25 modulus */
 112 #define EMODULUS        128                     /*  Extended AX.25 modulus */
 113 
 114 #define AX25_DEF_IPDEFMODE      'D'
 115 #define AX25_DEF_AXDEFMODE      8
 116 #define AX25_DEF_NETROM         1
 117 #define AX25_DEF_TEXT           1
 118 #define AX25_DEF_BACKOFF        'E'
 119 #define AX25_DEF_CONMODE        1
 120 #define AX25_DEF_WINDOW         2
 121 #define AX25_DEF_EWINDOW        32
 122 #define AX25_DEF_T1             10
 123 #define AX25_DEF_T2             3
 124 #define AX25_DEF_T3             300
 125 #define AX25_DEF_N2             10
 126 #define AX25_DEF_DIGI           (AX25_DIGI_INBAND|AX25_DIGI_XBAND)
 127 
 128 typedef struct ax25_uid_assoc {
 129         struct ax25_uid_assoc *next;
 130         uid_t uid;
 131         ax25_address call;
 132 } ax25_uid_assoc;
 133 
 134 typedef struct {
 135         ax25_address calls[AX25_MAX_DIGIS];
 136         unsigned char repeated[AX25_MAX_DIGIS];
 137         unsigned char ndigi;
 138         char lastrepeat;
 139 } ax25_digi;
 140 
 141 typedef struct ax25_cb {
 142         struct ax25_cb          *next;
 143         ax25_address            source_addr, dest_addr;
 144         struct device           *device;
 145         unsigned char           state, modulus, hdrincl;
 146         unsigned short          vs, vr, va;
 147         unsigned char           condition, backoff;
 148         unsigned char           n2, n2count;
 149         unsigned short          t1, t2, t3, rtt;
 150         unsigned short          t1timer, t2timer, t3timer;
 151         unsigned short          fragno, fraglen;
 152         ax25_digi               *digipeat;
 153         struct sk_buff_head     write_queue;
 154         struct sk_buff_head     reseq_queue;
 155         struct sk_buff_head     ack_queue;
 156         struct sk_buff_head     frag_queue;
 157         unsigned char           window;
 158         struct timer_list       timer;
 159         struct sock             *sk;            /* Backlink to socket */
 160 } ax25_cb;
 161 
 162 /* af_ax25.c */
 163 extern char *ax2asc(ax25_address *);
 164 extern int  ax25cmp(ax25_address *, ax25_address *);
 165 extern int  ax25_send_frame(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *, struct device *);
 166 extern void ax25_destroy_socket(ax25_cb *);
 167 extern struct device *ax25rtr_get_dev(ax25_address *);
 168 extern int  ax25_encapsulate(struct sk_buff *, struct device *, unsigned short,
 169         void *, void *, unsigned int);
 170 extern int  ax25_rebuild_header(unsigned char *, struct device *, unsigned long, struct sk_buff *);
 171 extern ax25_uid_assoc *ax25_uid_list;
 172 extern int  ax25_uid_policy;
 173 extern ax25_address *ax25_findbyuid(uid_t);
 174 extern void ax25_queue_xmit(struct sk_buff *, struct device *, int);
 175 
 176 #include <net/ax25call.h>
 177 
 178 /* ax25_in.c */
 179 extern int  ax25_process_rx_frame(ax25_cb *, struct sk_buff *, int);
 180 
 181 /* ax25_out.c */
 182 extern void ax25_output(ax25_cb *, struct sk_buff *);
 183 extern void ax25_kick(ax25_cb *);
 184 extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
 185 extern void ax25_nr_error_recovery(ax25_cb *);
 186 extern void ax25_establish_data_link(ax25_cb *);
 187 extern void ax25_transmit_enquiry(ax25_cb *);
 188 extern void ax25_enquiry_response(ax25_cb *);
 189 extern void ax25_timeout_response(ax25_cb *);
 190 extern void ax25_check_iframes_acked(ax25_cb *, unsigned short);
 191 extern void ax25_check_need_response(ax25_cb *, int, int);
 192 
 193 /* ax25_route.c */
 194 extern void ax25_rt_rx_frame(ax25_address *, struct device *, ax25_digi *);
 195 extern int  ax25_rt_get_info(char *, char **, off_t, int, int);
 196 extern int  ax25_cs_get_info(char *, char **, off_t, int, int);
 197 extern int  ax25_rt_autobind(ax25_cb *, ax25_address *);
 198 extern void ax25_rt_device_down(struct device *);
 199 extern int  ax25_rt_ioctl(unsigned int, void *);
 200 extern void ax25_ip_mode_set(ax25_address *, struct device *, char);
 201 extern char ax25_ip_mode_get(ax25_address *, struct device *);
 202 extern unsigned short ax25_dev_get_value(struct device *, int);
 203 extern void ax25_dev_device_up(struct device *);
 204 extern void ax25_dev_device_down(struct device *);
 205 extern int  ax25_dev_ioctl(unsigned int, void *);
 206 extern int  ax25_bpq_get_info(char *, char **, off_t, int, int);
 207 extern ax25_address *ax25_bpq_get_addr(struct device *);
 208 extern int  ax25_bpq_ioctl(unsigned int, void *);
 209 
 210 /* ax25_subr.c */
 211 extern void ax25_clear_queues(ax25_cb *);
 212 extern void ax25_frames_acked(ax25_cb *, unsigned short);
 213 extern void ax25_requeue_frames(ax25_cb *);
 214 extern int  ax25_validate_nr(ax25_cb *, unsigned short);
 215 extern int  ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *);
 216 extern void ax25_send_control(ax25_cb *, int, int, int);
 217 extern unsigned short ax25_calculate_t1(ax25_cb *);
 218 extern void ax25_calculate_rtt(ax25_cb *);
 219 extern unsigned char *ax25_parse_addr(unsigned char *, int, ax25_address *,
 220         ax25_address *, ax25_digi *, int *);
 221 extern int  build_ax25_addr(unsigned char *, ax25_address *, ax25_address *,
 222         ax25_digi *, int, int);
 223 extern int  size_ax25_addr(ax25_digi *);
 224 extern void ax25_digi_invert(ax25_digi *, ax25_digi *);
 225 extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25_digi *);
 226 
 227 /* ax25_timer */
 228 extern void ax25_set_timer(ax25_cb *);
 229 
 230 #endif

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