Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 3 | magnus | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 | <html><head> |
||
| 3 | <title>liboop: oop_adns_submit(), oop_adns_cancel()</title> |
||
| 4 | <link rel="stylesheet" type="text/css" href="style.css"> |
||
| 5 | </head><body> |
||
| 6 | |||
| 7 | <h2>oop_adns_submit(), oop_adns_cancel()</h2> |
||
| 8 | |||
| 9 | <pre> |
||
| 10 | #include <oop.h> |
||
| 11 | #include <adns.h> |
||
| 12 | #include <oop-adns.h> |
||
| 13 | |||
| 14 | /* <em>Callback function prototype.</em> */ |
||
| 15 | typedef void *oop_adns_call(oop_adapter_adns *adapter,adns_answer *answer,void *data); |
||
| 16 | |||
| 17 | /* <em>Submit an asynchronous DNS query.</em> */ |
||
| 18 | oop_adns_query *oop_adns_submit( |
||
| 19 | oop_adapter_adns *adapter, |
||
| 20 | const char *owner,adns_rrtype type,adns_queryflags flags, |
||
| 21 | oop_adns_call *call,void *user); |
||
| 22 | |||
| 23 | /* <em>Cancel a running query.</em> */ |
||
| 24 | void oop_adns_cancel(oop_adns_query *query); |
||
| 25 | </pre> |
||
| 26 | |||
| 27 | <h3>Arguments.</h3> |
||
| 28 | |||
| 29 | <dl> |
||
| 30 | <dt><b>oop_adapter_adns *adns</b> |
||
| 12 | magnus | 31 | <dd>The <a href="oop_adns.html">adns adapter</a> to use for the query.<p> |
| 3 | magnus | 32 | |
| 33 | <dt><b>adns_answer *answer</b> |
||
| 34 | <dd>The answer to the query (status and RR data). Refer to the adns |
||
| 35 | documentation for details.<p> |
||
| 36 | |||
| 37 | <dt><b>const char *owner</b> |
||
| 38 | <dd>The DNS domain name to query.<p> |
||
| 39 | |||
| 40 | <dt><b>adns_rrtype type</b> |
||
| 41 | <dd>The DNS Resource Record type to query. Refer to the adns documentation for |
||
| 42 | the list of valid RR types.<p> |
||
| 43 | |||
| 44 | <dt><b>adns_queryflags flags</b> |
||
| 45 | <dd>Flags for the DNS query. Refer to the adns documentation for details.<p> |
||
| 46 | |||
| 47 | <dt><b>oop_call_fd *call</b> |
||
| 48 | <dd>The callback function (event sink) to use for reporting query succcess or |
||
| 49 | failure.<p> |
||
| 50 | |||
| 51 | <dt><b>void *user</b> |
||
| 52 | <dd>User data passed through to the callback function.<p> |
||
| 53 | |||
| 54 | <dt><b>oop_adns_query *query</b> |
||
| 55 | <dd>The query to cancel. |
||
| 56 | </dl> |
||
| 57 | |||
| 58 | <h3>Description.</h3> |
||
| 59 | |||
| 60 | <dl> |
||
| 61 | <dt><b>oop_adns_submit</b> |
||
| 62 | <dd>This function begins a DNS query using an adns adapter. Most of the |
||
| 63 | parameters are passed directly to adns. The query will be processed |
||
| 64 | asynchronously using the event source specified when the adapter was created; |
||
| 65 | when it completes (successfully or not), the specified callback will be |
||
| 66 | invoked.<p> |
||
| 67 | |||
| 68 | On malloc failure or catastrophic system error, NULL will be returned. |
||
| 69 | (Simple name resolution errors, such as not finding the name, do not result |
||
| 70 | in a NULL query; instead, the callback is invoked with an error status.)<p> |
||
| 71 | |||
| 72 | The returned pointer is valid (and may be used to cancel the query) until |
||
| 73 | either the query is cancelled or the callback is invoked (the query |
||
| 74 | completes).<p> |
||
| 75 | |||
| 76 | <dt><b>oop_adns_cancel</b> |
||
| 77 | <dd>Stop processing a query started with oop_adns_submit (above). This must |
||
| 78 | be called with a non-NULL pointer returned from oop_adns_submit before the |
||
| 79 | query has completed (and the callback function invoked). Any query may only |
||
| 80 | be cancelled once. All resources associated with the query will be |
||
| 81 | released.<p> |
||
| 82 | |||
| 83 | <dt><b>oop_adns_call</b> |
||
| 84 | <dd>Called when the query completes, successfully or not. Performs a |
||
| 85 | user-specific action with the results of the query. All resources associated |
||
| 86 | with the query will be released before the function is called, except for the |
||
| 87 | answer structure itself. (The user is responsible for freeing the answer |
||
| 88 | structure, as per the conventions established by adns. Note that adns does |
||
| 89 | not use oop_alloc!) |
||
| 90 | Should return OOP_CONTINUE if the event loop should continue operating; |
||
| 91 | any other value (including OOP_HALT) will cause termination of the event loop. |
||
| 92 | </dl> |
||
| 93 | |||
| 12 | magnus | 94 | <hr><a href="ref.html">liboop reference</a></body></html> |