如何解码/编码电缆调制解调器配置文件?

时间:2019-06-21 15:04:51

标签: binaryfiles tlv

我目前正在研究DOCSIS及其相关的一些内部功能。我苦苦挣扎的一件事是如何制作电缆调制解调器配置文件。

根据我收集到的信息:

  • CM配置是基于TLV格式的二进制文件。
  • 这些配置是使用TFTP服务器部署的,在启动时会通过DHCP提示调制解调器本身。

我有兴趣了解这些配置文件的结构。除了过去几天阅读的内容外,我几乎不了解TLV。

  • TLV只是将数据串在一起的通用方法吗?似乎TLV既以二进制形式使用,又以类似json的明文字符串形式使用。
  • TLV的T和/或L部分是否已设置大小(以字节为单位)?我怎么知道它们分开的地方?
  • 我想我读到某个地方,CM配置使用TLV的子集TLV-BER。如果我没记错的话,这会增加对TLV嵌套的支持。如何运作?

我听说DOCSIS在CableLabs上有据可查,但是我还无法找到此信息。有用的链接表示赞赏。

我拥有一个二进制配置文件,可以使用在线工具进行解码,但是假设我要为此目的制作自己的工具,我将如何处理?

编辑:这是二进制文件的前64个字节的摘录,以供参考。

03010112 01021916 08040668 51E00601 07070104 01020065 09040000 17C8181D 
08040203 A0000904 00001F40 0E021F40 01020001 0F010207 01040601 07270101

2 个答案:

答案 0 :(得分:1)

03 01 01              ;  3 - Network access control: ON
12 01 02              ; 18 - Max Number of CPEs: 2
19 16                 ; 25 - Downstream service flow
   08 04 06 68 51 E0  ;    25.8  - Maximum Sustained Traffic Rate
   06 01 07           ;    25.6  - Quality of Service Parameter Set Type: prov/adm/active
   07 01 04           ;    25.7  - Traffic Priority: 4
   01 02 00 65        ;    25.1  - Service Flow Reference or ASF Reference: 65
   09 04 00 00 17 C8  ;    25.9  - Maximum Traffic Burst: 6,088
18 1D                 ; 24 - Upstream service flow
   08 04 02 03 A0 00  ;    24.8  - Maximum Sustained Traffic Rate: 33,792,000
   09 04 00 00 1F 40  ;    24.9  - Maximum Traffic Burst: 8,000
   0E 02 1F 40        ;    24.14 - Maximum Concatenated Burst: 8,000
   01 02 00 01        ;    24.1  - Service Flow Reference or ASF Reference: 1
   0F 01 02           ;    24.15 - Service Flow Scheduling Type: 2
   07 01 04           ;    24.7  - Traffic Priority: 4
   06 01 07           ;    24.6  - QOS: 0x07 (prov|adm|active)
27 01 01              ; 39 - Enable 2.0 Mode: ON

enter image description here

类型

