瀏覽代碼

Added support for vendor specific sub 43 TLVs.

AdrianSimionov 10 年之前
父節點
當前提交
d1caa77164
共有 4 個文件被更改,包括 74 次插入0 次删除
  1. 16 0
      src/docsis_decode.c
  2. 二進制
      tests/tlv43_vendor_specific.cm
  3. 31 0
      tests/tlv43_vendor_specific.conf
  4. 27 0
      tests/tlv43_vendor_specific.txt

+ 16 - 0
src/docsis_decode.c

@@ -37,6 +37,7 @@
 #include "docsis_snmp.h"
 #include "ethermac.h"
 
+extern unsigned int is_vspecific = FALSE;
 
 struct symbol_entry *
 find_symbol_by_code_and_pid (unsigned char code, unsigned int pid)
@@ -325,6 +326,7 @@ void decode_hexstr (unsigned char *tlvbuf, symbol_type *sym, size_t length )
  char *helper;
  unsigned int i;
  unsigned int len;
+ int ff = 0xFF;
 
 /* TODO */
  len =  length;
@@ -336,6 +338,15 @@ void decode_hexstr (unsigned char *tlvbuf, symbol_type *sym, size_t length )
 	printf("%02x", (unsigned char) helper[i]);
  }
  printf(";\n");
+ if (!strncmp (sym->sym_ident, "VendorIdentifier", 16)) {
+   if (ff != tlvbuf[0]) {
+	   if (ff != tlvbuf[1]) {
+		   if (ff != tlvbuf[2]) {
+			   is_vspecific = TRUE;
+		   }
+	   }
+   }
+ }
  free(helper);
 }
 
@@ -425,6 +436,10 @@ void decode_aggregate (unsigned char *tlvbuf, symbol_type *sym, size_t length )
   __docsis_indent(INDENT_NOOP, TRUE);
   current_symbol = find_symbol_by_code_and_pid (cp[0], sym->id);
   tlv_vlen = (size_t) cp[1];
+  /* printf("tlvbuf has value: %01x\n", tlvbuf); */
+  if (is_vspecific == TRUE) {
+	  current_symbol = NULL;
+  }
   if (current_symbol == NULL) {
 		decode_unknown(cp, NULL, tlv_vlen );
   	} else {
@@ -436,6 +451,7 @@ void decode_aggregate (unsigned char *tlvbuf, symbol_type *sym, size_t length )
   __docsis_indent(INDENT_DECREMENT, FALSE);
 
   __docsis_indent(INDENT_NOOP, TRUE);
+  is_vspecific = FALSE;
   printf("}\n");
 }
 

二進制
tests/tlv43_vendor_specific.cm


+ 31 - 0
tests/tlv43_vendor_specific.conf

@@ -0,0 +1,31 @@
+Main 
+{
+	VendorSpecific
+	{
+		VendorIdentifier 0x00407b;
+		GenericTLV TlvCode 4 TlvLength 1 TlvValue 0x00;
+		GenericTLV TlvCode 6 TlvLength 1 TlvValue 0x01;
+	}
+	VendorSpecific
+	{
+		VendorIdentifier 0x000f21;
+		GenericTLV TlvCode 4 TlvLength 1 TlvValue 0x00;
+		GenericTLV TlvCode 6 TlvLength 1 TlvValue 0x01;
+	}
+	VendorSpecific
+	{
+		VendorIdentifier 0x000a73;
+		GenericTLV TlvCode 4 TlvLength 1 TlvValue 0x00;
+		GenericTLV TlvCode 6 TlvLength 1 TlvValue 0x01;
+	}
+	VendorSpecific
+	{
+		VendorIdentifier 0xffffff;
+		CMRangingClassIDExtension 2;
+		CMLoadBalancingGroupID 3;
+	}
+	/* CmMic 3ae43ec5223bc90ecec10761eaf83b4a; */
+	/* CmtsMic 0a2cdd49ed7b1c361a7e9d0a23141e41; */
+	/*EndOfDataMkr*/
+	/* Pad */
+}

+ 27 - 0
tests/tlv43_vendor_specific.txt

@@ -0,0 +1,27 @@
+Main 
+{
+VendorSpecific
+{
+VendorIdentifier 0x00407b;
+GenericTLV TlvCode 4 TlvLength 1 TlvValue 0x00;
+GenericTLV TlvCode 6 TlvLength 1 TlvValue 0x01;
+}
+VendorSpecific
+{
+VendorIdentifier 0x000f21;
+GenericTLV TlvCode 4 TlvLength 1 TlvValue 0x00;
+GenericTLV TlvCode 6 TlvLength 1 TlvValue 0x01;
+}
+VendorSpecific
+{
+VendorIdentifier 0x000a73;
+GenericTLV TlvCode 4 TlvLength 1 TlvValue 0x00;
+GenericTLV TlvCode 6 TlvLength 1 TlvValue 0x01;
+}
+VendorSpecific
+{
+VendorIdentifier 0xffffff;
+CMRangingClassIDExtension 2;
+CMLoadBalancingGroupID 3;
+}
+}