Documentation is available at docsis_flow.php
- <?php
- /**
- * DOCSIS Service Flow
- *
- * @author David Eder <david@eder.us>
- * @copyright 2004 David Eder
- * @package docsis_config
- * @version .3
- */
- /**
- */
- require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'docsis_common.php');
- require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'docsis_error.php');
- require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'docsis_vendor.php');
- define('DOCSIS_FLOW_UP', 24);
- define('DOCSIS_FLOW_IDENTIFIER_2', 3);
- define('DOCSIS_FLOW_MAX_CONCAT_BURST', 14);
- define('DOCSIS_FLOW_SCHED_TYPE', 15);
- define('DOCSIS_FLOW_REQUEST_POLICY', 16);
- define('DOCSIS_FLOW_POLLING_INTERVAL', 17);
- define('DOCSIS_FLOW_POLL_JITTER', 18);
- define('DOCSIS_FLOW_UNSOLICITED_GRANT_SIZE', 19);
- define('DOCSIS_FLOW_NOMINAL_GRANT_SIZE', 20);
- define('DOCSIS_FLOW_GRANT_JITTER', 21);
- define('DOCSIS_FLOW_GRANTS_PER_INTERVAL', 22);
- define('DOCSIS_FLOW_TOS_MASK', 23);
- define('DOCSIS_FLOW_UNSOLICITED_GRANT_TIME', 24);
- define('DOCSIS_FLOW_DOWN', 25);
- define('DOCSIS_FLOW_MAX_DOWN_LATENCY', 14);
- // shared
- define('DOCSIS_FLOW_REFERENCE', 1);
- define('DOCSIS_FLOW_IDENTIFIER', 2);
- define('DOCSIS_FLOW_CLASS_NAME', 4);
- define('DOCSIS_FLOW_ERROR', 5);
- define('DOCSIS_FLOW_QOS', 6);
- define('DOCSIS_FLOW_TRAFFIC_PRIORITY', 7);
- define('DOCSIS_FLOW_MAX_RATE', 8);
- define('DOCSIS_FLOW_MAX_BURST', 9);
- define('DOCSIS_FLOW_MIN_RESERVED_RATE', 10);
- define('DOCSIS_FLOW_MIN_RESERVED_PACKET_SIZE', 11);
- define('DOCSIS_FLOW_ACTIVE_QOS_TIMEOUT', 12);
- define('DOCSIS_FLOW_ADMITTED_QOS_TIMEOUT', 13);
- /**
- * DOCSIS Service Flow
- *
- * @package docsis_config
- * @subpackage docsis_flow
- */
- class docsis_flow extends docsis_encoder_complex
- {
- /**
- * Constructor
- *
- * @param int $code docsis code
- * @param array $value predefined values
- */
- function docsis_flow($code, $value=array())
- {
- parent::docsis_encoder_complex($code, $value);
- }
- /**
- * Set Service Flow Reference
- *
- * See Radio Frequency Interface Specification C.2.2.3.1
- *
- * @param int $value
- */
- function set_reference($value)
- {
- if($value < 1 || $value > 65535) trigger_error('Reference must be 1 to 65535', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_REFERENCE] = new docsis_encoder_ushort(DOCSIS_FLOW_REFERENCE, $value);
- }
- /**
- * Set Service Flow Identifier
- *
- * See Radio Frequency Interface Specification C.2.2.3.2
- *
- * The configuration file MUST NOT contain this parameter.
- *
- * @param int $value
- */
- function set_identifier($value)
- {
- if($value < 1 || $value > 4294967295) trigger_error('Identifier must be 1 to 4294967295', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_IDENTIFIER] = new docsis_encoder_uint(DOCSIS_FLOW_IDENTIFIER, $value);
- }
- /**
- * Set Service Class Name
- *
- * See Radio Frequency Interface Specification C.2.2.3.4
- *
- * @param string $value
- */
- function set_class_name($value)
- {
- if(strpos($value, chr(0)) !== false)
- trigger_error('Name cannot include the NULL character', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_CLASS_NAME] = new docsis_encoder_string(DOCSIS_FLOW_CLASS_NAME, $value . chr(0));
- }
- /**
- * Set Quality of Service Parameter Set Type
- *
- * See Radio Frequency Interface Specification C.2.2.3.5
- *
- * @param boolena $provisionioned
- * @param boolena $admitted
- * @param boolena $active
- */
- function set_qos($provisioned, $admitted, $active)
- {
- if($provisioned < 0 || $provisioned > 1) trigger_error('Provisioned must be 0 or 1', E_USER_WARNING);
- if($admitted < 0 || $admitted > 1) trigger_error('Admitted must be 0 or 1', E_USER_WARNING);
- if($active < 0 || $active > 1) trigger_error('Active must be 0 or 1', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_QOS] = new docsis_encoder_uchar(DOCSIS_FLOW_QOS, $provisioned + 2 * $admitted + 4 * $active);
- }
- /**
- * Set Error
- *
- * See Radio Frequency Interface Specification C.2.2.4
- *
- * @param docsis_error $value
- */
- function set_error($value)
- {
- // todo: must be a docsis_error
- $this->value[DOCSIS_FLOW_ERROR] = $value;
- }
- /**
- * Set Traffic Priority
- *
- * See Radio Frequency Interface Specification C.2.2.5.1
- *
- * @param int $value
- */
- function set_traffic_priority($value)
- {
- if($value < 0 || $value > 7) trigger_error('Identifier must be 0 to 7', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_TRAFFIC_PRIORITY] = new docsis_encoder_uchar(DOCSIS_FLOW_TRAFFIC_PRIORITY, $value);
- }
- /**
- * Set Maximum Sustained Traffic Rate
- *
- * See Radio Frequency Interface Specification C.2.2.5.2
- *
- * @param int $value
- */
- function set_max_rate($value)
- {
- $this->value[DOCSIS_FLOW_MAX_RATE] = new docsis_encoder_uint(DOCSIS_FLOW_MAX_RATE, $value);
- }
- /**
- * Set Maximum Traffic Burst
- *
- * See Radio Frequency Interface Specification C.2.2.5.3
- *
- * @param int $value
- */
- function set_max_burst($value)
- {
- if($value < 1521) trigger_error('Burst must be greater than 1520', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_MAX_BURST] = new docsis_encoder_uint(DOCSIS_FLOW_MAX_BURST, $value);
- }
- /**
- * Set Minimum Reserved Traffic Rate
- *
- * See Radio Frequency Interface Specification C.2.2.5.4
- *
- * @param int $value
- */
- function set_min_reserved_rate($value)
- {
- $this->value[DOCSIS_FLOW_MIN_RESERVED_RATE] = new docsis_encoder_uint(DOCSIS_FLOW_MIN_RESERVED_RATE, $value);
- }
- /**
- * Set Assumed Minimum Reserved Rate Packet Size
- *
- * See Radio Frequency Interface Specification C.2.2.5.5
- *
- * @param int $value
- */
- function set_min_reserved_packet_size($value)
- {
- $this->value[DOCSIS_FLOW_MIN_RESERVED_PACKET_SIZE] = new docsis_encoder_ushort(DOCSIS_FLOW_MIN_RESERVED_PACKET_SIZE, $value);
- }
- /**
- * Set Timeout for Active QoS Parameters
- *
- * See Radio Frequency Interface Specification C.2.2.5.6
- *
- * @param int $value
- */
- function set_active_qos_timeout($value)
- {
- $this->value[DOCSIS_FLOW_ACTIVE_QOS_TIMEOUT] = new docsis_encoder_ushort(DOCSIS_FLOW_ACTIVE_QOS_TIMEOUT, $value);
- }
- /**
- * Set Timeout for Admitted QoS Parameters
- *
- * See Radio Frequency Interface Specification C.2.2.5.7
- *
- * @param int $value
- */
- function set_admitted_qos_timeout($value)
- {
- $this->value[DOCSIS_FLOW_ADMITTED_QOS_TIMEOUT] = new docsis_encoder_ushort(DOCSIS_FLOW_ADMITTED_QOS_TIMEOUT, $value);
- }
- /**
- * Set Vendor Specific QoS Parameters
- *
- * See Radio Frequency Interface Specification C.2.2.5.8
- *
- * @param int $value
- */
- function set_vendor($value)
- {
- // todo: must exist be a docsis_vendor
- $this->value[DOCSIS_VENDOR] = $value;
- }
- }
- /**
- * DOCSIS Service Flow Up
- *
- * @package docsis_config
- * @subpackage docsis_flow
- */
- class docsis_flow_up extends docsis_flow
- {
- /**
- * Constructor
- *
- * @param int $code docsis code
- * @param array $value predefined values
- */
- function docsis_flow_up($code=DOCSIS_FLOW_UP, $value=array())
- {
- parent::docsis_flow($code, $value);
- }
- /**
- * Set
- *
- * See Radio Frequency Interface Specification C.2.2.3.3
- *
- * @param int $value
- */
- function set_identifier_2($value)
- {
- if($value < 1 || $value > 16383) trigger_error('Identifier2 must be 1 to 16383', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_IDENTIFIER_2] = new docsis_encoder_ushort(DOCSIS_FLOW_IDENTIFIER_2, $value);
- }
- /**
- * Set Maximum Traffic Burst
- *
- * See Radio Frequency Interface Specification C.2.2.6.1
- *
- * @param int $value
- */
- function set_max_concat_burst($value)
- {
- $this->value[DOCSIS_FLOW_MAX_CONCAT_BURST] = new docsis_encoder_ushort(DOCSIS_FLOW_MAX_CONCAT_BURST, $value);
- }
- /**
- * Set Service Flow Scheduling Type
- *
- * See Radio Frequency Interface Specification C.2.2.6.2
- *
- * Types:
- * <ul>
- * <li>0 Reserved</li>
- * <li>1 Undefined (CMTS implementation-dependent)</li>
- * <li>2 Best Effort</li>
- * <li>3 Non-Real-Time Polling Service</li>
- * <li>4 Real-Time Polling Service</li>
- * <li>5 Unsolicited Grant Service with Activity Detection</li>
- * <li>6 Unsolicited Grant Service</li>
- * <li>7-255 Reserved for future use</li>
- * </ul>
- *
- * @param int $type
- */
- function set_sched_type($type)
- {
- if($type < 1 || $type > 6) trigger_error('Scheduling Type must be 1 to 6', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_SCHED_TYPE] = new docsis_encoder_uchar(DOCSIS_FLOW_SCHED_TYPE, $type);
- }
- /**
- * Set
- *
- * See Radio Frequency Interface Specification C.2.2.6.3
- *
- * <ul>
- * <li>bit 0# The Service Flow MUST NOT use "all CMs" broadcast request opportunities.</li>
- * <li>bit 1# The Service Flow MUST NOT use Priority Request multicast request opportunities.</li>
- * <li>bit 2# The Service Flow MUST NOT use Request/Data opportunities for Requests.</li>
- * <li>bit 3# The Service Flow MUST NOT use Request/Data opportunities for Data.</li>
- * <li>bit 4# The Service Flow MUST NOT piggyback requests with data.</li>
- * <li>bit 5# The Service Flow MUST NOT concatenate data.</li>
- * <li>bit 6# The Service Flow MUST NOT fragment data.</li>
- * <li>bit 7# The Service Flow MUST NOT suppress payload headers.</li>
- * <li>bit 8# The Service Flow MUST NOT drop packets that do not fit in the Unsolicited Grant Size.</li>
- * </ul>
- *
- * @param int $value
- */
- function set_request_policy($value)
- {
- if($value < 0 || $value > 511) trigger_error('Request Policy must be 0 to 511', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_REQUEST_POLICY] = new docsis_encoder_uint(DOCSIS_FLOW_REQUEST_POLICY, $value);
- }
- /**
- * Set Nominal Polling Interval
- *
- * See Radio Frequency Interface Specification C.2.2.6.4
- *
- * @param int $value microseconds
- */
- function set_polling_interval($value)
- {
- $this->value[DOCSIS_FLOW_POLLING_INTERVAL] = new docsis_encoder_uint(DOCSIS_FLOW_POLLING_INTERVAL, $value);
- }
- /**
- * Set Tolerated Poll Jitter
- *
- * See Radio Frequency Interface Specification C.2.2.6.5
- *
- * @param int $value microseconds
- */
- function set_poll_jitter($value)
- {
- $this->value[DOCSIS_FLOW_POLL_JITTER] = new docsis_encoder_uint(DOCSIS_FLOW_POLL_JITTER, $value);
- }
- /**
- * Set Unsolicited Grant Size
- *
- * See Radio Frequency Interface Specification C.2.2.6.6
- *
- * @param int $value
- */
- function set_unsolicited_grant_size($value)
- {
- $this->value[DOCSIS_FLOW_UNSOLICITED_GRANT_SIZE] = new docsis_encoder_ushort(DOCSIS_FLOW_UNSOLICITED_GRANT_SIZE, $value);
- }
- /**
- * Set Nominal Grant Size
- *
- * See Radio Frequency Interface Specification C.2.2.6.7
- *
- * @param int $value
- */
- function set_nominal_grant_size($value)
- {
- $this->value[DOCSIS_FLOW_NOMINAL_GRANT_SIZE] = new docsis_encoder_uint(DOCSIS_FLOW_NOMINAL_GRANT_SIZE, $value);
- }
- /**
- * Set Tolerated Grant Jitter
- *
- * See Radio Frequency Interface Specification C.2.2.6.8
- *
- * @param int $value microseconds
- */
- function set_grant_jitter($value)
- {
- $this->value[DOCSIS_FLOW_GRANT_JITTER] = new docsis_encoder_uint(DOCSIS_FLOW_GRANT_JITTER, $value);
- }
- /**
- * Set Grants per Interval
- *
- * See Radio Frequency Interface Specification C.2.2.6.9
- *
- * @param int $value
- */
- function set_grants_per_interval($value)
- {
- if($value < 0 || $value > 127) trigger_error('Grants per Interval must be 0 to 127', E_USER_WARNING);
- $this->value[DOCSIS_FLOW_GRANTS_PER_INTERVAL] = new docsis_encoder_uchar(DOCSIS_FLOW_GRANTS_PER_INTERVAL, $value);
- }
- /**
- * Set IP Type of Service Overwrite
- *
- * See Radio Frequency Interface Specification C.2.2.6.10
- *
- * @param int $and tos and-mask
- * @param int $or tos or-mask
- */
- function set_tos_mask($and, $or)
- {
- $this->value[DOCSIS_FLOW_TOS_MASK] = new docsis_encoder_string(DOCSIS_FLOW_TOS_MASK, chr($and) . chr($or));
- }
- /**
- * Set Unsolicited Grant Time Reference
- *
- * See Radio Frequency Interface Specification C.2.2.6.11
- *
- * @param int $value timestamp
- */
- function set_unsolicited_grant_time($value)
- {
- $this->value[DOCSIS_FLOW_UNSOLICITED_GRANT_TIME] = new docsis_encoder_uint(DOCSIS_FLOW_UNSOLICITED_GRANT_TIME, $value);
- }
- }
- /**
- * DOCSIS Service Flow Down
- *
- * @package docsis_config
- * @subpackage docsis_flow
- */
- class docsis_flow_down extends docsis_flow
- {
- /**
- * Constructor
- *
- * @param int $code docsis code
- * @param array $value predefined values
- */
- function docsis_flow_down($code=DOCSIS_FLOW_DOWN, $value=array())
- {
- parent::docsis_flow($code, $value);
- }
- /**
- * Set Maximum Downstream Latency
- *
- * See Radio Frequency Interface Specification C.2.2.7.1
- *
- * @param int $value microseconds
- */
- function set_max_down_latency($value)
- {
- $this->value[DOCSIS_FLOW_MAX_DOWN_LATENCY] = new docsis_encoder_uint(DOCSIS_FLOW_MAX_DOWN_LATENCY, $value);
- }
- }
- ?>
Documentation generated on Mon, 14 Nov 2005 18:00:23 -0700 by phpDocumentor 1.3.0RC3