rose.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. /* Definitions for Rose packet radio address family.
  17. Copyright (C) 1998-2026 Free Software Foundation, Inc.
  18. This file is part of the GNU C Library.
  19. The GNU C Library is free software; you can redistribute it and/or
  20. modify it under the terms of the GNU Lesser General Public
  21. License as published by the Free Software Foundation; either
  22. version 2.1 of the License, or (at your option) any later version.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, see
  29. <https://www.gnu.org/licenses/>. */
  30. /* What follows is copied from the 2.1.93 <linux/rose.h>. */
  31. #ifndef _NETROSE_ROSE_H
  32. #define _NETROSE_ROSE_H 1
  33. #include <sys/socket.h>
  34. #include <netax25/ax25.h>
  35. /* Socket level values. */
  36. #define SOL_ROSE 260
  37. /* These are the public elements of the Linux kernel Rose
  38. implementation. For kernel AX.25 see the file ax25.h. This file
  39. requires ax25.h for the definition of the ax25_address structure. */
  40. #define ROSE_MTU 251
  41. #define ROSE_MAX_DIGIS 6
  42. #define ROSE_DEFER 1
  43. #define ROSE_T1 2
  44. #define ROSE_T2 3
  45. #define ROSE_T3 4
  46. #define ROSE_IDLE 5
  47. #define ROSE_QBITINCL 6
  48. #define ROSE_HOLDBACK 7
  49. #define SIOCRSGCAUSE (SIOCPROTOPRIVATE + 0)
  50. #define SIOCRSSCAUSE (SIOCPROTOPRIVATE + 1)
  51. #define SIOCRSL2CALL (SIOCPROTOPRIVATE + 2)
  52. #define SIOCRSSL2CALL (SIOCPROTOPRIVATE + 2)
  53. #define SIOCRSACCEPT (SIOCPROTOPRIVATE + 3)
  54. #define SIOCRSCLRRT (SIOCPROTOPRIVATE + 4)
  55. #define SIOCRSGL2CALL (SIOCPROTOPRIVATE + 5)
  56. #define SIOCRSGFACILITIES (SIOCPROTOPRIVATE + 6)
  57. #define ROSE_DTE_ORIGINATED 0x00
  58. #define ROSE_NUMBER_BUSY 0x01
  59. #define ROSE_INVALID_FACILITY 0x03
  60. #define ROSE_NETWORK_CONGESTION 0x05
  61. #define ROSE_OUT_OF_ORDER 0x09
  62. #define ROSE_ACCESS_BARRED 0x0B
  63. #define ROSE_NOT_OBTAINABLE 0x0D
  64. #define ROSE_REMOTE_PROCEDURE 0x11
  65. #define ROSE_LOCAL_PROCEDURE 0x13
  66. #define ROSE_SHIP_ABSENT 0x39
  67. typedef struct
  68. {
  69. char rose_addr[5];
  70. } rose_address;
  71. struct sockaddr_rose
  72. {
  73. sa_family_t srose_family;
  74. rose_address srose_addr;
  75. ax25_address srose_call;
  76. int srose_ndigis;
  77. ax25_address srose_digi;
  78. };
  79. struct full_sockaddr_rose
  80. {
  81. sa_family_t srose_family;
  82. rose_address srose_addr;
  83. ax25_address srose_call;
  84. unsigned int srose_ndigis;
  85. ax25_address srose_digis[ROSE_MAX_DIGIS];
  86. };
  87. struct rose_route_struct
  88. {
  89. rose_address address;
  90. unsigned short int mask;
  91. ax25_address neighbour;
  92. char device[16];
  93. unsigned char ndigis;
  94. ax25_address digipeaters[AX25_MAX_DIGIS];
  95. };
  96. struct rose_cause_struct
  97. {
  98. unsigned char cause;
  99. unsigned char diagnostic;
  100. };
  101. struct rose_facilities_struct
  102. {
  103. rose_address source_addr, dest_addr;
  104. ax25_address source_call, dest_call;
  105. unsigned char source_ndigis, dest_ndigis;
  106. ax25_address source_digis[ROSE_MAX_DIGIS];
  107. ax25_address dest_digis[ROSE_MAX_DIGIS];
  108. unsigned int rand;
  109. rose_address fail_addr;
  110. ax25_address fail_call;
  111. };
  112. #endif /* netrose/rose.h */