Documentation is available at docsis_snmp_v3.php
- <?php
- /**
- * DOCSIS SNMP v3
- *
- * @author David Eder <david@eder.us>
- * @copyright 2004 David Eder
- * @package docsis_config
- * @version .1
- */
- /**
- */
- require_once('docsis_common.php');
- define('DOCSIS_SNMP_V3_KICKSTART', 34);
- define('DOCSIS_SNMP_V3_SECURITY_NAME', 1);
- define('DOCSIS_SNMP_V3_MANAGER_PUBLIC_NUMBER', 2);
- define('DOCSIS_SNMP_V3_TRAP', 38);
- define('DOCSIS_SNMP_V3_TRAP_ADDRESS', 1);
- define('DOCSIS_SNMP_V3_TRAP_PORT', 2);
- define('DOCSIS_SNMP_V3_TRAP_TYPE', 3);
- define('DOCSIS_SNMP_V3_TRAP_TIMEOUT', 4);
- define('DOCSIS_SNMP_V3_TRAP_RETRIES', 5);
- define('DOCSIS_SNMP_V3_TRAP_FILTER', 6);
- define('DOCSIS_SNMP_V3_TRAP_SECURITY_NAME', 7);
- /**
- * DOCSIS SNMP v3 Kickstart
- *
- * @package docsis_config
- * @subpackage docsis_snmp_v3
- */
- class docsis_snmp_v3_kickstart extends docsis_encoder_complex
- {
- /**
- * Constructor
- *
- * @param int $code docsis code
- * @param array $value predefined values
- */
- function docsis_snmp_v3_kickstart($code=DOCSIS_SNMP_V3_KICKSTART, $value=array())
- {
- parent::docsis_encoder_complex($code, $value);
- }
- /**
- * Set Security Name
- *
- * @param string $value
- */
- function set_security_name($value)
- {
- if(strlen($value) < 2 || strlen($value) > 16) trigger_error('Security Name must be 2 to 16 characters', E_USER_WARNING);
- $this->value[DOCSIS_SNMP_V3_SECURITY_NAME] = new docsis_encoder_string(DOCSIS_SNMP_V3_SECURITY_NAME, $value);
- }
- /**
- * Set Manager Public Number
- *
- * This number is the Diffe-Helman public number derived from a privately (by the manager or operator) generated random number and transformed
- * according to RFC-2786. This is reported in the usmDHKickStartTable as usmKickstartMgrPublic. When combined with the object reported in the
- * same row as usmKickstartMyPublicit can be used to derive keys in the related row in the usmUserTable.
- *
- * @param string $value
- */
- function set_manager_public_number($value)
- {
- $this->value[DOCSIS_SNMP_V3_MANAGER_PUBLIC_NUMBER] = new docsis_encoder_hex_string(DOCSIS_SNMP_V3_MANAGER_PUBLIC_NUMBER, $value);
- }
- }
- /**
- * DOCSIS SNMP v3 Notification Receiver
- *
- * @package docsis_config
- * @subpackage docsis_snmp_v3
- */
- class docsis_snmp_v3_trap extends docsis_encoder_complex
- {
- /**
- * Constructor
- *
- * @param int $code docsis code
- * @param array $value predefined values
- */
- function docsis_snmp_v3_trap($code=DOCSIS_SNMP_V3_TRAP, $value=array())
- {
- parent::docsis_encoder_complex($code, $value);
- }
- /**
- * Set IP Address
- *
- * @param string $ip
- */
- function set_address($ip)
- {
- $this->value[DOCSIS_SNMP_V3_TRAP_ADDRESS] = new docsis_encoder_ip(DOCSIS_SNMP_V3_TRAP_ADDRESS, $ip);
- }
- /**
- * Set UDP Port Number
- *
- * @param int $port
- */
- function set_port($port)
- {
- $this->value[DOCSIS_SNMP_V3_TRAP_PORT] = new docsis_encoder_ushort(DOCSIS_SNMP_V3_TRAP_PORT, $port);
- }
- /**
- * Set Type
- *
- * <ul>
- * <li><b>1</b> SNMP v1 trap in an SNMP v1 packet</li>
- * <li><b>2</b> SNMP v2c trap in an SNMP v2c packet</li>
- * <li><b>3</b> SNMP v2c inform in an SNMP v2c packet</li>
- * <li><b>4</b> SNMP v2c trap in an SNMP v3 packet</li>
- * <li><b>4</b> SNMP inform in an SNMP v3 packet</li>
- * </ul>
- *
- * @param int $value
- function set_type($value)
- {
- if($value < 1 || $value > 5) trigger_error('Type must by 1 to 5', E_USER_WARNING);
- $this->value[DOCSIS_SNMP_V3_TRAP_TYPE] = new docsis_encoder_ushort(DOCSIS_SNMP_V3_TRAP_TYPE, $value);
- }
- /**
- * Set Receiver Timeout
- *
- * This specifies the round trip timeout used to wait before sending a retry of an inform notification if sender does not get an
- * acknowledgement from the receiver. Defaults to 15000 if not set.
- *
- * @param int $value in milliseconds
- */
- function set_timeout($value)
- {
- $this->value[DOCSIS_SNMP_V3_TRAP_TIMEOUT] = new docsis_encoder_ushort(DOCSIS_SNMP_V3_TRAP_TIMEOUT, $value);
- }
- /**
- * Set Receiver Retries
- *
- * Defines the number of times to retry an Inform after the first Inform transmission. Defaults to 3.
- *
- * @param int $value
- */
- function set_retries($value)
- {
- if($value < 0 || $value > 255) trigger_error('Retries must by 0 to 255', E_USER_WARNING);
- $this->value[DOCSIS_SNMP_V3_TRAP_RETRIES] = new docsis_encoder_ushort(DOCSIS_SNMP_V3_TRAP_RETRIES, $value);
- }
- /**
- * Set Filtering Parameters
- *
- * Specifies the OID of the snmpTrapOID value that is the root of the MIB subtree that defines all of the notifications to be sent
- * to the Notification Receiver.
- *
- * @param string $oid
- */
- function set_filter($oid)
- {
- $this->value[DOCSIS_SNMP_V3_TRAP_FILTER] = new docsis_encoder_oid(DOCSIS_SNMP_V3_TRAP_FILTER, $oid);
- }
- /**
- * Set Reciever Security Name
- *
- * When Trap of Type value field is set to 1, 2, or 3, this value should not be intrepreted (has no meaning) and Informs messages will be
- * sent with community string "public". In the case of Trap of Type 4 or 5, two situations happent:
- * <ul>
- * <li>If the Security Name is not set, the V3 Notification will be sent in the NoAuthNoPriv security level using security name "@config".</li>
- * <li>If the Security Name is set, $value must be the same as set in the DH Kickstart procedure. The notifications will be sent using
- * the Authenficiation and Privacy Keys calculated by the modem during the DH Kickstart procedure.</li>
- * </ul>
- *
- * @param string $value
- */
- function set_security_name($value)
- {
- if(strlen($value) < 2 || strlen($value) > 16) trigger_error('Security Name must be 2 to 16 characters', E_USER_WARNING);
- $this->value[DOCSIS_SNMP_V3_TRAP_SECURITY_NAME] = new docsis_encoder_string(DOCSIS_SNMP_V3_TRAP_SECURITY_NAME, $value);
- }
- }
- ?>
Documentation generated on Mon, 14 Nov 2005 18:00:32 -0700 by phpDocumentor 1.3.0RC3