瀏覽代碼

Added support for TLV 202.53.2.1 decode ONLY.

AdrianSimionov 10 年之前
父節點
當前提交
cbb3a4f43e
共有 4 個文件被更改,包括 18 次插入1 次删除
  1. 1 1
      src/docsis_common.h
  2. 15 0
      src/docsis_decode.c
  3. 1 0
      src/docsis_decode.h
  4. 1 0
      src/docsis_symtable.h

+ 1 - 1
src/docsis_common.h

@@ -31,7 +31,7 @@
 
 
 #ifndef NUM_IDENTIFIERS
-#define NUM_IDENTIFIERS 345
+#define NUM_IDENTIFIERS 346
 #endif /*  NUM_IDENTIFIERS, needed in docsis_symtable.h  */
 
 #define MAXINT 2000000000

+ 15 - 0
src/docsis_decode.c

@@ -109,6 +109,21 @@ void decode_ip6 (unsigned char *tlvbuf, symbol_type *sym, size_t length )
 	sym->sym_ident, inet_ntop(AF_INET6,tlvbuf,ipstr,sizeof ipstr) );
 }
 
+void decode_ip_ip6_port (unsigned char *tlvbuf, symbol_type *sym, size_t length )
+{
+  static struct in_addr ip_addr;
+  if (length == 6 ) {
+    memcpy (&ip_addr, tlvbuf, 4);
+    printf("%s %s:%d;\n", sym->sym_ident, inet_ntoa(ip_addr), tlvbuf[4] * 256 + tlvbuf[5] );
+  }
+  static char ip6_addr[INET6_ADDRSTRLEN];
+  char ipstr[INET6_ADDRSTRLEN];
+  if (length == 18 ) {
+      memcpy (&ip6_addr, tlvbuf, INET6_ADDRSTRLEN);
+      printf("%s %s:%d;\n", sym->sym_ident, inet_ntop(AF_INET6,ip6_addr,ipstr,sizeof ipstr), tlvbuf[16] * 256 + tlvbuf[17] );
+  }
+}
+
 void decode_ether (unsigned char *tlvbuf, symbol_type *sym, size_t length )
 {
 

+ 1 - 0
src/docsis_decode.h

@@ -34,6 +34,7 @@ void decode_ushort (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_uchar (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_ip (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_ip6 (unsigned char *tlvbuf, symbol_type *sym, size_t length );
+void decode_ip_ip6_port (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_ether (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_dual_qtag (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_dual_int (unsigned char *tlvbuf, symbol_type *sym, size_t length );

+ 1 - 0
src/docsis_symtable.h

@@ -431,6 +431,7 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 228,    "SNMPv1v2cCoexistenceConfig",        53,     175,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 202.53 eRouter-I12 Annex B.4.5 */
 { 229,    "SNMPv1v2cCommunityName",            1,      228,    (encode_string),         (decode_string),         0,           0             }, /* TLV 202.53.1 eRouter-I12 Annex B.4.5.1 */
 { 230,    "SNMPv1v2cTransportAddressAccess",   2,      228,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 202.53.2 eRouter-I12 Annex B.4.5.2 */
+{ 340,    "SNMPv1v2cTransportAddress",         1,      230,    (encode_nothing),        (decode_ip_ip6_port),    0,           0             }, /* TLV 202.53.2.1 */
 { 231,    "SNMPv1v2cAccessViewType",           3,      228,    (encode_uchar),          (decode_uchar),          1,           2             }, /* TLV 202.53.3 eRouter-I12 Annex B.4.5.3 */
 { 232,    "SNMPv1v2cAccessViewName",           4,      228,    (encode_string),         (decode_string),         0,           0             }, /* TLV 202.53.4 eRouter-I12 Annex B.4.5.4 */
 { 233,    "SNMPv3AccessViewConfiguration",     54,     175,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 202.54 eRouter-I12 Annex B.4.6 */