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

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