ax25.h 4.7 KB

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