Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 3 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>liboop: oop_adns_submit(), oop_adns_cancel()</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head><body>

<h2>oop_adns_submit(), oop_adns_cancel()</h2>

<pre>
#include &lt;oop.h&gt;
#include &lt;adns.h&gt;
#include &lt;oop-adns.h&gt;

/* <em>Callback function prototype.</em> */
typedef void *oop_adns_call(oop_adapter_adns *adapter,adns_answer *answer,void *data);

/* <em>Submit an asynchronous DNS query.</em> */
oop_adns_query *oop_adns_submit(
        oop_adapter_adns *adapter,
        const char *owner,adns_rrtype type,adns_queryflags flags,
        oop_adns_call *call,void *user);

/* <em>Cancel a running query.</em> */
void oop_adns_cancel(oop_adns_query *query);
</pre>

<h3>Arguments.</h3>

<dl>
<dt><b>oop_adapter_adns *adns</b>
<dd>The <a href="oop_adns.html">adns adapter</a> to use for the query.<p>

<dt><b>adns_answer *answer</b>
<dd>The answer to the query (status and RR data).  Refer to the adns
documentation for details.<p>

<dt><b>const char *owner</b>
<dd>The DNS domain name to query.<p>

<dt><b>adns_rrtype type</b>
<dd>The DNS Resource Record type to query.  Refer to the adns documentation for
the list of valid RR types.<p>

<dt><b>adns_queryflags flags</b>
<dd>Flags for the DNS query.  Refer to the adns documentation for details.<p>

<dt><b>oop_call_fd *call</b>
<dd>The callback function (event sink) to use for reporting query succcess or
failure.<p>

<dt><b>void *user</b>
<dd>User data passed through to the callback function.<p>

<dt><b>oop_adns_query *query</b>
<dd>The query to cancel.
</dl>

<h3>Description.</h3>

<dl>
<dt><b>oop_adns_submit</b>
<dd>This function begins a DNS query using an adns adapter.  Most of the
parameters are passed directly to adns.  The query will be processed
asynchronously using the event source specified when the adapter was created;
when it completes (successfully or not), the specified callback will be
invoked.<p>

On malloc failure or catastrophic system error, NULL will be returned.
(Simple name resolution errors, such as not finding the name, do not result
in a NULL query; instead, the callback is invoked with an error status.)<p>

The returned pointer is valid (and may be used to cancel the query) until
either the query is cancelled or the callback is invoked (the query
completes).<p>

<dt><b>oop_adns_cancel</b>
<dd>Stop processing a query started with oop_adns_submit (above).  This must
be called with a non-NULL pointer returned from oop_adns_submit before the
query has completed (and the callback function invoked).  Any query may only
be cancelled once.  All resources associated with the query will be
released.<p>

<dt><b>oop_adns_call</b>
<dd>Called when the query completes, successfully or not.  Performs a
user-specific action with the results of the query.  All resources associated
with the query will be released before the function is called, except for the
answer structure itself.  (The user is responsible for freeing the answer
structure, as per the conventions established by adns.  Note that adns does
not use oop_alloc!)  
Should return OOP_CONTINUE if the event loop should continue operating;
any other value (including OOP_HALT) will cause termination of the event loop.
</dl>

<hr><a href="ref.html">liboop reference</a></body></html>