Source for file docsis_capabilities.php

Documentation is available at docsis_capabilities.php

  1. <?php
  2. /**
  3. * DOCSIS Capabilities
  4. *
  5. * @author David Eder <david@eder.us>
  6. * @copyright 2004 David Eder
  7. * @package docsis_config
  8. * @version .1
  9. */
  10.  
  11. /**
  12. */
  13. require_once('docsis_common.php');
  14.  
  15. define('DOCSIS_CAPABILITIES', 5);
  16. define('DOCSIS_CAPABILITIES_CONCENTRATION', 1);
  17. define('DOCSIS_CAPABILITIES_VERSION', 2);
  18. define('DOCSIS_CAPABILITIES_FRAGMENTATION', 3);
  19. define('DOCSIS_CAPABILITIES_PAYLOAD_HEADER', 4);
  20. define('DOCSIS_CAPABILITIES_IGMP', 5);
  21. define('DOCSIS_CAPABILITIES_PRIVACY', 6);
  22. define('DOCSIS_CAPABILITIES_DOWNSTREAM_SAID', 7);
  23. define('DOCSIS_CAPABILITIES_UPSTREAM_SID', 8);
  24. define('DOCSIS_CAPABILITIES_FILTER', 9);
  25. define('DOCSIS_CAPABILITIES_TRANSMIT_EQUALIZER_TAPS_PER_SYMBOL', 10);
  26. define('DOCSIS_CAPABILITIES_TRANSMIT_EQUALIZER_TAPS', 11);
  27. define('DOCSIS_CAPABILITIES_DCC', 12);
  28.  
  29. /**
  30. * DOCSIS Capabilities
  31. *
  32. * The value field describes the capabilities of a particular modem, i.e., implementation dependent limits o the particular features or number of
  33. * features which the modem can support.
  34. *
  35. * @package docsis_config
  36. */
  37. class docsis_capabilities extends docsis_encoder_complex
  38. {
  39. /**
  40. * Constructor
  41. *
  42. * @param int $code docsis code
  43. * @param array $value predefined values
  44. */
  45. function docsis_capabilities($code=DOCSIS_CAPABILITIES, $value=array())
  46. {
  47. parent::docsis_encoder_complex($code, $value);
  48. }
  49.  
  50. /**
  51. * Set Concatenation Support
  52. *
  53. * @param boolean $value
  54. */
  55. function set_concatenation($value)
  56. {
  57. if($value < 0 || $value > 1) trigger_error('Concatenation must be 0 or 1', E_USER_WARNING);
  58. $this->value[DOCSIS_CAPABILITIES_CONCENTRATION] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_CONCENTRATION, $value);
  59. }
  60.  
  61. /**
  62. * Set DOCSIS Version
  63. *
  64. * @param int $value 0 indicates DOCSIS v1.0, 1 indicates DOCSIS v1.1
  65. */
  66. function set_version($value)
  67. {
  68. if($value < 0 || $value > 1) trigger_error('Version must be 0 or 1', E_USER_WARNING);
  69. $this->value[DOCSIS_CAPABILITIES_VERSION] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_VERSION, $value);
  70. }
  71.  
  72. /**
  73. * Set Fragmentation Support
  74. *
  75. * @param boolean $value
  76. */
  77. function set_fragmentation($value)
  78. {
  79. if($value < 0 || $value > 1) trigger_error('Fragmentation must be 0 or 1', E_USER_WARNING);
  80. $this->value[DOCSIS_CAPABILITIES_FRAGMENTATION] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_FRAGMENTATION, $value);
  81. }
  82.  
  83. /**
  84. * Set Payload Header Suppression Support
  85. *
  86. * @param boolean $value
  87. */
  88. function set_payload_header_suppression($value)
  89. {
  90. if($value < 0 || $value > 1) trigger_error('Payload Header Suppression must be 0 or 1', E_USER_WARNING);
  91. $this->value[DOCSIS_CAPABILITIES_PAYLOAD_HEADER] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_PAYLOAD_HEADER, $value);
  92. }
  93.  
  94. /**
  95. * Set IGMP Support
  96. *
  97. * @param boolean $value
  98. */
  99. function set_igmp($value)
  100. {
  101. if($value < 0 || $value > 1) trigger_error('IGMP must be 0 or 1', E_USER_WARNING);
  102. $this->value[DOCSIS_CAPABILITIES_IGMP] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_IGMP, $value);
  103. }
  104.  
  105. /**
  106. * Set Privacy Support
  107. *
  108. * @param boolean $value
  109. */
  110. function set_privacy($value)
  111. {
  112. if($value < 0 || $value > 1) trigger_error('Privacy must be 0 or 1', E_USER_WARNING);
  113. $this->value[DOCSIS_CAPABILITIES_PRIVACY] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_PRIVACY, $value);
  114. }
  115.  
  116. /**
  117. * Set Downstream SAID Support
  118. *
  119. * @param int $value number of downstream SAIDs the CM can support. 0 defaults to 1.
  120. */
  121. function set_downstream_said($value)
  122. {
  123. $this->value[DOCSIS_CAPABILITIES_DOWNSTREAM_SAID] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_DOWNSTREAM_SAID, $value);
  124. }
  125.  
  126. /**
  127. * Set Upstream SID Support
  128. *
  129. * @param int $value number of upstream SIDs the modem can support. 0 defaults to 1.
  130. */
  131. function set_upstream_sid($value)
  132. {
  133. $this->value[DOCSIS_CAPABILITIES_UPSTREAM_SID] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_UPSTREAM_SID, $value);
  134. }
  135.  
  136. /**
  137. * Set Optional Filtering Support
  138. *
  139. * @param boolean $p 802.1P filtering
  140. * @param boolean $q 802.1Q filtering
  141. */
  142. function set_filter($p, $q)
  143. {
  144. if($p < 0 || $p > 1) trigger_error('P must be 0 or 1', E_USER_WARNING);
  145. if($q < 0 || $q > 1) trigger_error('Q must be 0 or 1', E_USER_WARNING);
  146. $this->value[DOCSIS_CAPABILITIES_FILTER] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_FILTER, $p + $q + $q);
  147. }
  148.  
  149. /**
  150. * Set Transmit Equalizer Taps per Symbol
  151. *
  152. * @param int $value must be 1, 2, or 4
  153. */
  154. function set_transmit_equalizer_taps_per_symbol($value)
  155. {
  156. if($value != 1 && $value != 2 && $value != 4) trigger_error('Transmit Equalizer Taps per Symbol must be 1, 2 or 4', E_USER_WARNING);
  157. $this->value[DOCSIS_CAPABILITIES_TRANSMIT_EQUALIZER_TAPS_PER_SYMBOL] =
  158. new docsis_encoder_uchar(DOCSIS_CAPABILITIES_TRANSMIT_EQUALIZER_TAPS_PER_SYMBOL, $value);
  159. }
  160.  
  161. /**
  162. * Set Number of Transmit Equalizer Taps
  163. *
  164. * @param int $value must be 8 to 64
  165. */
  166. function set_transmit_equalizer_taps($value)
  167. {
  168. if($value < 8 || $value > 64) trigger_error('Transmit Equalizer Taps must be 8 to 64', E_USER_WARNING);
  169. $this->value[DOCSIS_CAPABILITIES_TRANSMIT_EQUALIZER_TAPS] = new docsis_encoder_uchar(TRANSMIT_EQUALIZER_TAPS, $value);
  170. }
  171.  
  172. /**
  173. * Set DCC Support
  174. *
  175. * @param boolean $value
  176. */
  177. function set_dcc($value)
  178. {
  179. if($value < 0 || $value > 1) trigger_error('DCC must be 0 or 1', E_USER_WARNING);
  180. $this->value[DOCSIS_CAPABILITIES_DCC] = new docsis_encoder_uchar(DOCSIS_CAPABILITIES_DCC, $value);
  181. }
  182. }
  183. ?>

Documentation generated on Mon, 14 Nov 2005 17:59:37 -0700 by phpDocumentor 1.3.0RC3