[bind10-dev] DNS message API: how to handle to-be-truncated case
JINMEI Tatuya / 神明達哉
jinmei at isc.org
Wed Sep 30 00:46:05 UTC 2009
At Wed, 30 Sep 2009 00:31:24 +0000,
Evan Hunt <each at isc.org> wrote:
> > A performance-sensitive client code that must expect truncation should
> > still be pretty simple:
> > message.allow_truncation();
> > message.to_wire(); // always succeed. it may be an incomplete msg with TC
> > message.sendto(somewhere);
>
> This seems reasonable to me. How does the caller find out the message was
> incomplete, though?
In this context, the caller doesn't bother to know that:-). But when
a caller explicitly needs to do something based on whether the message
is complete or not, it would be able to possible by checking the TC
flag:
if (message.get_tc()) { // returns true if TC is set
// message is truncated. do something special.
}
> (Side note: Doesn't "message.sendto()" kind of imply that the message has
> to be converted to wire format first? I'm not sure why it has to be two
> steps. Could the sendto() routine simply call to_wire() when it was
> needed?)
Hmm, I see the point, we may want to allow that shortcut. Although
the above example is only for highlighting the point and the "message"
object I'm current thinking won't actually have a "sendto" method,
I'll keep this point in my mind.
Thanks,
---
JINMEI, Tatuya
More information about the bind10-dev
mailing list