![]() |
io6Library
WIZnet Dual Stack TCP/IP Ethernet Controller Driver
|
DNS APIs Implement file. More...
Go to the source code of this file.
Data Structures | |
| struct | dhdr |
Macros | |
| #define | INITRTT 2000L /* Initial smoothed response time */ |
| #define | MAXCNAME (MAX_DOMAIN_NAME + (MAX_DOMAIN_NAME>>1)) /* Maximum amount of cname recursion */ |
| #define | TYPE_A 1 /* Host address */ |
| #define | TYPE_NS 2 /* Name server */ |
| #define | TYPE_MD 3 /* Mail destination (obsolete) */ |
| #define | TYPE_MF 4 /* Mail forwarder (obsolete) */ |
| #define | TYPE_CNAME 5 /* Canonical name */ |
| #define | TYPE_SOA 6 /* Start of Authority */ |
| #define | TYPE_MB 7 /* Mailbox name (experimental) */ |
| #define | TYPE_MG 8 /* Mail group member (experimental) */ |
| #define | TYPE_MR 9 /* Mail rename name (experimental) */ |
| #define | TYPE_NULL 10 /* Null (experimental) */ |
| #define | TYPE_WKS 11 /* Well-known sockets */ |
| #define | TYPE_PTR 12 /* Pointer record */ |
| #define | TYPE_HINFO 13 /* Host information */ |
| #define | TYPE_MINFO 14 /* Mailbox information (experimental)*/ |
| #define | TYPE_MX 15 /* Mail exchanger */ |
| #define | TYPE_TXT 16 /* Text strings */ |
| #define | TYPE_AAAA 28 |
| #define | TYPE_ANY 255 /* Matches any type */ |
| #define | CLASS_IN 1 /* The ARPA Internet */ |
| #define | AGAIN 8 /* Average RTT gain = 1/8 */ |
| #define | LAGAIN 3 /* Log2(AGAIN) */ |
| #define | DGAIN 4 /* Mean deviation gain = 1/4 */ |
| #define | LDGAIN 2 /* log2(DGAIN) */ |
| #define | QUERY 0 |
| #define | RESPONSE 1 |
| #define | IQUERY 1 |
| #define | NO_ERROR 0 |
| #define | FORMAT_ERROR 1 |
| #define | SERVER_FAIL 2 |
| #define | NAME_ERROR 3 |
| #define | NOT_IMPL 4 |
| #define | REFUSED 5 |
Functions | |
| uint16_t | get16 (uint8_t *s) |
| uint8_t * | put16 (uint8_t *s, uint16_t i) |
| int | parse_name (uint8_t *msg, uint8_t *compressed, char *buf, int16_t len) |
| uint8_t * | dns_question (uint8_t *msg, uint8_t *cp) |
| uint8_t * | dns_answer (uint8_t *msg, uint8_t *cp, uint8_t *ip_from_dns) |
| int8_t | parseDNSMSG (struct dhdr *pdhdr, uint8_t *pbuf, uint8_t *ip_from_dns) |
| int16_t | dns_makequery (uint16_t op, char *name, uint8_t *buf, uint16_t len, uint8_t type) |
| int8_t | check_DNS_timeout (void) |
| void | DNS_init (uint8_t *buf) |
| int8_t | DNS_run (uint8_t s, uint8_t *dns_ip, uint8_t *name, uint8_t *ip_from_dns, uint8_t mode) |
| void | DNS_time_handler (void) |
Variables | |
| uint8_t * | pDNSMSG |
| uint8_t | DNS_SOCKET |
| uint16_t | DNS_MSGID |
| uint32_t | dns_1s_tick |
| uint8_t | IP_TYPE |
DNS APIs Implement file.
Send DNS query & Receive DNS reponse.
It depends on stdlib.h & string.h in ansi-c library
Copyright (c) 2013, WIZnet Co., LTD. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file dns.c.
| #define MAXCNAME (MAX_DOMAIN_NAME + (MAX_DOMAIN_NAME>>1)) /* Maximum amount of cname recursion */ |
| uint16_t get16 | ( | uint8_t * | s | ) |
Definition at line 127 of file dns.c.
Referenced by dns_answer(), and parseDNSMSG().
| uint8_t* put16 | ( | uint8_t * | s, |
| uint16_t | i | ||
| ) |
Definition at line 136 of file dns.c.
Referenced by dns_makequery().
| int parse_name | ( | uint8_t * | msg, |
| uint8_t * | compressed, | ||
| char * | buf, | ||
| int16_t | len | ||
| ) |
Definition at line 154 of file dns.c.
Referenced by dns_answer(), and dns_question().
| uint8_t* dns_question | ( | uint8_t * | msg, |
| uint8_t * | cp | ||
| ) |
Definition at line 215 of file dns.c.
References MAXCNAME, and parse_name().
Referenced by parseDNSMSG().
| uint8_t* dns_answer | ( | uint8_t * | msg, |
| uint8_t * | cp, | ||
| uint8_t * | ip_from_dns | ||
| ) |
Definition at line 241 of file dns.c.
References get16(), MAXCNAME, parse_name(), TYPE_A, TYPE_AAAA, TYPE_CNAME, TYPE_HINFO, TYPE_MB, TYPE_MG, TYPE_MR, TYPE_MX, TYPE_NS, TYPE_PTR, TYPE_SOA, and TYPE_TXT.
Referenced by parseDNSMSG().
| int8_t parseDNSMSG | ( | struct dhdr * | pdhdr, |
| uint8_t * | pbuf, | ||
| uint8_t * | ip_from_dns | ||
| ) |
Definition at line 355 of file dns.c.
References dhdr::aa, dhdr::ancount, dhdr::arcount, dns_answer(), dns_question(), get16(), dhdr::id, dhdr::nscount, dhdr::opcode, dhdr::qdcount, dhdr::qr, dhdr::ra, dhdr::rcode, dhdr::rd, and dhdr::tc.
| int16_t dns_makequery | ( | uint16_t | op, |
| char * | name, | ||
| uint8_t * | buf, | ||
| uint16_t | len, | ||
| uint8_t | type | ||
| ) |
| int8_t check_DNS_timeout | ( | void | ) |
Definition at line 498 of file dns.c.
References dns_1s_tick, and DNS_WAIT_TIME.
| void DNS_init | ( | uint8_t * | buf | ) |
Definition at line 518 of file dns.c.
References DNS_MSG_ID, DNS_MSGID, and pDNSMSG.
| int8_t DNS_run | ( | uint8_t | s, |
| uint8_t * | dns_ip, | ||
| uint8_t * | name, | ||
| uint8_t * | ip_from_dns, | ||
| uint8_t | mode | ||
| ) |
| void DNS_time_handler | ( | void | ) |
Definition at line 594 of file dns.c.
References dns_1s_tick.
| uint8_t* pDNSMSG |
Definition at line 119 of file dns.c.
Referenced by DNS_init().
| uint16_t DNS_MSGID |
Definition at line 121 of file dns.c.
Referenced by DNS_init(), and dns_makequery().
| uint32_t dns_1s_tick |
Definition at line 123 of file dns.c.
Referenced by check_DNS_timeout(), and DNS_time_handler().
| uint8_t IP_TYPE |
Referenced by dns_makequery().
1.8.17