Main Page Data Structures File List Data Fields Globals Related Pages

# inet/dns.cpp File Reference

`#include <mem.h>`
`#include <string.h>`
`#include <stdio.h>`
`#include <ctype.h>`
`#include "clib/tcpip.h"`
`#include "inet/dns.h"`

Go to the source code of this file.

## Data Structures
struct | dn_rr_struct
## Defines
#define | DNS_PORT 53
#define | BUFSIZE 600
#define | RRBUF 200
#define | DN_TYPE_A 1
#define | DN_TYPE_NS 2
#define | DN_TYPE_CNAME 5
#define | DN_TYPE_MX 15
#define | DN_CLASS_IN 1
## Typedefs
typedef dn_rr_struct | dn_rr
## Functions
int | dn_uncompress (char *dest, int len, char *packet, char *name)
int | dn_unpackrr (dn_rr *rr, char *packet, char *message)
int | packdomain (char *dest, const char *src)
int | gethostbyname (const char *dnsServerIP, const char *domainName, unsigned long *ttl, unsigned long *IP, char *dest)
## Variables
unsigned int | ident

## Define Documentation

#define BUFSIZE 600

| Definition at line 18 of file dns.cpp. Referenced by gethostbyname().

#define DN_CLASS_IN 1

| Definition at line 37 of file dns.cpp. Referenced by dn_unpackrr(), and gethostbyname().

#define DN_TYPE_A 1

| Definition at line 31 of file dns.cpp. Referenced by dn_unpackrr(), and gethostbyname().

#define DN_TYPE_CNAME 5

| Definition at line 33 of file dns.cpp. Referenced by dn_unpackrr(), and gethostbyname().

#define DN_TYPE_MX 15

| Definition at line 34 of file dns.cpp. Referenced by dn_unpackrr().

#define DN_TYPE_NS 2

| Definition at line 32 of file dns.cpp. Referenced by dn_unpackrr().

#define DNS_PORT 53

| Definition at line 13 of file dns.cpp. Referenced by gethostbyname().

#define RRBUF 200

| Definition at line 20 of file dns.cpp. Referenced by dn_unpackrr().

## Typedef Documentation

typedef struct dn_rr_struct dn_rr

## Function Documentation

int dn_uncompress | ( | char * | dest,
|  | int | len,
|  | char * | packet,
|  | char * | name
| ) |

| Definition at line 88 of file dns.cpp. Referenced by dn_unpackrr().

int dn_unpackrr | ( | dn_rr * | rr,
|  | char * | packet,
|  | char * | message
| ) |

| Definition at line 135 of file dns.cpp. References DN_CLASS_IN, DN_TYPE_A, DN_TYPE_CNAME, DN_TYPE_MX, DN_TYPE_NS, dn_uncompress(), RRBUF, dn_rr_struct::rrclass, dn_rr_struct::rrname, dn_rr_struct::rrrdata, dn_rr_struct::rrttl, and dn_rr_struct::rrtype. Referenced by gethostbyname().

int gethostbyname | ( | const char * | dnsServerIP,
|  | const char * | domainName,
|  | unsigned long * | ttl,
|  | unsigned long * | IP,
|  | char * | dest
| ) |

| Definition at line 226 of file dns.cpp. References AF_INET, API_ERROR, api_sleep(), BUFSIZE, closesocket(), DN_CLASS_IN, DN_TYPE_A, DN_TYPE_CNAME, dn_unpackrr(), DNS_PORT, htons(), ident, inet_addr(), InetToAscii(), MSG_BLOCKING, MSG_TIMEOUT, opensocket(), packdomain(), recvfrom(), dn_rr_struct::rrclass, dn_rr_struct::rrname, dn_rr_struct::rrrdata, dn_rr_struct::rrttl, dn_rr_struct::rrtype, in_addr::s_addr, sendto(), sockaddr_in::sin_addr, sockaddr_in::sin_family, sockaddr_in::sin_port, and SOCK_DGRAM. Referenced by http_connect(), and http_get().

int packdomain | ( | char * | dest,
|  | const char * | src
| ) | `[static]`

| Definition at line 189 of file dns.cpp. References src. Referenced by gethostbyname().

## Variable Documentation

unsigned int ident`[static]`

| Definition at line 16 of file dns.cpp. Referenced by gethostbyname().