1
0

ax25.h 5.3 KB

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