• Stars
    star
    11
  • Rank 1,694,829 (Top 34 %)
  • Language
    Perl
  • Created almost 16 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Perl module that decodes and encodes DOCSIS config-files

NAME

DOCSIS::ConfigFile - Decodes and encodes DOCSIS config files

DESCRIPTION

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 https://thorsen.pm/docsisious for list of supported parameters.

SYNOPSIS

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 => "1.3.6.1.4.1.1.77.1.6.1.1.6.2",    INTEGER => 1},
    {oid => "1.3.6.1.4.1.1429.77.1.6.1.1.6.2", STRING  => "bootfile.bin"}
  ],
  VendorSpecific => {id => "0x0011ee", options => [30 => "0xff", 31 => "0x00", 32 => "0x28"]}
});

OPTIONAL MODULE

You can install the SNMP.pm 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:

encode_docsis({
  SnmpMibObject => [
    {oid => "docsDevNmAccessIp.1",     IPADDRESS => "10.0.0.1"},
    {oid => "docsDevNmAccessIpMask.1", IPADDRESS => "255.255.255.255"},
  ]
});

WEB APPLICATION

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 https://cpanmin.us | perl - -M https://cpan.metacpan.org 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 https://thorsen.pm/docsisious.

FUNCTIONS

decode_docsis

$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.

encode_docsis

$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
encode_docsis({
  SnmpMibObject => {
    oid => "1.3.6.1.4.1.1429.77.1.6.1.1.6.2", STRING => "bootfile.bin"
  }
})

# Allow one or more SnmpMibObjects
encode_docsis({
  SnmpMibObject => [
    {oid => "1.3.6.1.4.1.1429.77.1.6.1.1.6.2", 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 AND LICENSE

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.

CREDITS

Font Awesome

docsisious bundles Font Awesome.

AUTHOR

Jan Henning Thorsen - [email protected]

More Repositories

1

json-validator

👮 Validate data against a JSON schema
Perl
55
star
2

mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
Perl
54
star
3

app-mojopaste

Pastebin
Perl
40
star
4

mojo-mysql

Mojolicious and Async MySQL
Perl
26
star
5

mojo-redis

Non-blocking Redis driver using Mojo::IOLoop
Perl
15
star
6

mojo-irc

IRC Client for the Mojo IOLoop
Perl
13
star
7

mandel

Async model layer for MongoDB objects using Mango
Perl
13
star
8

mojolicious-plugin-webpack

Integrate your mojo app with webpack
Perl
13
star
9

mojo-ioloop-readwritefork

Fork a process and read/write from it
Perl
13
star
10

toadfarm

One Mojolicious app to rule them all
Perl
12
star
11

net-isc-dhcpd

Perl module that interacts with ISC DHCPd
Perl
11
star
12

app-proxyforurl

An online PAC file parser
Perl
10
star
13

dotfiles

collection of scripts
Perl
9
star
14

openapi-client

A client for talking to an Open API powered server
Perl
9
star
15

app-sslmaker

Be your own SSL certificate authority
Perl
8
star
16

app-git-ship

Git command for shipping your project
Perl
7
star
17

applify

Write object oriented scripts with ease
Perl
6
star
18

snmp-effective

An effective SNMP-information-gathering module for perl
Perl
5
star
19

app-docsisious

Edit DOCSIS config files on web
Perl
5
star
20

mojo-snmp

Run SNMP requests with Mojo::IOLoop
Perl
5
star
21

homebridge-tasmota-aircon-http

Control Aircon through Tasmota HTTP commands
JavaScript
4
star
22

plack-middleware-ssi

PSGI middleware for server side include content
Perl
4
star
23

mojolicious-plugin-cgi

Run CGI script from Mojolicious
Perl
4
star
24

w3c-validator-server

Run http://validator.w3c.org as a local instance
Perl
3
star
25

test-mojo-role-selenium

Test::Mojo in a real browser
Perl
3
star
26

dbix-tempdb

Create a temporary database
Perl
3
star
27

rubic

Remote admin tool for ubic
Perl
3
star
28

poe-component-tftpd

A tftp-server, implemented as a POE component
Perl
3
star
29

poe-filter-dhcpd-lease

parses leases from isc dhcpd leases file
Perl
3
star
30

app-prowess

Watch files for changes and re-run prove
Perl
2
star
31

mad-mapper

Map Perl objects to PostgreSQL, MySQL or SQLite data
Perl 6
2
star
32

app-screenorama

Application output to websocket stream
Perl
2
star
33

app-single

An application to run a single instance of a command
Perl
2
star
34

app-mdweb

Markdown webserver
Perl
2
star
35

mojolicious-plugin-urlwith

as url_for(), but preserve query string
Perl
2
star
36

fuse-template

Read the output of templates in a mounted directory
Perl
2
star
37

mojolicious-plugin-syslog

A plugin for enabling a Mojolicious app to log to syslog
Perl
2
star
38

mojo-googleanalytics

Perl
2
star
39

mojolicious-plugin-systemd

Perl
2
star
40

mojolicious-plugin-validatemoose

Validate GET/POST params using Moose class/object
Perl
1
star
41

mojo-run3

Run a subprocess and read/write to it
Perl
1
star
42

mojolicious-plugin-loop

Loop plugin for Mojolicious
Perl
1
star
43

cloudinary

Talk with cloudinary.com using Perl
Perl
1
star
44

app-achart

A program to print ascii charts in the terminal
Perl
1
star
45

mojo-promisify

Convert callback code to promise based code
Perl
1
star
46

moosex-barewords

Does magical stuff with barewords in Moose methods
Perl
1
star
47

mojo-payment

Issue payments with Mojolicious
Perl
1
star
48

dbix-class-schema-diff

Diff two schemas, regardless of version numbers
Perl
1
star
49

mojo-transmission

Client for talking with Transmission BitTorrent daemon
Perl
1
star
50

mojo-tftpd

Trivial File Transfer Protocol daemon
Perl
1
star
51

devel-mojoprof

Profile blocking, non-blocking a promise based Mojolicious APIs
Raku
1
star
52

mojo-log-role-color

Add colors to your mojo logs
Perl
1
star
53

moosex-batmanbeforerobin

Ordered Moose sugar
Perl
1
star
54

getopt-app

Write and test your script with ease
Perl
1
star
55

mojo-tar

Stream tar files
Perl
1
star
56

app-cpantestreport

Simple web page to get CPAN test reports
Perl
1
star
57

mojo-apns

Apple Push Notification Service for Mojolicious
Perl
1
star
58

app-implode

Pack an application into a single runable file
Perl
1
star
59

class-accessor-fast-withbuilder

class-accessor module with _build_foo() default value providers
Perl
1
star
60

mojolicious-plugin-ical

Generate .ical documents
Prolog
1
star