alias_dns.c revision 9b01bee27b96e4ea6120afb6729895e51a1d9f90
#ifndef RT_OS_WINDOWS
# include <netdb.h>
#endif
# include <slirp.h>
# include "alias.h"
# include "alias_local.h"
# include "alias_mod.h"
#define DNS_CONTROL_PORT_NUMBER 53
/* see RFC 1035(4.1.1) */
union dnsmsg_header
{
struct {
uint16_t Z:3;
} X;
};
struct dnsmsg_answer
{
};
/* see RFC 1035(4.1) */
static int
{
return (-1);
return (0);
return (-1);
}
static void doanswer(struct libalias *la, union dnsmsg_header *hdr,char *qname, struct ip *pip, struct hostent *h)
{
int i;
if (h == NULL)
{
}
else
{
/*!!! We need to be sure that */
char *query;
char *answers;
char **cstr;
char *c;
uint16_t packet_len = 0;
Assert((m));
#if 0
/*here is no compressed names+answers + new query*/
#endif
query ++;
/*add aliases */
while(*cstr)
{
cstr++;
}
/*add addresses */
{
}
/*don't forget update m_len*/
m->m_len = packet_len;
}
}
static int
{
int i;
/*Parse dns request */
return 0; /* this is respose*/
{
}
h = gethostbyname((char *)cname);
/*we've chenged size and conten of udp, to avoid double csum calcualtion
*will assign to zero
*/
return (0);
}
/*
* qstr is z-string with -dot- replaced with \count to next -dot-
* e.g. ya.ru is \02ya\02ru
* Note: it's assumed that caller allocates buffer for cstr
*/
{
char *q = qname;
char *c = cname;
while(*q != 0)
{
{
*c = *q;
c++;
}
else if (c != &cname[0])
{
*c = '.';
c++;
}
q++;
}
q = 0;
}
/*
*
*/
{
char *c, *pc, *q;
c = cstr;
q = qstr;
while(*c != 0)
{
/* a the begining or at -dot- position */
{
if (c != cstr) c++;
q++;
continue;
}
(*q) = (*c); /*direct copy*/
q++;
c++;
}
q = 0;
}
int
{
}
int
{
}
static int
{
int error;
switch (type) {
case MOD_LOAD:
error = 0;
break;
case MOD_UNLOAD:
error = 0;
break;
default:
}
return (error);
}