WEBVTT

00:05.290 --> 00:07.000
So welcome back, guys.

00:07.000 --> 00:12.310
In this section of the course, we will going to discuss and understand the concept of Tlvs.

00:12.310 --> 00:15.550
So Tlv stands for type, length and value.

00:15.700 --> 00:21.400
Tlv is a mechanism of packaging the data in a type length value order.

00:21.430 --> 00:22.150
Right.

00:22.150 --> 00:29.230
And the benefits of the Tlv is that that it's a very flexible mechanism to package the data and send

00:29.230 --> 00:30.790
it out to the recipient.

00:30.820 --> 00:33.790
It is easy to add or remove the data.

00:33.880 --> 00:41.890
The concept of TLB requires that there is no need to define any additional key structures in your program.

00:41.890 --> 00:42.790
Right.

00:42.790 --> 00:49.600
And the recipient machine can ignore the data which recipient machine do not understand, and the recipient

00:49.600 --> 00:54.460
machine can selectively process the data which it recognizes.

00:55.020 --> 01:02.100
So you will understand these benefits better once we will be finished up with the concept and do the

01:02.100 --> 01:03.120
assignment.

01:03.570 --> 01:09.420
Those who are already familiar with the concept can straightaway jump to the assignment section.

01:10.650 --> 01:12.300
And those who are listening.

01:12.300 --> 01:14.250
The term TV for the first time.

01:14.250 --> 01:15.870
Please stay with me.

01:15.900 --> 01:20.460
So now let us try to understand the Tlv with the help of an example straight away.

01:20.580 --> 01:26.460
So you can see that the diagram of the right hand side shows three TVs packed together.

01:26.760 --> 01:33.420
This is the first tlv followed by the second tlv and followed by the third tlv.

01:33.690 --> 01:39.570
You can see that in each Tlv there are three parts type length and value.

01:40.020 --> 01:43.200
The type field of the Tlv is one byte.

01:43.230 --> 01:50.490
The length field of the Tlv is one byte, whereas the value field of the Tlv is of variable size.

01:52.910 --> 01:58.040
Each TLB is identified using a unique code called type.

01:58.730 --> 02:04.040
And since we are giving only one byte of space to represent the type value.

02:04.070 --> 02:08.690
Therefore, type field goes from value 0 to 255.

02:08.690 --> 02:09.350
Right.

02:09.380 --> 02:14.870
Similarly, we have taken only one byte of space in order to represent the length.

02:14.900 --> 02:21.530
This length value represents the length of the data which is present in the value part of the TLB.

02:23.210 --> 02:30.260
So in this example, the name Abhishek Sagar is actually 32 bytes long because the length field of the

02:30.260 --> 02:32.180
Tlv is set to 32.

02:32.210 --> 02:32.950
Right.

02:32.960 --> 02:40.820
Similarly, in the second Tlv, the length of the value field is 64 bytes and the length of the value

02:40.820 --> 02:44.020
field in the third Tlv is only eight bytes.

02:44.030 --> 02:44.750
Right.

02:45.740 --> 02:55.700
Now, technically we have defined three types of tlvs here the Tlv type one, type two and type three.

02:55.730 --> 02:56.390
Right.

02:56.390 --> 03:03.590
So you can define these constants in your program and assign a unique integer number to these constants.

03:04.430 --> 03:06.410
Now let us try to understand that.

03:06.410 --> 03:08.210
What is the information?

03:08.240 --> 03:10.030
A given type.

03:10.070 --> 03:11.210
Tell us.

03:11.600 --> 03:15.830
So let us suppose that I define a tlv of type one.

03:16.010 --> 03:19.520
So in this case the Tlv of type one.

03:19.520 --> 03:21.270
Tell me two type of information.

03:21.290 --> 03:27.260
The first information is that that the type of information which is present in the value part of the

03:27.260 --> 03:33.740
tlv is of type string and the length of one unit of data is 32 bytes.

03:34.340 --> 03:41.930
Similarly, the second type of tlv I have defined as website tlv code whose value I have taken it as

03:41.930 --> 03:42.650
two.

03:42.650 --> 03:48.260
And when I say that I have a tlv of type two, it conveys me two types of information.

03:48.470 --> 03:54.770
The first information is that that the data which is present in the value part of the Tlv is of type

03:54.770 --> 03:55.460
string.

03:55.760 --> 04:01.910
And the second information is that that the unit length of this data is 64 bytes.

04:02.710 --> 04:07.210
Similarly, the Tlv of type three tell me two types of information.

04:07.300 --> 04:12.640
The first information is that that the type of the data which is present in the value part of the Tlv

04:12.670 --> 04:20.470
is of type integer and the size of unit data of this tlv is only eight bytes.

04:21.230 --> 04:27.530
So tlv code points that is these values one, two and three gives me two information.

04:27.530 --> 04:29.600
What is the data type of the value?

04:29.600 --> 04:30.500
Is it a string?

04:30.500 --> 04:31.520
Is it integer?

04:31.520 --> 04:32.330
Is it float?

04:32.330 --> 04:35.450
Is it IP address or is it something else?

04:35.480 --> 04:42.830
And the second information that the Tlv type gives me is that that what is the length of one unit of

04:42.830 --> 04:45.680
data present in the value part of the Tlv?

04:45.920 --> 04:54.680
And also note that that the one byte of Tlv type and one byte of tlv length together they are called

04:54.710 --> 04:56.000
tlv overhead.

04:56.000 --> 04:56.600
Right?

04:56.600 --> 05:00.770
And the size of the tlv overhead is two bytes which is constant.

05:00.770 --> 05:01.520
Right.

05:01.760 --> 05:07.720
The type and the length portion of the Tlv is often termed as tlv overhead.

05:07.730 --> 05:13.460
So in the next lecture video we will going to understand more about Tlv using second example.
