Source for file docsis_class_of_service.php

Documentation is available at docsis_class_of_service.php

  1. <?php
  2. /**
  3. * DOCSIS Class of Service
  4. *
  5. * @author David Eder <david@eder.us>
  6. * @copyright 2004 David Eder
  7. * @package docsis_config
  8. * @version .3
  9. */
  10.  
  11. /**
  12. */
  13. require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'docsis_common.php');
  14.  
  15. define('DOCSIS_CLASS_OF_SERVICE', 4);
  16. define('DOCSIS_CLASS_ID', 1);
  17. define('DOCSIS_CLASS_MAX_RATE_DOWN', 2);
  18. define('DOCSIS_CLASS_MAX_RATE_UP', 3);
  19. define('DOCSIS_CLASS_PRIORITY_UP', 4);
  20. define('DOCSIS_CLASS_GUARANTEED_UP', 5);
  21. define('DOCSIS_CLASS_MAX_BURST_UP', 6);
  22. define('DOCSIS_CLASS_PRIVACY_ENABLE', 7);
  23.  
  24. /**
  25. * DOCSIS Class of Service
  26. *
  27. * @package docsis_config
  28. */
  29. class docsis_class_of_service extends docsis_encoder_complex
  30. {
  31. /**
  32. * Constructor
  33. *
  34. * @param int $code docsis code
  35. * @param array $value predefined values
  36. */
  37. function docsis_class_of_service($code=DOCSIS_CLASS_OF_SERVICE, $value=array())
  38. {
  39. parent::docsis_encoder_complex($code, $value);
  40. }
  41.  
  42. /**
  43. * Set Class ID - docsis 1.0
  44. *
  45. * @param int $value from 1 to 16
  46. */
  47. function set_id($value)
  48. {
  49. if($value < 1 || $value > 16) trigger_error('ID must be 1 to 16', E_USER_WARNING);
  50. $this->value[DOCSIS_CLASS_ID] = new docsis_encoder_uchar(DOCSIS_CLASS_ID, $value);
  51. }
  52.  
  53. /**
  54. * Set Maximum Downstream Rate - docsis 1.0
  55. *
  56. * For a single SID modem, the value of this field specifies the maximum downstream rate in bits per second that the CMTS is permitted to forward
  57. * to CPE unicast MAC addresses learned or configured as mapping to the registering modem.
  58. *
  59. * For a multiple SID modem, the aggregate value of these fields specifies the maximum downstream rate in bits per second that the CMTS is
  60. * permitted to forward to CPE unicast MAC addresses learned or configured as mapping to the registering modem.
  61. *
  62. * This is the peak rate for Packet PDU Data (including destination MAC address and the CRC) over a one-second interval. This does not include
  63. * MAC packets addressed to broadcast or multicast MAC addresses. The CMTS must limit downstream forwarding to this rate. The CMTS may delay,
  64. * rather than drop, over-limit packets.
  65. *
  66. * @param int $value from 0 to 52000000
  67. */
  68. function set_max_rate_down($value)
  69. {
  70. if($value < 0 || $value > 52000000) trigger_error('Max Rate Down must be 0 to 52000000', E_USER_WARNING);
  71. $this->value[DOCSIS_CLASS_MAX_RATE_DOWN] = new docsis_encoder_uint(DOCSIS_CLASS_MAX_RATE_DOWN, $value);
  72. }
  73.  
  74. /**
  75. * Set Maximum Upstream Rate - docsis 1.0
  76. *
  77. * The value of this field specifies the maximum upstream rate in bits per second that the CM is permitted to forward to the RF Network.
  78. *
  79. * This is the peak rate for Packet PDU Data (including destination address and the CRC) over a one-second interval. The CM must limit all
  80. * upstream forwarding (both contention and reservation-based), for the corresponding SID, to this rate. The CM must include Packet PDU Data
  81. * packets addressed to broadcast or multicast addresses when calculating this rate.
  82. *
  83. * The CM must enforce this limit on all upstream data transmissions, including data sent in contention. The CMTS should generate an alarm
  84. * if a modem exceeds its allowable rate.
  85. *
  86. * @param int $value from 0 to 10000000
  87. */
  88. function set_max_rate_up($value)
  89. {
  90. if($value < 0 || $value > 10000000) trigger_error('Max Rate Up must be 0 to 10000000', E_USER_WARNING);
  91. $this->value[DOCSIS_CLASS_MAX_RATE_UP] = new docsis_encoder_uint(DOCSIS_CLASS_MAX_RATE_UP, $value);
  92. }
  93.  
  94. /**
  95. * Set Upstream Channel Priority - docsis 1.0
  96. *
  97. * The value of this field specifies the relative priority assigned to this service class for data transmission in the upstream channel.
  98. * Higher numbers indicate higher priority.
  99. *
  100. * @param int $value from 0 to 7
  101. */
  102. function set_priority_up($value)
  103. {
  104. if($value < 0 || $value > 7) trigger_error('Upstrem Priority must be 0 to 7', E_USER_WARNING);
  105. $this->value[DOCSIS_CLASS_PRIORITY_UP] = new docsis_encoder_uchar(DOCSIS_CLASS_PRIORITY_UP, $value);
  106. }
  107.  
  108. /**
  109. * Set Guaranteed Minimum Upstream Channel Data Rate - docsis 1.0
  110. *
  111. * The value of this field specifies the data rate in bit/sec which will be guaranteed to this servie class on the upstream channel.
  112. *
  113. * @param int $value from 0 to 10000000
  114. */
  115. function set_guaranteed_up($value)
  116. {
  117. if($value < 0 || $value > 10000000) trigger_error('Guaranteed Up must be 0 to 10000000', E_USER_WARNING);
  118. $this->value[DOCSIS_CLASS_GUARANTEED_UP] = new docsis_encoder_uint(DOCSIS_CLASS_GUARANTEED_UP, $value);
  119. }
  120.  
  121. /**
  122. * Set Maximum Upstream Channel Transmit Burst - docsis 1.0
  123. *
  124. * The value of this field specifies the maximum transmit burst (in bytes) which this service class is allowed on the upstream channel. A value
  125. * of zero means there is no limit. Note: This value does not include any physical layer overhead.
  126. *
  127. * @param int $value
  128. */
  129. function set_max_burst_up($value)
  130. {
  131. $this->value[DOCSIS_CLASS_MAX_BURST_UP] = new docsis_encoder_ushort(DOCSIS_CLASS_MAX_BURST_UP, $value);
  132. }
  133.  
  134. /**
  135. * Set Class-of-Service Privacy Enable - docsis 1.0
  136. *
  137. * This setting enables/disables Baseline Privacy on a provisioned CoS.
  138. *
  139. * @param boolean $value
  140. */
  141. function set_privacy_enable($value)
  142. {
  143. if($value < 0 || $value > 1) trigger_error('Baseline Privacy must be 0 or 1', E_USER_WARNING);
  144. $this->value[DOCSIS_CLASS_PRIVACY_ENABLE] = new docsis_encoder_uchar(DOCSIS_CLASS_PRIVACY_ENABLE, $value);
  145. }
  146. }
  147. ?>

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