Browse Source

Added TLV 2.43.5.26 L2VPNID

AdrianSimionov 10 years ago
parent
commit
b897d352c9

+ 1 - 1
src/docsis_common.h

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

+ 5 - 0
src/docsis_decode.c

@@ -63,6 +63,11 @@ void decode_uint (unsigned char *tlvbuf, struct symbol_entry *sym, size_t length
   printf("%s %u;\n", sym->sym_ident, ntohl(helper));
 }
 
+void decode_uint24 (unsigned char *tlvbuf, struct symbol_entry *sym, size_t length)
+{
+  printf("%s %d;\n", sym->sym_ident, tlvbuf[0] * 256 * 256 + tlvbuf[1] * 256 + tlvbuf[2]);
+}
+
 void decode_ushort (unsigned char *tlvbuf, symbol_type *sym, size_t length)
 {
   static unsigned short helper;

+ 1 - 0
src/docsis_decode.h

@@ -30,6 +30,7 @@ struct symbol_entry *find_symbol_by_code_and_pid (unsigned char code, unsigned i
 
 void decode_special (unsigned char *tlvbuf, symbol_type *sym, size_t length);
 void decode_uint (unsigned char *tlvbuf, struct symbol_entry *sym, size_t length );
+void decode_uint24 (unsigned char *tlvbuf, struct symbol_entry *sym, size_t length );
 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 );

+ 16 - 0
src/docsis_encode.c

@@ -70,6 +70,22 @@ int encode_uint ( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
   return ( sizeof(unsigned int));
 }
 
+int encode_uint24 ( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
+{
+  unsigned char byte1, byte2, byte3;
+  union t_val *helper; /* We only use this to cast the void* we receive to what we think it should be */
+
+  helper = (union t_val *) tval;
+  
+  byte1 = (helper->uintval >> (0)) & 0xFF;
+  byte2 = (helper->uintval >> (8)) & 0xFF;
+  byte3 = (helper->uintval >> (16)) & 0xFF;
+
+  memcpy ( buf,&byte3, sizeof(char));
+  memcpy ( buf+sizeof(char),&byte2, sizeof(char));
+  memcpy ( buf+2*sizeof(char),&byte1, sizeof(char));
+  return ( 3 * sizeof(char));
+}
 
 int encode_ushort ( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
 {

+ 1 - 0
src/docsis_encode.h

@@ -26,6 +26,7 @@
 /* each of these returns the length of the value parsed ! */
 
 int encode_uint   	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
+int encode_uint24   	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_ushort 	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_uchar  	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_ip     	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );

+ 2 - 1
src/docsis_symtable.h

@@ -301,6 +301,7 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 440,    "FrameLossMeasurement",              2,      435,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 22.43.5.24.4.2 L2VPN-I13 Annex B.3.24.4.2 */
 { 441,    "FrameLossMeasurementEnable",        1,      440,    (encode_uchar),          (decode_uchar),          0,           1             }, /* TLV 22.43.5.24.4.2.1 L2VPN-I13 Annex B.3.24.4.2.1 */
 { 442,    "FrameLossMeasurementTransmissionPeriodicity", 2, 440, (encode_ushort),       (decode_ushort),         0,           0             }, /* TLV 22.43.5.24.4.2.2 L2VPN-I13 Annex B.3.24.4.2.2 */
+{ 443,    "L2VPNDSID",                         26,     202,    (encode_uint24),         (decode_uint24),         1,           1048575       }, /* TLV 22.43.5.24.4.2.2 L2VPN-I13 Annex B.3.24.4.2.2 */
 { 201,    "VendorIdentifier",                  8,      200,    (encode_hexstr),         (decode_hexstr),         3,           3             }, /* TLV 22.43.8 */
 
 /* TODO: Vendor Specific support in the IEEE802Classifier */
@@ -544,7 +545,7 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 236,    "SNMPv3AccessViewMask",              3,      233,    (encode_hexstr),         (decode_hexstr),         2,           2             }, /* TLV 202.54.3 eRouter-I12 Annex B.4.6.3 */
 { 237,    "SNMPv3AccessViewType",              4,      233,    (encode_uchar),          (decode_uchar),          1,           2             }, /* TLV 202.54.4 eRouter-I12 Annex B.4.6.4 */
 
-/* A little more organized -> Start with 443 */
+/* A little more organized -> Start with 444 */
 
 /* Generic TLV ... we only use the limits, code and length don't matter ...*/
 { 998,    "GenericTLV",                        0,      0,      (encode_nothing),        (decode_special),        0,           0             },

BIN
tests/TLV_22_43_5_26_L2VPNDSID.cm


+ 31 - 0
tests/TLV_22_43_5_26_L2VPNDSID.conf

@@ -0,0 +1,31 @@
+Main 
+{
+	UsPacketClass
+	{
+		ClassifierRef 1;
+		ServiceFlowRef 1;
+		VendorSpecific
+		{
+			VendorIdentifier 0xffffff;
+			L2VPNEncoding
+			{
+				L2VPNDSID 257;
+			}
+		}
+	}
+	NetworkAccess 1;
+	UsServiceFlow
+	{
+		UsServiceFlowRef 1;
+		QosParamSetType 7;
+	}
+	DsServiceFlow
+	{
+		DsServiceFlowRef 2;
+		QosParamSetType 7;
+	}
+	/* CmMic 1118a9d412289e174e22a33eb82f8aa6; */
+	/* CmtsMic 5b501e4da3ef4844ff96cbe2c02ff47a; */
+	/*EndOfDataMkr*/
+	/* Pad */
+}

+ 27 - 0
tests/TLV_22_43_5_26_L2VPNDSID.txt

@@ -0,0 +1,27 @@
+Main 
+{
+UsPacketClass
+{
+ClassifierRef 1;
+ServiceFlowRef 1;
+VendorSpecific
+{
+VendorIdentifier 0xffffff;
+L2VPNEncoding
+{
+L2VPNDSID 257;
+}
+}
+}
+NetworkAccess 1;
+UsServiceFlow
+{
+UsServiceFlowRef 1;
+QosParamSetType 7;
+}
+DsServiceFlow
+{
+DsServiceFlowRef 2;
+QosParamSetType 7;
+}
+}