DOCSIS Config is a php library to encode binary configuration files for DOCSIS cable modems.
docsis_config.tgz requires:
Check out DOCSIS config file encoder for an alternate encoder. This can also decode.
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'docsis_config.php');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'docsis_firewall.php');
// set flag for snmp length encoding to short int for Cisco software compatibility
define('SNMP_SHORT_INT_LENGTH', 1);
$bf = new docsis_config();
$bf->set_network_access(1);
$cs = new docsis_class_of_service();
$cs->set_id(1);
$cs->set_max_rate_down(262144);
$cs->set_max_rate_up(131072);
$cs->set_priority_up(1);
$cs->set_privacy_enable(1);
$bf->add_class_of_service($cs);
$bp = new docsis_baseline_privacy();
$bp->set_auth_timeout(10);
$bp->set_reauth_timeout(10);
$bp->set_auth_grace(600);
$bp->set_op_timeout(10);
$bp->set_rekey_timeout(10);
$bp->set_tek_grace_timeout(600);
$bp->set_auth_reject_timeout(60);
$bf->set_baseline_privacy($bp);
$bf->set_max_cpes(3);
// see docsis_firewall.php for examples of $bf->add_snmp_object
$fw = new docsis_firewall();
$fw->add_filter(SOL_TCP, 137, 139); // chop off windows ports
$fw->add_filter(SOL_UDP, 137, 139);
$fw->write($bf);
$fp = fopen('mybootfile.cm', 'w');
fputs($fp, $bf->encode('this is my secret key'));
fclose($fp);
?>