So welcome back, guys.
In this section of the course, we will going to discuss and understand the concept of Tlvs.
So Tlv stands for type, length and value.
Tlv is a mechanism of packaging the data in a type length value order.
Right.
And the benefits of the Tlv is that that it's a very flexible mechanism to package the data and send
it out to the recipient.
It is easy to add or remove the data.
The concept of TLB requires that there is no need to define any additional key structures in your program.
Right.
And the recipient machine can ignore the data which recipient machine do not understand, and the recipient
machine can selectively process the data which it recognizes.
So you will understand these benefits better once we will be finished up with the concept and do the
assignment.
Those who are already familiar with the concept can straightaway jump to the assignment section.
And those who are listening.
The term TV for the first time.
Please stay with me.
So now let us try to understand the Tlv with the help of an example straight away.
So you can see that the diagram of the right hand side shows three TVs packed together.
This is the first tlv followed by the second tlv and followed by the third tlv.
You can see that in each Tlv there are three parts type length and value.
The type field of the Tlv is one byte.
The length field of the Tlv is one byte, whereas the value field of the Tlv is of variable size.
Each TLB is identified using a unique code called type.
And since we are giving only one byte of space to represent the type value.
Therefore, type field goes from value 0 to 255.
Right.
Similarly, we have taken only one byte of space in order to represent the length.
This length value represents the length of the data which is present in the value part of the TLB.
So in this example, the name Abhishek Sagar is actually 32 bytes long because the length field of the
Tlv is set to 32.
Right.
Similarly, in the second Tlv, the length of the value field is 64 bytes and the length of the value
field in the third Tlv is only eight bytes.
Right.
Now, technically we have defined three types of tlvs here the Tlv type one, type two and type three.
Right.
So you can define these constants in your program and assign a unique integer number to these constants.
Now let us try to understand that.
What is the information?
A given type.
Tell us.
So let us suppose that I define a tlv of type one.
So in this case the Tlv of type one.
Tell me two type of information.
The first information is that that the type of information which is present in the value part of the
tlv is of type string and the length of one unit of data is 32 bytes.
Similarly, the second type of tlv I have defined as website tlv code whose value I have taken it as
two.
And when I say that I have a tlv of type two, it conveys me two types of information.
The first information is that that the data which is present in the value part of the Tlv is of type
string.
And the second information is that that the unit length of this data is 64 bytes.
Similarly, the Tlv of type three tell me two types of information.
The first information is that that the type of the data which is present in the value part of the Tlv
is of type integer and the size of unit data of this tlv is only eight bytes.
So tlv code points that is these values one, two and three gives me two information.
What is the data type of the value?
Is it a string?
Is it integer?
Is it float?
Is it IP address or is it something else?
And the second information that the Tlv type gives me is that that what is the length of one unit of
data present in the value part of the Tlv?
And also note that that the one byte of Tlv type and one byte of tlv length together they are called
tlv overhead.
Right?
And the size of the tlv overhead is two bytes which is constant.
Right.
The type and the length portion of the Tlv is often termed as tlv overhead.
So in the next lecture video we will going to understand more about Tlv using second example.