glibc (2.38)

(root)/
include/
netax25/
ax25.h
       1  /* Copyright (C) 1997-2023 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, see
      16     <https://www.gnu.org/licenses/>.  */
      17  
      18  #ifndef _NETAX25_AX25_H
      19  #define _NETAX25_AX25_H	1
      20  
      21  #include <features.h>
      22  #include <bits/sockaddr.h>
      23  
      24  /* Setsockoptions(2) level.  Thanks to BSD these must match IPPROTO_xxx.  */
      25  #define SOL_AX25	257
      26  
      27  /* AX.25 flags: */
      28  #define AX25_WINDOW	1
      29  #define AX25_T1		2
      30  #define AX25_T2		5
      31  #define AX25_T3		4
      32  #define AX25_N2		3
      33  #define AX25_BACKOFF	6
      34  #define AX25_EXTSEQ	7
      35  #define AX25_PIDINCL	8
      36  #define AX25_IDLE	9
      37  #define	AX25_PACLEN	10
      38  #define AX25_IPMAXQUEUE 11
      39  #define AX25_IAMDIGI	12
      40  #define AX25_KILL	99
      41  
      42  /* AX.25 socket ioctls: */
      43  #define SIOCAX25GETUID		(SIOCPROTOPRIVATE)
      44  #define SIOCAX25ADDUID		(SIOCPROTOPRIVATE+1)
      45  #define SIOCAX25DELUID		(SIOCPROTOPRIVATE+2)
      46  #define SIOCAX25NOUID		(SIOCPROTOPRIVATE+3)
      47  #define SIOCAX25BPQADDR		(SIOCPROTOPRIVATE+4)
      48  #define SIOCAX25GETPARMS	(SIOCPROTOPRIVATE+5)
      49  #define SIOCAX25SETPARMS	(SIOCPROTOPRIVATE+6)
      50  #define SIOCAX25OPTRT		(SIOCPROTOPRIVATE+7)
      51  #define SIOCAX25CTLCON		(SIOCPROTOPRIVATE+8)
      52  #define SIOCAX25GETINFO		(SIOCPROTOPRIVATE+9)
      53  #define SIOCAX25ADDFWD		(SIOCPROTOPRIVATE+10)
      54  #define SIOCAX25DELFWD		(SIOCPROTOPRIVATE+11)
      55  
      56  /* unknown: */
      57  #define AX25_NOUID_DEFAULT	0
      58  #define AX25_NOUID_BLOCK	1
      59  #define AX25_SET_RT_IPMODE	2
      60  
      61  /* Digipeating flags: */
      62  #define AX25_DIGI_INBAND	0x01	/* Allow digipeating within port */
      63  #define AX25_DIGI_XBAND		0x02	/* Allow digipeating across ports */
      64  
      65  /* Maximum number of digipeaters: */
      66  #define AX25_MAX_DIGIS 8
      67  
      68  
      69  typedef struct
      70    {
      71      char ax25_call[7];		/* 6 call + SSID (shifted ascii) */
      72    }
      73  ax25_address;
      74  
      75  struct sockaddr_ax25
      76    {
      77      sa_family_t sax25_family;
      78      ax25_address sax25_call;
      79      int sax25_ndigis;
      80    };
      81  
      82  /*
      83   * The sockaddr struct with the digipeater addresses:
      84   */
      85  struct full_sockaddr_ax25
      86    {
      87      struct sockaddr_ax25 fsa_ax25;
      88      ax25_address fsa_digipeater[AX25_MAX_DIGIS];
      89    };
      90  #define sax25_uid	sax25_ndigis
      91  
      92  struct ax25_routes_struct
      93    {
      94      ax25_address port_addr;
      95      ax25_address dest_addr;
      96      unsigned char digi_count;
      97      ax25_address digi_addr[AX25_MAX_DIGIS];
      98    };
      99  
     100  /* The AX.25 ioctl structure: */
     101  struct ax25_ctl_struct
     102    {
     103      ax25_address port_addr;
     104      ax25_address source_addr;
     105      ax25_address dest_addr;
     106      unsigned int cmd;
     107      unsigned long arg;
     108      unsigned char digi_count;
     109      ax25_address digi_addr[AX25_MAX_DIGIS];
     110    };
     111  
     112  struct ax25_info_struct
     113    {
     114      unsigned int  n2, n2count;
     115      unsigned int t1, t1timer;
     116      unsigned int t2, t2timer;
     117      unsigned int t3, t3timer;
     118      unsigned int idle, idletimer;
     119      unsigned int state;
     120      unsigned int rcv_q, snd_q;
     121    };
     122  
     123  struct ax25_fwd_struct
     124    {
     125      ax25_address port_from;
     126      ax25_address port_to;
     127    };
     128  
     129  /* AX.25 route structure: */
     130  struct ax25_route_opt_struct
     131    {
     132      ax25_address port_addr;
     133      ax25_address dest_addr;
     134      int cmd;
     135      int arg;
     136    };
     137  
     138  /* AX.25 BPQ stuff: */
     139  struct ax25_bpqaddr_struct
     140    {
     141      char dev[16];
     142      ax25_address addr;
     143    };
     144  
     145  /* Definitions for the AX.25 `values' fields: */
     146  #define	AX25_VALUES_IPDEFMODE	0	/* 'D'=DG 'V'=VC */
     147  #define	AX25_VALUES_AXDEFMODE	1	/* 8=Normal 128=Extended Seq Nos */
     148  #define	AX25_VALUES_NETROM	2	/* Allow NET/ROM  - 0=No 1=Yes */
     149  #define	AX25_VALUES_TEXT	3	/* Allow PID=Text - 0=No 1=Yes */
     150  #define	AX25_VALUES_BACKOFF	4	/* 'E'=Exponential 'L'=Linear */
     151  #define	AX25_VALUES_CONMODE	5	/* Allow connected modes - 0=No 1=Yes */
     152  #define	AX25_VALUES_WINDOW	6	/* Default window size for standard AX.25 */
     153  #define	AX25_VALUES_EWINDOW	7	/* Default window size for extended AX.25 */
     154  #define	AX25_VALUES_T1		8	/* Default T1 timeout value */
     155  #define	AX25_VALUES_T2		9	/* Default T2 timeout value */
     156  #define	AX25_VALUES_T3		10	/* Default T3 timeout value */
     157  #define	AX25_VALUES_N2		11	/* Default N2 value */
     158  #define	AX25_VALUES_DIGI	12	/* Digipeat mode */
     159  #define AX25_VALUES_IDLE	13	/* mode vc idle timer */
     160  #define AX25_VALUES_PACLEN	14	/* AX.25 MTU */
     161  #define AX25_VALUES_IPMAXQUEUE  15	/* Maximum number of buffers enqueued */
     162  #define	AX25_MAX_VALUES		20
     163  
     164  struct ax25_parms_struct
     165    {
     166      ax25_address port_addr;
     167      unsigned short values[AX25_MAX_VALUES];
     168    };
     169  
     170  #endif /* netax25/ax25.h */