Home | History | Annotate | Download | only in netax25
      1 /* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
      2    This file is part of the GNU C Library.
      3 
      4    The GNU C Library is free software; you can redistribute it and/or
      5    modify it under the terms of the GNU Lesser General Public
      6    License as published by the Free Software Foundation; either
      7    version 2.1 of the License, or (at your option) any later version.
      8 
      9    The GNU C Library is distributed in the hope that it will be useful,
     10    but WITHOUT ANY WARRANTY; without even the implied warranty of
     11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12    Lesser General Public License for more details.
     13 
     14    You should have received a copy of the GNU Lesser General Public
     15    License along with the GNU C Library; if not, write to the Free
     16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     17    02111-1307 USA.  */
     18 
     19 #ifndef _NETAX25_AX25_H
     20 #define _NETAX25_AX25_H	1
     21 
     22 #include <features.h>
     23 #include <bits/sockaddr.h>
     24 
     25 /* Setsockoptions(2) level.  Thanks to BSD these must match IPPROTO_xxx.  */
     26 #define SOL_AX25	257
     27 
     28 /* AX.25 flags: */
     29 #define AX25_WINDOW	1
     30 #define AX25_T1		2
     31 #define AX25_T2		5
     32 #define AX25_T3		4
     33 #define AX25_N2		3
     34 #define AX25_BACKOFF	6
     35 #define AX25_EXTSEQ	7
     36 #define AX25_PIDINCL	8
     37 #define AX25_IDLE	9
     38 #define	AX25_PACLEN	10
     39 #define AX25_IPMAXQUEUE 11
     40 #define AX25_IAMDIGI	12
     41 #define AX25_KILL	99
     42 
     43 /* AX.25 socket ioctls: */
     44 #define SIOCAX25GETUID		(SIOCPROTOPRIVATE)
     45 #define SIOCAX25ADDUID		(SIOCPROTOPRIVATE+1)
     46 #define SIOCAX25DELUID		(SIOCPROTOPRIVATE+2)
     47 #define SIOCAX25NOUID		(SIOCPROTOPRIVATE+3)
     48 #define SIOCAX25BPQADDR		(SIOCPROTOPRIVATE+4)
     49 #define SIOCAX25GETPARMS	(SIOCPROTOPRIVATE+5)
     50 #define SIOCAX25SETPARMS	(SIOCPROTOPRIVATE+6)
     51 #define SIOCAX25OPTRT		(SIOCPROTOPRIVATE+7)
     52 #define SIOCAX25CTLCON		(SIOCPROTOPRIVATE+8)
     53 #define SIOCAX25GETINFO		(SIOCPROTOPRIVATE+9)
     54 #define SIOCAX25ADDFWD		(SIOCPROTOPRIVATE+10)
     55 #define SIOCAX25DELFWD		(SIOCPROTOPRIVATE+11)
     56 
     57 /* unknown: */
     58 #define AX25_NOUID_DEFAULT	0
     59 #define AX25_NOUID_BLOCK	1
     60 #define AX25_SET_RT_IPMODE	2
     61 
     62 /* Digipeating flags: */
     63 #define AX25_DIGI_INBAND	0x01	/* Allow digipeating within port */
     64 #define AX25_DIGI_XBAND		0x02	/* Allow digipeating across ports */
     65 
     66 /* Maximim number of digipeaters: */
     67 #define AX25_MAX_DIGIS 8
     68 
     69 
     70 typedef struct
     71   {
     72     char ax25_call[7];		/* 6 call + SSID (shifted ascii) */
     73   }
     74 ax25_address;
     75 
     76 struct sockaddr_ax25
     77   {
     78     sa_family_t sax25_family;
     79     ax25_address sax25_call;
     80     int sax25_ndigis;
     81   };
     82 
     83 /*
     84  * The sockaddr struct with the digipeater adresses:
     85  */
     86 struct full_sockaddr_ax25
     87   {
     88     struct sockaddr_ax25 fsa_ax25;
     89     ax25_address fsa_digipeater[AX25_MAX_DIGIS];
     90   };
     91 #define sax25_uid	sax25_ndigis
     92 
     93 struct ax25_routes_struct
     94   {
     95     ax25_address port_addr;
     96     ax25_address dest_addr;
     97     unsigned char digi_count;
     98     ax25_address digi_addr[AX25_MAX_DIGIS];
     99   };
    100 
    101 /* The AX.25 ioctl structure: */
    102 struct ax25_ctl_struct
    103   {
    104     ax25_address port_addr;
    105     ax25_address source_addr;
    106     ax25_address dest_addr;
    107     unsigned int cmd;
    108     unsigned long arg;
    109     unsigned char digi_count;
    110     ax25_address digi_addr[AX25_MAX_DIGIS];
    111   };
    112 
    113 struct ax25_info_struct
    114   {
    115     unsigned int  n2, n2count;
    116     unsigned int t1, t1timer;
    117     unsigned int t2, t2timer;
    118     unsigned int t3, t3timer;
    119     unsigned int idle, idletimer;
    120     unsigned int state;
    121     unsigned int rcv_q, snd_q;
    122   };
    123 
    124 struct ax25_fwd_struct
    125   {
    126     ax25_address port_from;
    127     ax25_address port_to;
    128   };
    129 
    130 /* AX.25 route structure: */
    131 struct ax25_route_opt_struct
    132   {
    133     ax25_address port_addr;
    134     ax25_address dest_addr;
    135     int cmd;
    136     int arg;
    137   };
    138 
    139 /* AX.25 BPQ stuff: */
    140 struct ax25_bpqaddr_struct
    141   {
    142     char dev[16];
    143     ax25_address addr;
    144   };
    145 
    146 /* Definitions for the AX.25 `values' fields: */
    147 #define	AX25_VALUES_IPDEFMODE	0	/* 'D'=DG 'V'=VC */
    148 #define	AX25_VALUES_AXDEFMODE	1	/* 8=Normal 128=Extended Seq Nos */
    149 #define	AX25_VALUES_NETROM	2	/* Allow NET/ROM  - 0=No 1=Yes */
    150 #define	AX25_VALUES_TEXT	3	/* Allow PID=Text - 0=No 1=Yes */
    151 #define	AX25_VALUES_BACKOFF	4	/* 'E'=Exponential 'L'=Linear */
    152 #define	AX25_VALUES_CONMODE	5	/* Allow connected modes - 0=No 1=Yes */
    153 #define	AX25_VALUES_WINDOW	6	/* Default window size for standard AX.25 */
    154 #define	AX25_VALUES_EWINDOW	7	/* Default window size for extended AX.25 */
    155 #define	AX25_VALUES_T1		8	/* Default T1 timeout value */
    156 #define	AX25_VALUES_T2		9	/* Default T2 timeout value */
    157 #define	AX25_VALUES_T3		10	/* Default T3 timeout value */
    158 #define	AX25_VALUES_N2		11	/* Default N2 value */
    159 #define	AX25_VALUES_DIGI	12	/* Digipeat mode */
    160 #define AX25_VALUES_IDLE	13	/* mode vc idle timer */
    161 #define AX25_VALUES_PACLEN	14	/* AX.25 MTU */
    162 #define AX25_VALUES_IPMAXQUEUE  15	/* Maximum number of buffers enqueued */
    163 #define	AX25_MAX_VALUES		20
    164 
    165 struct ax25_parms_struct
    166   {
    167     ax25_address port_addr;
    168     unsigned short values[AX25_MAX_VALUES];
    169   };
    170 
    171 #endif /* netax25/ax25.h */
    172