For faster navigation, this Iframe is preloading the Wikiwand page for Type-length-value.

Type-length-value

この記事は検証可能参考文献や出典が全く示されていないか、不十分です。 出典を追加して記事の信頼性向上にご協力ください。(このテンプレートの使い方)出典検索?"Type-length-value" – ニュース · 書籍 · スカラー · CiNii · J-STAGE · NDL · dlib.jp · ジャパンサーチ · TWL (2023年7月)

通信プロトコルでは、 省略可能な情報がtype-length-valueTLV、tag-length-valueとも)というフォーマットで表現されることがある。type-length-valueは、情報の種類(type)・長さ(length)・値(value)をセットにして表現するフォーマットである。

type(種類)とlength(長さ)は固定長(通常、1~4バイト)である。value(値)のフィールドは可変長である。各フィールドは以下のように用いられる。

type
情報の種類に対応した数値または文字
length
valueフィールドのサイズ(数値)
value
可変長のデータ

[編集]

「電話をかける」コマンドを例に説明する。

このシステムの最初のバージョン(バージョン1)では、「電話をかける」コマンドには2つの要素、「コマンド」と「宛先電話番号」が想定される。

command_c/4/makeCall_c/phoneNumberToCall_c/8/"722-4246"

ここで、command_cmakeCall_cphoneNumberToCall_cは整数値、4、8はvalueフィールドの長さである。

後のバージョン(バージョン2)で、新たな要素「送信元電話番号」を追加しようとすると、以下のようになる。

command_c/4/makeCall_c/callingNumber_c/14/"1-613-715-9719"/phoneNumberToCall_c/8/"722-4246"

バージョン2のシステムから送信されたメッセージをバージョン1のシステムが受信した場合、まずcommand_c要素を読み取り、次にcallingNumber_c要素を読み取る。バージョン1のシステムはcallingNumber_c要素を理解できないので、lengthフィールド(14)を読み取ってそのバイト数だけスキップし、次のphoneNumberToCall_c要素を読み取る。

上記の例はLink Layer Discovery Protocol(LLDP)である。LLDPでは組織特有の情報をTLV形式でパケットに入れることを許容している。

TLV形式は、COPSIS-ISRADIUSなどでも使われている。

他の表現の形式

[編集]

TCP/IPプロトコルの根幹であるIPTCPUDPでは、固定長フィールドが使われている。

TCP/IPベースのプロトコル、HTTPFTPSMTPPOP3SIPなどは、文字列による「種類: 値」の形式のフォーマットを採用している 。これはRFC 2822を継承するものである。

ASN.1は、TLV形式(BER, DER)と非TLV形式(PER, XER)のフォーマットを並用している。

関連項目

[編集]
{{bottomLinkPreText}} {{bottomLinkText}}
Type-length-value
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?