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 MODULUS         8                       /*  Standard AX.25 modulus */
 105 #define EMODULUS        128                     /*  Extended AX.25 modulus */
 106 
 107 #define AX25_DEF_IPDEFMODE      'D'
 108 #define AX25_DEF_AXDEFMODE      8
 109 #define AX25_DEF_NETROM         1
 110 #define AX25_DEF_TEXT           1
 111 #define AX25_DEF_BACKOFF        'E'
 112 #define AX25_DEF_CONMODE        1
 113 #define AX25_DEF_WINDOW         2
 114 #define AX25_DEF_EWINDOW        32
 115 #define AX25_DEF_T1             10
 116 #define AX25_DEF_T2             3
 117 #define AX25_DEF_T3             300
 118 #define AX25_DEF_N2             10
 119 
 120 typedef struct ax25_uid_assoc {
 121         struct ax25_uid_assoc *next;
 122         uid_t uid;
 123         ax25_address call;
 124 } ax25_uid_assoc;
 125 
 126 typedef struct {
 127         ax25_address calls[6];
 128         unsigned char repeated[6];
 129         unsigned char ndigi;
 130         char lastrepeat;
 131 } ax25_digi;
 132 
 133 typedef struct ax25_cb {
 134         struct ax25_cb          *next;
 135         ax25_address            source_addr, dest_addr;
 136         struct device           *device;
 137         unsigned char           state, modulus, hdrincl;
 138         unsigned short          vs, vr, va;
 139         unsigned char           condition, backoff;
 140         unsigned char           n2, n2count;
 141         unsigned short          t1, t2, t3, rtt;
 142         unsigned short          t1timer, t2timer, t3timer;
 143         unsigned short          fragno, fraglen;
 144         ax25_digi               *digipeat;
 145         struct sk_buff_head     write_queue;
 146         struct sk_buff_head     reseq_queue;
 147         struct sk_buff_head     ack_queue;
 148         struct sk_buff_head     frag_queue;
 149         unsigned char           window;
 150         struct timer_list       timer;
 151         struct sock             *sk;            /* Backlink to socket */
 152 } ax25_cb;
 153 
 154 /* af_ax25.c */
 155 extern char *ax2asc(ax25_address *);
 156 extern int  ax25cmp(ax25_address *, ax25_address *);
 157 extern int  ax25_send_frame(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *, struct device *);
 158 extern void ax25_destroy_socket(ax25_cb *);
 159 extern struct device *ax25rtr_get_dev(ax25_address *);
 160 extern int  ax25_encapsulate(struct sk_buff *, struct device *, unsigned short,
 161         void *, void *, unsigned int);
 162 extern int  ax25_rebuild_header(unsigned char *, struct device *, unsigned long, struct sk_buff *);
 163 extern ax25_uid_assoc *ax25_uid_list;
 164 extern int  ax25_uid_policy;
 165 extern ax25_address *ax25_findbyuid(uid_t);
 166 extern void ax25_queue_xmit(struct sk_buff *, struct device *, int);
 167 
 168 #include <net/ax25call.h>
 169 
 170 /* ax25_in.c */
 171 extern int  ax25_process_rx_frame(ax25_cb *, struct sk_buff *, int);
 172 
 173 /* ax25_out.c */
 174 extern void ax25_output(ax25_cb *, struct sk_buff *);
 175 extern void ax25_kick(ax25_cb *);
 176 extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
 177 extern void ax25_nr_error_recovery(ax25_cb *);
 178 extern void ax25_establish_data_link(ax25_cb *);
 179 extern void ax25_transmit_enquiry(ax25_cb *);
 180 extern void ax25_enquiry_response(ax25_cb *);
 181 extern void ax25_timeout_response(ax25_cb *);
 182 extern void ax25_check_iframes_acked(ax25_cb *, unsigned short);
 183 extern void ax25_check_need_response(ax25_cb *, int, int);
 184 
 185 /* ax25_route.c */
 186 extern void ax25_rt_rx_frame(ax25_address *, struct device *, ax25_digi *);
 187 extern int  ax25_rt_get_info(char *, char **, off_t, int, int);
 188 extern int  ax25_cs_get_info(char *, char **, off_t, int, int);
 189 extern int  ax25_rt_autobind(ax25_cb *, ax25_address *);
 190 extern void ax25_rt_device_down(struct device *);
 191 extern int  ax25_rt_ioctl(unsigned int, void *);
 192 extern void ax25_ip_mode_set(ax25_address *, struct device *, char);
 193 extern char ax25_ip_mode_get(ax25_address *, struct device *);
 194 extern unsigned short ax25_dev_get_value(struct device *, int);
 195 extern void ax25_dev_device_up(struct device *);
 196 extern void ax25_dev_device_down(struct device *);
 197 extern int  ax25_dev_ioctl(unsigned int, void *);
 198 
 199 /* ax25_subr.c */
 200 extern void ax25_clear_queues(ax25_cb *);
 201 extern void ax25_frames_acked(ax25_cb *, unsigned short);
 202 extern int  ax25_validate_nr(ax25_cb *, unsigned short);
 203 extern int  ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *);
 204 extern void ax25_send_control(ax25_cb *, int, int, int);
 205 extern unsigned short ax25_calculate_t1(ax25_cb *);
 206 extern void ax25_calculate_rtt(ax25_cb *);
 207 extern unsigned char *ax25_parse_addr(unsigned char *, int, ax25_address *,
 208         ax25_address *, ax25_digi *, int *);
 209 extern int  build_ax25_addr(unsigned char *, ax25_address *, ax25_address *,
 210         ax25_digi *, int, int);
 211 extern int  size_ax25_addr(ax25_digi *);
 212 extern void ax25_digi_invert(ax25_digi *, ax25_digi *);
 213 extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25_digi *);
 214 
 215 /* ax25_timer */
 216 extern void ax25_set_timer(ax25_cb *);
 217 
 218 #endif

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