Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an opaque byte string?

Tags:

c++

c

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. See Section 3.1 for discussion.

like image 703
sjobe Avatar asked Apr 30 '11 02:04

sjobe


2 Answers

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).

like image 100
Seva Alekseyev Avatar answered Sep 21 '22 16:09

Seva Alekseyev


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".

like image 25
Richard Brightwell Avatar answered Sep 18 '22 16:09

Richard Brightwell