开发者

What is an opaque byte string?

I've been gooling for a while, but I found nothing too helpful. What is an opaque byte string and what would be a c/c++ example of it ?

Update A little more context, from rfc5001

2.3. The NSID Option The OPTION-CODE for the NSID option is 3. The OPTION-DATA for the NSID option is an opaque byte string, the semantics of which are deliberately left outside the protocol. 开发者_Go百科 See Section 3.1 for discussion.


They probably mean a byte array of unspecified format. By "opaque" they mean that the inner structure exists, but is unknown. So the program is expected to treat the string as a whole - store it, transmit it, but not try to interpret.

The C++ example would be an instance of std::vector<unsigned char>. A C example would be an array of unsigned char (either dynamic AKA malloc'ated or static).


From https://www.rfc-editor.org/rfc/rfc2608:

Opaque values are sequences of bytes. These are distinguished from Strings since they begin with the sequence "\FF". This, unescaped, is an illegal UTF-8 encoding, indicating that what follows is a sequence of bytes expressed in escape notation which constitute the binary value. For example, a '0' byte is encoded "\FF\00".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