adtranvofr.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Asterisk -- A telephony toolkit for Linux.
  3. *
  4. * Implementation of Voice over Frame Relay, Adtran Style
  5. *
  6. * Copyright (C) 1999, Mark Spencer
  7. *
  8. * Mark Spencer <markster@linux-support.net>
  9. *
  10. * This program is free software, distributed under the terms of
  11. * the GNU General Public License
  12. */
  13. #ifndef _ADTRANVOFR_H
  14. #define _ADTRANVOFR_H
  15. #define VOFR_CONTROL_ADTRAN 0x0
  16. #define VOFR_CONTROL_VOICE 0x1
  17. #define VOFR_CONTROL_RFC1490 0x3
  18. #define VOFR_TYPE_SIGNAL 0x0
  19. #define VOFR_TYPE_VOICE 0x1
  20. #define VOFR_TYPE_ANSWER 0x2
  21. #define VOFR_TYPE_FAX 0x3
  22. #define VOFR_TYPE_DTMF 0x4
  23. #define VOFR_CARD_TYPE_UNSPEC 0x0
  24. #define VOFR_CARD_TYPE_FXS 0x1
  25. #define VOFR_CARD_TYPE_FXO 0x2
  26. #define VOFR_CARD_TYPE_ENM 0x3
  27. #define VOFR_CARD_TYPE_VCOM 0x4
  28. #define VOFR_CARD_TYPE_ASTERISK 0xf
  29. #define VOFR_MODULATION_SINGLE 0x0
  30. #define VOFR_MODULATION_V21 0x1
  31. #define VOFR_MODULATION_V27ter_2 0x2
  32. #define VOFR_MODULATION_V27ter_4 0x3
  33. #define VOFR_MODULATION_V29_7 0x4
  34. #define VOFR_MODULATION_V29_9 0x5
  35. #define VOFR_MODULATION_V33_12 0x6
  36. #define VOFR_MODULATION_V33_14 0x7
  37. #define VOFR_ROUTE_NONE 0x0
  38. #define VOFR_ROUTE_LOCAL 0x1
  39. #define VOFR_ROUTE_VOICE 0x2
  40. #define VOFR_ROUTE_DTE1 0x4
  41. #define VOFR_ROUTE_DTE2 0x8
  42. #define VOFR_ROUTE_DTE 0xC
  43. #define VOFR_MASK_EI 0x80
  44. #define VOFR_MASK_LI 0x40
  45. #define VOFR_MASK_CONTROL 0x3F
  46. #define VOFR_SIGNAL_ON_HOOK 0x00
  47. #define VOFR_SIGNAL_OFF_HOOK 0x01
  48. #define VOFR_SIGNAL_RING 0x40
  49. #define VOFR_SIGNAL_SWITCHED_DIAL 0x08
  50. #define VOFR_SIGNAL_BUSY 0x02
  51. #define VOFR_SIGNAL_TRUNK_BUSY 0x04
  52. #define VOFR_SIGNAL_UNKNOWN 0x10
  53. #define VOFR_SIGNAL_OFFHOOK 0x81
  54. #define VOFR_TRACE_SIGNAL 1 << 0
  55. #define VOFR_TRACE_VOICE 1 << 1
  56. #define VOFR_MAX_PKT_SIZE 1500
  57. /*
  58. * Wire level protocol
  59. */
  60. struct vofr_hdr {
  61. u_int8_t control; /* Also contains unused EI and LI bits */
  62. #if __BYTE_ORDER == __LITTLE_ENDIAN
  63. u_int8_t dtype:4; /* Data type */
  64. u_int8_t ctag:4; /* Connect tag */
  65. u_int8_t dlcih:4; /* Hi 2 bits of DLCI x-ref */
  66. u_int8_t vflags:4; /* Voice Routing Flags */
  67. u_int8_t dlcil; /* Lo 8 bits of DLCI x-ref */
  68. u_int8_t cid; /* Channel ID */
  69. u_int8_t mod:4; /* Modulation */
  70. u_int8_t remid:4; /* Remote ID */
  71. #elif __BYTE_ORDER == __BIG_ENDIAN
  72. u_int8_t ctag:4; /* Connect tag */
  73. u_int8_t dtype:4; /* Data type */
  74. u_int8_t vflags:4; /* Voice Routing Flags */
  75. u_int8_t dlcih:4; /* Hi 2 bits of DLCI x-ref */
  76. u_int8_t dlcil; /* Lo 8 bits of DLCI x-ref */
  77. u_int8_t cid; /* Channel ID */
  78. u_int8_t remid:4; /* Remote ID or Relay CMD*/
  79. u_int8_t mod:4; /* Modulation */
  80. #else
  81. #error "Please fix <bytesex.h>"
  82. #endif
  83. #ifdef __GNUC__
  84. u_int8_t data[0]; /* Data */
  85. #endif
  86. };
  87. #define VOFR_HDR_SIZE 6
  88. /* Number of milliseconds to fudge -- experimentally derived */
  89. #define VOFR_FUDGE 2
  90. #endif