DOCSIS::ConfigFile - Decodes and encodes DOCSIS config files


DOCSIS::ConfigFile is a class which provides functionality to decode and encode DOCSIS (Data over Cable Service Interface Specifications) config files.

This module is used as a layer between any human readable data and the binary structure.

The files are usually served using a TFTP server, after a cable modem or MTA (Multimedia Terminal Adapter) has recevied an IP address from a DHCP server. These files are binary encode using a variety of functions, but all the data in the file are constructed by TLVs (type-length-value) blocks. These can be nested and concatenated.

See the source code or for list of supported parameters.


  use DOCSIS::ConfigFile qw(encode_docsis decode_docsis);

  $data = decode_docsis $bytes;
  $bytes = encode_docsis({
    GlobalPrivacyEnable => 1,
    MaxCPE              => 2,
    NetworkAccess       => 1,
    BaselinePrivacy     => {
      AuthTimeout       => 10,
      ReAuthTimeout     => 10,
      AuthGraceTime     => 600,
      OperTimeout       => 1,
      ReKeyTimeout      => 1,
      TEKGraceTime      => 600,
      AuthRejectTimeout => 60,
      SAMapWaitTimeout  => 1,
      SAMapMaxRetries   => 4
    SnmpMibObject => [
      {oid => "",    INTEGER => 1},
      {oid => "", STRING  => "bootfile.bin"}
    VendorSpecific => {id => "0x0011ee", options => [30 => "0xff", 31 => "0x00", 32 => "0x28"]}


You can install the module to translate between SNMP OID formats. With the module installed, you can define the SnmpMibObject like the example below, instead of using numeric OIDs:

    SnmpMibObject => [
      {oid => "docsDevNmAccessIp.1",     IPADDRESS => ""},
      {oid => "docsDevNmAccessIpMask.1", IPADDRESS => ""},


There is an example web application bundled with this distribution called "Docsisious". To run this application, you need to install Mojolicious and YAML::XS:

  $ curl -L | perl - -M DOCSIS::ConfigFile Mojolicious;

After installing the modules above, you can run the web app like this:

  $ docsisious --listen http://*:8000;

And then open your favorite browser at http://localhost:8000. To see a live demo, you can visit



  $data = decode_docsis($byte_string);
  $data = decode_docsis(\$path_to_file);

Used to decode a DOCSIS config file into a data structure. The output $data can be used as input to "encode_docsis". Note: $data will only contain array-refs if the DOCSIS parameter occur more than once.


  $byte_string = encode_docsis(\%data, \%args);

Used to encode a data structure into a DOCSIS config file. Each of the keys in $data can either hold a hash- or array-ref. An array-ref is used if the same DOCSIS parameter occur multiple times. These two formats will result in the same $byte_string:

  # Only one SnmpMibObject
    SnmpMibObject => {
      oid => "", STRING => "bootfile.bin"

  # Allow one or more SnmpMibObjects
    SnmpMibObject => [
      {oid => "", STRING => "bootfile.bin"}

Possible %args:

  • mta_algorithm

    This argument is required when encoding MTA config files. Can be set to either empty string, "sha1" or "md5".

  • shared_secret

    This argument is optional, but will be used as the shared secret used to increase security between the cable modem and CMTS.


Copyright (C) 2014-2018, Jan Henning Thorsen

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Font Awesome

docsisious bundles Font Awesome.


Jan Henning Thorsen -