Comment 55 for bug 308181

Revision history for this message
In , Tom-germeau (tom-germeau) wrote :

(In reply to comment #51)
> (From update of attachment 242044 [edit])
> Can you please document the API proposed for nsIDNSService?
>

what about this?
This approach adds 2 methods and an interface per record type.
I added SRV and TXT as examples. The old A record stays untouched.

interface nsIDNSService : nsISupports
{
    /* TXT Record */
    nsIDNSTXTListener resolveTXT(in AUTF8String aHostName);

    nsICancelable asyncResolveTXT(in AUTF8String aHostName,
                                  in nsIDNSTXTListener aListener,
                                  in nsIEventTarget aListenerTarget);
    /* SRV Record */
    nsIDNSSRVListener resolveSRV(in AUTF8String aHostName,
                                 in AUTF8String aService,
                                 in AUTF8String aProtocol);

    nsICancelable asyncResolveSRV(in AUTF8String aHostName,
                                  in AUTF8String aService,
                                  in AUTF8String aProtocol,
                                  in nsIDNSSRVListener aListener,
                                  in nsIEventTarget aListenerTarget);
    /* A Record (unchanged) */
    nsICancelable asyncResolve(in AUTF8String aHostName,
                               in unsigned long aFlags,
                               in nsIDNSListener aListener,
                               in nsIEventTarget aListenerTarget);

    nsIDNSRecord resolve(in AUTF8String aHostName,
                         in unsigned long aFlags);
};

interface nsIDNSTXTRecord : nsISupports
{
    readonly attribute ACString text;
    boolean hasMore();
    void rewind();
};

interface nsIDNSSRVRecord : nsISupports
{
    /* weight and priority are just informational because
     * nsIDNSSRVRecord sorts the records beforehand
     */
    readonly attribute long weight;
    readonly attribute long priority;
    readonly attribute ACString host;
    boolean hasMore();
    void rewind();
};