Reputation: 27702
These days almost everybody has heard about the HeartBleed exploit.
If you check the code which is the origin of the problem, you can find the following structure:
struct {
HeartbeatMessageType type;
uint16 payload_length;
opaque payload[HeartbeatMessage.payload_length];
opaque padding[padding_length];
} HeartbeatMessage;
It has been a while since the last time I programmed actively on C but I still use it to program little programs or snippets.
The point is that I have never used opaque
and I would like to know what does exactly opaque
stand for.
Upvotes: 3
Views: 770
Reputation: 43662
"Opaque" is often used in commercial and internal/proprietary APIs when you just need to "fill a gap" in a C/C++ declaration.
Since you don't know if that type is a pointer (in that case you would know its size) or an entire structure/class, you can't deduce anything and thus the code serves as a general idea of how the memory is laid out.
They hide information from you. It's a common technique especially used for security measures when there's sensible code like the one you posted above.
Upvotes: 3