Opened 5 years ago
#6778 enhancement new
Provide dns Message and EDNSMessage constructors which accept FlagConstants and ValueConstants
Reported by: | Richard Wall | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | names | Keywords: | |
Cc: | Branch: | ||
Author: |
Description
In ticket:5675#comment:16 exarkun wrote:
- Earlier you mentioned an idea about improving the handling of these numerous flags. I think that's a good idea to pursue. Consider this idea (not necessarily for this ticket, since making these APIs private means we have plenty of time to improve them with follow-up work) -
__init__
should accept aFlagConstant
collapsing as many of these flags as possible (looks like there are 8 parameters that would all combine into 1) into a single value. We could also think about whetheropCode
,rCode
, andednsVersion
merit more special handling (perhaps aValues
constant instead ofint
) and For compatibility,_EDNSMessage
can also:
- provide an alternate constructor with a signature more like its current
__init__
signature - this would be an API more like a drop-in replacement forMessage.__init__
. This can also include whatever extra safety checks seem useful to help developers avoid subtle mistakes (though hopefully we can also encourage them to switch to the nicer API).
Note: See
TracTickets for help on using
tickets.