Opened 10 years ago

Closed 8 years ago

#57 closed enhancement (wontfix)

name comparison API

Reported by: each Owned by: UnAssigned
Priority: low Milestone:
Component: libdns++ Version:
Keywords: name api Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket:
Estimated Difficulty: 0.0 Add Hours to Ticket:
Total Hours: Internal?: no

Description

In ticket #48 we discussed the compareNames() function in rdata.cc. I agree with Michael's suggestion that this functionality should be moved into the Name module; the ability to do a strcmp()-style comparison on two names is something we, and other developers, will definitely need, and even though it _can_ be implemented outside the class, it adds unnecessarily to the developer burden. I don't think this is a "kitchen sink" issue, it's just an obvious use case for the Name class.

Also I think other aspects of the API for name comparison aren't quite right. Using NameComparisonResult? to determine whether a name is a subdomain of another name is very cumbersome.

I'd like to propose the following changes:

  • n1.comparison(n2) returning the NameComparisonResult? that Name.compare() currently does. (Or maybe it should be called getComparisonResult(), whatever. I'm actually wondering whether that method should be private.)
  • n1.compare(n2) and/or Name::compare(n1, n2) returning an int, strcmp() style
  • n1.subdomain(n2) and n1.contains(n2) returning bool
  • n1.commonancestor(n2) returns a Name containing the common ancestor
  • ...plus the comparison operators we already have

Subtickets

Change History (5)

comment:1 Changed 10 years ago by each

...also I'm not clear on why we need isWildcard().

comment:2 Changed 10 years ago by shane

  • Component changed from Unclassified to DNSPacket API
  • Milestone set to feature backlog item
  • Owner set to jinmei
  • Priority changed from major to minor
  • Type changed from defect to enhancement

comment:3 Changed 9 years ago by jinmei

  • billable set to 0
  • Internal? unset
  • Owner changed from jinmei to UnAssigned
  • Status changed from new to assigned

comment:4 Changed 9 years ago by stephen

  • Milestone feature backlog item deleted

Milestone feature backlog item deleted

comment:5 Changed 8 years ago by shane

  • Defect Severity set to N/A
  • Resolution set to wontfix
  • Status changed from assigned to closed
  • Sub-Project set to DNS

These change seem reasonable, but we have been using the "old" API for a couple years and it seems not too bad. We can re-open this or create a new ticket to improve the API as necessary.

Note: See TracTickets for help on using tickets.