ax25.h 4.8 KB

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