Source for file docsis_phs.php

Documentation is available at docsis_phs.php

  1. <?php
  2. /**
  3. * DOCSIS Payload Header Suppression
  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. require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'docsis_error.php');
  15.  
  16. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION', 26);
  17. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_CLASSIFIER_REFERENCE', 1);
  18. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_CLASSIFIER_IDENTIFIER', 2);
  19. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_SERVICE_FLOW_REFERENCE', 3);
  20. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_SERVICE_FLOW_IDENTIFIER', 4);
  21. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_DSC_ACTION', 5);
  22. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_ERROR', 6);
  23. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSF', 7);
  24. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSI', 8);
  25. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSM', 9);
  26. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSS', 10);
  27. define('DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSV', 11);
  28.  
  29. /**
  30. * DOCSIS Payload Header Suppression
  31. *
  32. * @package docsis_config
  33. */
  34. class docsis_payload_header_suppression extends docsis_encoder_complex
  35. {
  36. /**
  37. * Constructor
  38. *
  39. * @param int $code docsis code
  40. * @param array $value predefined values
  41. */
  42. function docsis_payload_header_suppression($code=DOCSIS_PAYLOAD_HEADER_SUPPRESSION, $value=array())
  43. {
  44. parent::docsis_encoder_complex($code, $value);
  45. }
  46.  
  47. /**
  48. * Set Classifier Reference
  49. *
  50. * See Radio Frequency Interface Specification C.2.2.8.1
  51. *
  52. * @param int $value from 1 to 255
  53. */
  54. function set_classifier_reference($value)
  55. {
  56. if($value < 1 || $value > 255) trigger_error('Reference must be 1 to 255', E_USER_WARNING);
  57. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_CLASSIFIER_REFERENCE] =
  58. new docsis_encoder_uchar(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_CLASSIFIER_REFERENCE, $value);
  59. }
  60.  
  61. /**
  62. * Set Classifier Identifier
  63. *
  64. * See Radio Frequency Interface Specification C.2.2.8.2
  65. *
  66. * @param int $value from 1 to 65535
  67. */
  68. function set_classifier_identifier($value)
  69. {
  70. if($value < 1 || $value > 65535) trigger_error('Identifier must be 1 to 65535', E_USER_WARNING);
  71. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_CLASSIFIER_IDENTIFIER] =
  72. new docsis_encoder_ushort(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_CLASSIFIER_IDENTIFIER, $value);
  73. }
  74.  
  75. /**
  76. * Set Service Flow Reference
  77. *
  78. * See Radio Frequency Interface Specification C.2.2.8.3
  79. *
  80. * @param int $value from 1 to 65535
  81. */
  82. function set_service_flow_reference($value)
  83. {
  84. if($value < 1 || $value > 65535) trigger_error('Reference must be 1 to 65535', E_USER_WARNING);
  85. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_SERVICE_FLOW_REFERENCE] =
  86. new docsis_encoder_ushort(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_SERVICE_FLOW_REFERENCE, $value);
  87. }
  88.  
  89. /**
  90. * Set Service Flow Identifier
  91. *
  92. * See Radio Frequency Interface Specification C.2.2.8.4
  93. *
  94. * @param int $value from 1 to 4294967295
  95. */
  96. function set_service_flow_identifier($value)
  97. {
  98. if($value < 1 || $value > 4294967295) trigger_error('Identifier must be 1 to 4294967295', E_USER_WARNING);
  99. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_SERVICE_FLOW_IDENTIFIER] =
  100. new docsis_encoder_uint(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_SERVICE_FLOW_IDENTIFIER, $value);
  101. }
  102.  
  103. /**
  104. * Set Dynamic Service Change Action
  105. *
  106. * <ul>
  107. * <li>0 - Add PHS Rule</li>
  108. * <li>1 - Set PHS Rule</li>
  109. * <li>2 - Delete PHS Rule</li>
  110. * <li>3 - Delete all PHS Rules</li>
  111. * </ul>
  112. *
  113. * See Radio Frequency Interface Specification C.2.2.8.5
  114. *
  115. * @param int $value
  116. */
  117. function set_dsc_action($value)
  118. {
  119. if($value < 0 || $value > 3) trigger_error('Dynamic Service Change Action must be 0 to 3', E_USER_WARNING);
  120. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_DSC_ACTION] = new docsis_encoder_uchar(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_DSC_ACTION, $value);
  121. }
  122.  
  123. /**
  124. * Set Error
  125. *
  126. * See Radio Frequency Interface Specification C.2.2.9
  127. *
  128. * @param docsis_error $value
  129. */
  130. function set_error($value)
  131. {
  132. // todo: must be a docsis_error
  133. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_ERROR] = $value;
  134. }
  135.  
  136. /**
  137. * Set Payload Header Suppression Field (PHSF)
  138. *
  139. * See Radio Frequency Interface Specification C.2.2.10.1
  140. *
  141. * @param string $value
  142. */
  143. function set_field($value)
  144. {
  145. // todo: ????
  146. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSF] = new docsis_encoder_string(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSF, $value);
  147. }
  148.  
  149. /**
  150. * Set Payload Header Suppression Index (PHSI)
  151. *
  152. * See Radio Frequency Interface Specification C.2.2.10.2
  153. *
  154. * @param int $value from 1 to 255
  155. */
  156. function set_index($value)
  157. {
  158. if($value < 1 || $value > 255) trigger_error('Index must be 1 to 255', E_USER_WARNING);
  159. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSI] = new docsis_encoder_uchar(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSI, $value);
  160. }
  161.  
  162. /**
  163. * Set Payload Header Suppression Mask (PHSM)
  164. *
  165. * See Radio Frequency Interface Specification C.2.2.10.3
  166. *
  167. * @param string $value
  168. */
  169. function set_mask($value)
  170. {
  171. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSM] = new docsis_encoder_string(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSM, $value);
  172. }
  173.  
  174. /**
  175. * Set Payload Header Suppression Size (PHSS)
  176. *
  177. * See Radio Frequency Interface Specification C.2.2.10.4
  178. *
  179. * @param int $value
  180. */
  181. function set_size($value)
  182. {
  183. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSS] = new docsis_encoder_uchar(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSS, $value);
  184. }
  185.  
  186. /**
  187. * Set Payload Header Suppression Verification (PHSV)
  188. *
  189. * See Radio Frequency Interface Specification C.2.2.10.5
  190. *
  191. * @param boolean $value
  192. */
  193. function set_verify($value)
  194. {
  195. if($value < 0 || $value > 1) trigger_error('Verification must be 0 or 1', E_USER_WARNING);
  196. $this->value[DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSV] = new docsis_encoder_uchar(DOCSIS_PAYLOAD_HEADER_SUPPRESSION_PHSV, $value);
  197. }
  198.  
  199. /**
  200. * Set Vendor Specific PHS Parameters
  201. *
  202. * See Radio Frequency Interface Specification C.2.2.10.
  203. *
  204. * @param docsis_vendor $value
  205. */
  206. function set_vendor($value)
  207. {
  208. // todo: must be a docsis_vendor
  209. $this->value[DOCSIS_VENDOR] = $value;
  210. }
  211. }
  212. ?>

Documentation generated on Mon, 14 Nov 2005 18:00:28 -0700 by phpDocumentor 1.3.0RC3