Type      Description                                                Spec Defined
========  =========================================================  ============
0         Pad                                                        DOCSIS 1.0
1         Downstream Frequency                                       DOCSIS 1.0
2         Upstream Channel ID                                        DOCSIS 1.0
3         Network Access Control Object                              DOCSIS 1.0
4         DOCSIS 1.0 Class of Service                                DOCSIS 1.0
5         Modem Capabilities Encoding                                DOCSIS 1.0
6         CM Message Integrity Check (MIC)                           DOCSIS 1.0
7         CMTS Message Integrity Check (MIC)                         DOCSIS 1.0
8         Vendor ID Encoding                                         DOCSIS 1.0
9         SW Upgrade Filename                                        DOCSIS 1.0
10        SNMP Write Access Control                                  DOCSIS 1.0
11        SNMP MIB Object                                            DOCSIS 1.0
12        Modem IP Address                                           DOCSIS 1.0
13        Service(s) Not Available Response                          DOCSIS 1.0
14        CPE Ethernet MAC Address                                   DOCSIS 1.0
15        Telephone Settings Option (deprecated)                     DOCSIS 1.0
17        Baseline Privacy (Security)                                DOCSIS 1.0
18        Max Number of CPEs                                         DOCSIS 1.0
19        TFTP Server Timestamp                                      DOCSIS 1.0
20        TFTP Server Provisioned Modem IPv4 Address                 DOCSIS 1.0
21        SW Upgrade IPv4 TFTP Server                                DOCSIS 1.0
22        Upstream Packet Classification                             DOCSIS 1.1
23        Downstream Packet Classification                           DOCSIS 1.1
24        Upstream SF                                                DOCSIS 1.1
25        Downstream SF (11.4)                                       DOCSIS 1.1
26        Payload Header Suppression                                 DOCSIS 1.1
27        HMAC-Digest                                                DOCSIS 3.1
28        Maximum Number of Classifiers                              DOCSIS 1.1
29        Privacy Enable                                             DOCSIS 1.1
30        Authorization Block                                        DOCSIS 1.1
31        Key Sequence Number                                        DOCSIS 1.1
32        Manufacturer Code Verification Certificate                 DOCSIS 1.1
33        Co-Signer Code Verification Certificate                    DOCSIS 1.1
34        SNMPv3 Kickstart Value                                     DOCSIS 1.1
35        Subscriber Mgmt Control                                    DOCSIS 1.1
36        Subscriber Mgmt CPE IPv4 List                              DOCSIS 1.1
37        Subscriber Mgmt Filter Groups                              DOCSIS 1.1
38        SNMPv3 Notification Receiver                               DOCSIS 1.1
39        Enable 2.0 Mode                                            DOCSIS 2.0
40        Enable Test Modes                                          DOCSIS 2.0
41        Downstream Channel List                                    DOCSIS 2.0
42        Static Multicast MAC Address                               DOCSIS 2.0
43        DOCSIS Extension Field                                     DOCSIS 1.0
44        Vendor Specific Capabilities                               DOCSIS 1.0
45        Downstream Unencrypted Traffic (DUT) Filtering             DOCSIS 2.0
46        Transmit Channel Configuration (TCC)                       DOCSIS 3.0
47        Service Flow SID Cluster Assignment                        DOCSIS 3.0
48        Receive Channel Profile                                    DOCSIS 3.0
49        Receive Channel Configuration                              DOCSIS 3.0
50        DSID Encodings                                             DOCSIS 3.0
51        Security Association Encoding                              DOCSIS 3.0
52        Initializing Channel Timeout                               DOCSIS 3.0
53        SNMPv1v2c Coexistence                                      DOCSIS 3.0
54        SNMPv3 Access View Configuration                           DOCSIS 3.0
55        SNMP CPE Access Control                                    DOCSIS 3.0
56        Channel Assignment Configuration Settings                  DOCSIS 3.0
57        CM Initialization Reason                                   DOCSIS 3.0
58        SW Upgrade IPv6 TFTP Server                                DOCSIS 3.0
59        TFTP Server Provisioned Modem IPv6 Address                 DOCSIS 3.0
60        Upstream Drop Packet Classification                        DOCSIS 3.0
61        Subscriber Mgmt CPE IPv6 Prefix List                       DOCSIS 3.0
62        Upstream Drop Classifier Group ID                          DOCSIS 3.0
63        Subscriber Mgmt Control Max CPE IPv6 Prefix                DOCSIS 3.0
64        CMTS Static Multicast Session Encoding                     DOCSIS 3.0
65        L2VPN MAC Aging Encoding                                   DOCSIS 2.0
66        Management Event Control Encoding                          DOCSIS 3.0
67        Subscriber Mgmt CPE IPv6 Prefix List                       DOCSIS 3.0
68        Default Upstream Target Buffer Configuration               DOCSIS 3.0
69        MAC Address Learning Control Encoding                      DOCSIS 3.0
70        Upstream Aggregate Service Flow Encodings                  DPoE 2.0
71        Downstream Aggregate Service Flow Encodings                DPoE 2.0
72        Metro Ethernet Service Profile                             DPoE 2.0
73        Network Timing Profile                                     DPoE 2.0
74        Energy Management Parameter Encoding                       DOCSIS 3.0
75        Energy Mgt. Mode Indicator                                 DOCSIS 3.1
76        Energy Mgt. Identifier List for CM                         DOCSIS 3.1
77        DOCSIS Time Protocol Enable                                DOCSIS 3.1
78        AQM Disable                                                DOCSIS 3.1
79        UNI Control Encoding                                       DOCSIS 3.0
80        Energy Management – DOCSIS Light Sleep Encodings           DOCSIS 3.1
81        Manufacturer CVC Chain                                     DOCSIS 3.1
82        Co-signer CVC Chain                                        DOCSIS 3.1
83        L2CP Management                                            DPoE 2.0
201-231   eCM eSAFE Configuration File TLVs
201       ePS
202       eRouter                                                    eRouter
203-215   Reserved
216       eMTA                                                       PacketCable 1.x
217       eSTB                                                       DSG
218       Reserved
219       eTEA                                                       TEI
220       eDVA                                                       PacketCable 2.0
221       eSG                                                        SMA gateway
222-231   Reserved
255       End-of-Data                                                DOCSIS 1.0

奖金阅读

答案 1 :(得分:0)

您的HEX转储似乎没有使用ASN.1 BER编码。它是TLV编码,标签字段为1字节长度,长度字段为1字节十六进制值。 标签0x16、0x18和0x1F似乎是构造的模板,其中包含另一组标签。 在文档中查找“标记值”的含义。

以下是使用T-L-V分离形式进行解析的示例:

03-01-01
12-01-02
19-16 // template?
   08-04-066851E0
   06-01-07
   07-01-04
   01-02-0065
   09-04-000017C8
18-1D // template?
  08-04-0203A000
  09-04-0000
  1F-40 // template?
    0E-02-1F40
    01-02-0001
    0F-01-02
    07-01-04
    06-01-07
    27-01-01
    ...example cut here