Contiki-NG
Loading...
Searching...
No Matches
resolv.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2002-2003, Adam Dunkels.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote
14 * products derived from this software without specific prior
15 * written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * This file is part of the uIP TCP/IP stack.
30 *
31 *
32 */
33
34/**
35 * \file
36 * uIP DNS resolver code header file.
37 * \author Adam Dunkels <adam@dunkels.com>
38 */
39
40#ifndef RESOLV_H_
41#define RESOLV_H_
42
43#include "contiki.h"
44#include "uip.h"
45
46/**
47 * Event that is broadcasted when a DNS name has been resolved.
48 */
49extern process_event_t resolv_event_found;
50
51enum {
52 /** Hostname is fresh and usable. This response is cached and will eventually
53 * expire to RESOLV_STATUS_EXPIRED.*/
55
56 /** Hostname was not found in the cache. Use resolv_query() to look it up. */
58
59 /** Hostname was found, but it's status has expired. The address returned
60 * should not be used. Use resolv_query() to freshen it up.
61 */
63
64 /** The server has returned a not-found response for this domain name.
65 * This response is cached for the period described in the server.
66 * You may issue a new query at any time using resolv_query(), but
67 * you will generally want to wait until this domain's status becomes
68 * RESOLV_STATUS_EXPIRED.
69 */
71
72 /** This hostname is in the process of being resolved. Try again soon. */
74
75 /** Some sort of server error was encountered while trying to look up this
76 * record. This response is cached and will eventually expire to
77 * RESOLV_STATUS_EXPIRED.
78 */
80};
81
82typedef uint8_t resolv_status_t;
83
84/* Functions. */
85resolv_status_t resolv_lookup(const char *name, uip_ipaddr_t **ipaddr);
86
87void resolv_query(const char *name);
88
89#if RESOLV_CONF_SUPPORTS_MDNS
90void resolv_set_hostname(const char *hostname);
91
92const char *resolv_get_hostname(void);
93#endif
94
95PROCESS_NAME(resolv_process);
96
97#endif /* RESOLV_H_ */
#define PROCESS_NAME(name)
Declare the name of a process.
Definition process.h:287
void resolv_query(const char *name)
Queues a name so that a question for the name will be sent out.
Definition resolv.c:1189
resolv_status_t resolv_lookup(const char *name, uip_ipaddr_t **ipaddr)
Look up a hostname in the array of known hostnames.
Definition resolv.c:1263
process_event_t resolv_event_found
Event that is broadcasted when a DNS name has been resolved.
Definition resolv.c:243
@ RESOLV_STATUS_ERROR
Some sort of server error was encountered while trying to look up this record.
Definition resolv.h:79
@ RESOLV_STATUS_RESOLVING
This hostname is in the process of being resolved.
Definition resolv.h:73
@ RESOLV_STATUS_EXPIRED
Hostname was found, but it's status has expired.
Definition resolv.h:62
@ RESOLV_STATUS_NOT_FOUND
The server has returned a not-found response for this domain name.
Definition resolv.h:70
@ RESOLV_STATUS_CACHED
Hostname is fresh and usable.
Definition resolv.h:54
@ RESOLV_STATUS_UNCACHED
Hostname was not found in the cache.
Definition resolv.h:57
static uip_ipaddr_t ipaddr
Pointer to prefix information option in uip_buf.
Definition uip-nd6.c:116
Header file for the uIP TCP/IP stack.