ReactOS  0.4.15-dev-1150-g593bcce
types.c File Reference
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "internal.h"
Include dependency graph for types.c:

Go to the source code of this file.

Macros

#define R_NOMEM   return adns_s_nomemory
 
#define CSP_ADDSTR(s)   do { if (!adns__vbuf_appendstr(vb,(s))) R_NOMEM; } while (0)
 
#define TYPESZ_M(member)   (sizeof(*((adns_answer*)0)->rrs.member))
 
#define DEEP_MEMB(memb)   TYPESZ_M(memb), mf_##memb, cs_##memb
 
#define FLAT_MEMB(memb)   TYPESZ_M(memb), mf_flat, cs_##memb
 
#define DEEP_TYPE(code, rrt, fmt, memb, parser, comparer, printer)   { adns_r_##code, rrt, fmt, TYPESZ_M(memb), mf_##memb, printer, parser, comparer }
 
#define FLAT_TYPE(code, rrt, fmt, memb, parser, comparer, printer)   { adns_r_##code, rrt, fmt, TYPESZ_M(memb), mf_flat, printer, parser, comparer }
 

Functions

static adns_status pap_qstring (const parseinfo *pai, int *cbyte_io, int max, int *len_r, char **str_r)
 
static adns_status csp_qstring (vbuf *vb, const char *dp, int len)
 
static void mf_str (adns_query qu, void *datap)
 
static void mf_intstr (adns_query qu, void *datap)
 
static void mf_manyistr (adns_query qu, void *datap)
 
static adns_status pa_txt (const parseinfo *pai, int cbyte, int max, void *datap)
 
static adns_status cs_txt (vbuf *vb, const void *datap)
 
static adns_status cs_hinfo (vbuf *vb, const void *datap)
 
static adns_status pa_inaddr (const parseinfo *pai, int cbyte, int max, void *datap)
 
static int search_sortlist (adns_state ads, struct in_addr ad)
 
static int dip_inaddr (adns_state ads, struct in_addr a, struct in_addr b)
 
static int di_inaddr (adns_state ads, const void *datap_a, const void *datap_b)
 
static adns_status cs_inaddr (vbuf *vb, const void *datap)
 
static adns_status pa_addr (const parseinfo *pai, int cbyte, int max, void *datap)
 
static int di_addr (adns_state ads, const void *datap_a, const void *datap_b)
 
static int div_addr (void *context, const void *datap_a, const void *datap_b)
 
static adns_status csp_addr (vbuf *vb, const adns_rr_addr *rrp)
 
static adns_status cs_addr (vbuf *vb, const void *datap)
 
static adns_status pap_domain (const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
 
static adns_status csp_domain (vbuf *vb, const char *domain)
 
static adns_status cs_domain (vbuf *vb, const void *datap)
 
static adns_status pa_dom_raw (const parseinfo *pai, int cbyte, int max, void *datap)
 
static adns_status pa_host_raw (const parseinfo *pai, int cbyte, int max, void *datap)
 
static adns_status pap_findaddrs (const parseinfo *pai, adns_rr_hostaddr *ha, int *cbyte_io, int count, int dmstart)
 
static void icb_hostaddr (adns_query parent, adns_query child)
 
static adns_status pap_hostaddr (const parseinfo *pai, int *cbyte_io, int max, adns_rr_hostaddr *rrp)
 
static adns_status pa_hostaddr (const parseinfo *pai, int cbyte, int max, void *datap)
 
static int dip_hostaddr (adns_state ads, const adns_rr_hostaddr *ap, const adns_rr_hostaddr *bp)
 
static int di_hostaddr (adns_state ads, const void *datap_a, const void *datap_b)
 
static void mfp_hostaddr (adns_query qu, adns_rr_hostaddr *rrp)
 
static void mf_hostaddr (adns_query qu, void *datap)
 
static adns_status csp_hostaddr (vbuf *vb, const adns_rr_hostaddr *rrp)
 
static adns_status cs_hostaddr (vbuf *vb, const void *datap)
 
static adns_status pa_mx_raw (const parseinfo *pai, int cbyte, int max, void *datap)
 
static int di_mx_raw (adns_state ads, const void *datap_a, const void *datap_b)
 
static adns_status pa_mx (const parseinfo *pai, int cbyte, int max, void *datap)
 
static int di_mx (adns_state ads, const void *datap_a, const void *datap_b)
 
static void mf_inthostaddr (adns_query qu, void *datap)
 
static adns_status cs_inthostaddr (vbuf *vb, const void *datap)
 
static adns_status cs_inthost (vbuf *vb, const void *datap)
 
static void icb_ptr (adns_query parent, adns_query child)
 
static adns_status pa_ptr (const parseinfo *pai, int dmstart, int max, void *datap)
 
static void mf_strpair (adns_query qu, void *datap)
 
static void mf_intstrpair (adns_query qu, void *datap)
 
static adns_status pa_hinfo (const parseinfo *pai, int cbyte, int max, void *datap)
 
static adns_status pap_mailbox822 (const parseinfo *pai, int *cbyte_io, int max, char **mb_r)
 
static adns_status pap_mailbox (const parseinfo *pai, int *cbyte_io, int max, char **mb_r)
 
static adns_status csp_mailbox (vbuf *vb, const char *mailbox)
 
static adns_status pa_rp (const parseinfo *pai, int cbyte, int max, void *datap)
 
static adns_status cs_rp (vbuf *vb, const void *datap)
 
static adns_status pa_soa (const parseinfo *pai, int cbyte, int max, void *datap)
 
static void mf_soa (adns_query qu, void *datap)
 
static adns_status cs_soa (vbuf *vb, const void *datap)
 
static void mf_flat (adns_query qu, void *data)
 
const typeinfoadns__findtype (adns_rrtype type)
 

Variables

static const typeinfo typeinfos []
 

Macro Definition Documentation

◆ CSP_ADDSTR

#define CSP_ADDSTR (   s)    do { if (!adns__vbuf_appendstr(vb,(s))) R_NOMEM; } while (0)

Definition at line 41 of file types.c.

◆ DEEP_MEMB

#define DEEP_MEMB (   memb)    TYPESZ_M(memb), mf_##memb, cs_##memb

Definition at line 994 of file types.c.

◆ DEEP_TYPE

#define DEEP_TYPE (   code,
  rrt,
  fmt,
  memb,
  parser,
  comparer,
  printer 
)    { adns_r_##code, rrt, fmt, TYPESZ_M(memb), mf_##memb, printer, parser, comparer }

Definition at line 997 of file types.c.

◆ FLAT_MEMB

#define FLAT_MEMB (   memb)    TYPESZ_M(memb), mf_flat, cs_##memb

Definition at line 995 of file types.c.

◆ FLAT_TYPE

#define FLAT_TYPE (   code,
  rrt,
  fmt,
  memb,
  parser,
  comparer,
  printer 
)    { adns_r_##code, rrt, fmt, TYPESZ_M(memb), mf_flat, printer, parser, comparer }

Definition at line 999 of file types.c.

◆ R_NOMEM

#define R_NOMEM   return adns_s_nomemory

Definition at line 40 of file types.c.

◆ TYPESZ_M

#define TYPESZ_M (   member)    (sizeof(*((adns_answer*)0)->rrs.member))

Definition at line 992 of file types.c.

Function Documentation

◆ adns__findtype()

const typeinfo* adns__findtype ( adns_rrtype  type)

Definition at line 1025 of file types.c.

1025  {
1026  const typeinfo *begin, *end, *mid;
1027 
1028  begin= typeinfos; end= typeinfos+(sizeof(typeinfos)/sizeof(typeinfo));
1029 
1030  while (begin < end) {
1031  mid= begin + ((end-begin)>>1);
1032  if (mid->type == type) return mid;
1033  if (type > mid->type) begin= mid+1;
1034  else end= mid;
1035  }
1036  return 0;
1037 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
static clock_t begin
Definition: xmllint.c:466
static const typeinfo typeinfos[]
Definition: types.c:1002
adns_rrtype type
Definition: internal.h:125

Referenced by adns_rr_info(), adns_submit(), pa_ptr(), and pap_hostaddr().

◆ cs_addr()

static adns_status cs_addr ( vbuf vb,
const void datap 
)
static

Definition at line 331 of file types.c.

331  {
332  const adns_rr_addr *rrp= datap;
333 
334  return csp_addr(vb,rrp);
335 }
static adns_status csp_addr(vbuf *vb, const adns_rr_addr *rrp)
Definition: types.c:313

◆ cs_domain()

static adns_status cs_domain ( vbuf vb,
const void datap 
)
static

Definition at line 368 of file types.c.

368  {
369  const char *const *domainp= datap;
370  return csp_domain(vb,*domainp);
371 }
static adns_status csp_domain(vbuf *vb, const char *domain)
Definition: types.c:362

◆ cs_hinfo()

static adns_status cs_hinfo ( vbuf vb,
const void datap 
)
static

Definition at line 227 of file types.c.

227  {
228  const adns_rr_intstrpair *rrp= datap;
229  adns_status st;
230 
231  st= csp_qstring(vb,rrp->array[0].str,rrp->array[0].i); if (st) return st;
232  CSP_ADDSTR(" ");
233  st= csp_qstring(vb,rrp->array[1].str,rrp->array[1].i); if (st) return st;
234  return adns_s_ok;
235 }
static adns_status csp_qstring(vbuf *vb, const char *dp, int len)
Definition: types.c:112
adns_rr_intstr array[2]
Definition: adns.h:302
adns_status
Definition: adns.h:215
#define CSP_ADDSTR(s)
Definition: types.c:41
char * str
Definition: adns.h:298

◆ cs_hostaddr()

static adns_status cs_hostaddr ( vbuf vb,
const void datap 
)
static

Definition at line 588 of file types.c.

588  {
589  const adns_rr_hostaddr *rrp= datap;
590 
591  return csp_hostaddr(vb,rrp);
592 }
static adns_status csp_hostaddr(vbuf *vb, const adns_rr_hostaddr *rrp)
Definition: types.c:555

◆ cs_inaddr()

static adns_status cs_inaddr ( vbuf vb,
const void datap 
)
static

Definition at line 275 of file types.c.

275  {
276  const struct in_addr *rrp= datap, rr= *rrp;
277  const char *ia;
278 
279  ia= inet_ntoa(rr); assert(ia);
280  CSP_ADDSTR(ia);
281  return adns_s_ok;
282 }
#define assert(x)
Definition: debug.h:53
#define CSP_ADDSTR(s)
Definition: types.c:41
#define inet_ntoa(addr)
Definition: inet.h:100
Definition: tcpip.h:125

◆ cs_inthost()

static adns_status cs_inthost ( vbuf vb,
const void datap 
)
static

Definition at line 675 of file types.c.

675  {
676  const adns_rr_intstr *rrp= datap;
677  char buf[10];
678 
679  sprintf(buf,"%u ",rrp->i);
680  CSP_ADDSTR(buf);
681  return csp_domain(vb,rrp->str);
682 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static adns_status csp_domain(vbuf *vb, const char *domain)
Definition: types.c:362
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define CSP_ADDSTR(s)
Definition: types.c:41
char * str
Definition: adns.h:298

◆ cs_inthostaddr()

static adns_status cs_inthostaddr ( vbuf vb,
const void datap 
)
static

Definition at line 661 of file types.c.

661  {
662  const adns_rr_inthostaddr *rrp= datap;
663  char buf[10];
664 
665  sprintf(buf,"%u ",rrp->i);
666  CSP_ADDSTR(buf);
667 
668  return csp_hostaddr(vb,&rrp->ha);
669 }
adns_rr_hostaddr ha
Definition: adns.h:288
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static adns_status csp_hostaddr(vbuf *vb, const adns_rr_hostaddr *rrp)
Definition: types.c:555
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define CSP_ADDSTR(s)
Definition: types.c:41

◆ cs_rp()

static adns_status cs_rp ( vbuf vb,
const void datap 
)
static

Definition at line 918 of file types.c.

918  {
919  const adns_rr_strpair *rrp= datap;
920  adns_status st;
921 
922  st= csp_mailbox(vb,rrp->array[0]); if (st) return st;
923  CSP_ADDSTR(" ");
924  st= csp_domain(vb,rrp->array[1]); if (st) return st;
925 
926  return adns_s_ok;
927 }
static adns_status csp_domain(vbuf *vb, const char *domain)
Definition: types.c:362
adns_status
Definition: adns.h:215
static adns_status csp_mailbox(vbuf *vb, const char *mailbox)
Definition: types.c:896
#define CSP_ADDSTR(s)
Definition: types.c:41
char * array[2]
Definition: adns.h:283

◆ cs_soa()

static adns_status cs_soa ( vbuf vb,
const void datap 
)
static

Definition at line 964 of file types.c.

964  {
965  const adns_rr_soa *rrp= datap;
966  char buf[20];
967  int i;
968  adns_status st;
969 
970  st= csp_domain(vb,rrp->mname); if (st) return st;
971  CSP_ADDSTR(" ");
972  st= csp_mailbox(vb,rrp->rname); if (st) return st;
973 
974  for (i=0; i<5; i++) {
975  sprintf(buf," %lu",(&rrp->serial)[i]);
976  CSP_ADDSTR(buf);
977  }
978 
979  return adns_s_ok;
980 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static adns_status csp_domain(vbuf *vb, const char *domain)
Definition: types.c:362
unsigned long serial
Definition: adns.h:307
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
char * mname
Definition: adns.h:306
adns_status
Definition: adns.h:215
static adns_status csp_mailbox(vbuf *vb, const char *mailbox)
Definition: types.c:896
#define CSP_ADDSTR(s)
Definition: types.c:41
char * rname
Definition: adns.h:306

◆ cs_txt()

static adns_status cs_txt ( vbuf vb,
const void datap 
)
static

Definition at line 210 of file types.c.

210  {
211  const adns_rr_intstr *const *rrp= datap;
212  const adns_rr_intstr *current;
213  adns_status st;
214  int spc;
215 
216  for (current= *rrp, spc=0; current->i >= 0; current++, spc=1) {
217  if (spc) CSP_ADDSTR(" ");
218  st= csp_qstring(vb,current->str,current->i); if (st) return st;
219  }
220  return adns_s_ok;
221 }
static adns_status csp_qstring(vbuf *vb, const char *dp, int len)
Definition: types.c:112
adns_status
Definition: adns.h:215
#define CSP_ADDSTR(s)
Definition: types.c:41
struct task_struct * current
Definition: linux.c:32

◆ csp_addr()

static adns_status csp_addr ( vbuf vb,
const adns_rr_addr rrp 
)
static

Definition at line 313 of file types.c.

313  {
314  const char *ia;
315  static char buf[30];
316 
317  switch (rrp->addr.inet.sin_family) {
318  case AF_INET:
319  CSP_ADDSTR("INET ");
320  ia= inet_ntoa(rrp->addr.inet.sin_addr); assert(ia);
321  CSP_ADDSTR(ia);
322  break;
323  default:
324  sprintf(buf,"AF=%u",rrp->addr.sa.sa_family);
325  CSP_ADDSTR(buf);
326  break;
327  }
328  return adns_s_ok;
329 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
struct sockaddr sa
Definition: adns.h:270
#define assert(x)
Definition: debug.h:53
union adns_rr_addr::@3957 addr
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define CSP_ADDSTR(s)
Definition: types.c:41
#define inet_ntoa(addr)
Definition: inet.h:100
struct sockaddr_in inet
Definition: adns.h:271
#define AF_INET
Definition: tcpip.h:117

Referenced by cs_addr(), and csp_hostaddr().

◆ csp_domain()

static adns_status csp_domain ( vbuf vb,
const char domain 
)
static

Definition at line 362 of file types.c.

362  {
364  if (!*domain) CSP_ADDSTR(".");
365  return adns_s_ok;
366 }
Definition: cookie.c:41
#define CSP_ADDSTR(s)
Definition: types.c:41

Referenced by cs_domain(), cs_inthost(), cs_rp(), cs_soa(), csp_hostaddr(), and csp_mailbox().

◆ csp_hostaddr()

static adns_status csp_hostaddr ( vbuf vb,
const adns_rr_hostaddr rrp 
)
static

Definition at line 555 of file types.c.

555  {
556  const char *errstr;
557  adns_status st;
558  char buf[20];
559  int i;
560 
561  st= csp_domain(vb,rrp->host); if (st) return st;
562 
563  CSP_ADDSTR(" ");
565 
566  sprintf(buf," %d ",rrp->astatus);
567  CSP_ADDSTR(buf);
568 
570  CSP_ADDSTR(" ");
571 
573  st= csp_qstring(vb,errstr,(int)strlen(errstr)); if (st) return st;
574 
575  if (rrp->naddrs >= 0) {
576  CSP_ADDSTR(" (");
577  for (i=0; i<rrp->naddrs; i++) {
578  CSP_ADDSTR(" ");
579  st= csp_addr(vb,&rrp->addrs[i]);
580  }
581  CSP_ADDSTR(" )");
582  } else {
583  CSP_ADDSTR(" ?");
584  }
585  return adns_s_ok;
586 }
static adns_status csp_qstring(vbuf *vb, const char *dp, int len)
Definition: types.c:112
ADNS_API const char * adns_errtypeabbrev(adns_status st)
Definition: general.c:311
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
adns_status astatus
Definition: adns.h:277
static adns_status csp_domain(vbuf *vb, const char *domain)
Definition: types.c:362
char * host
Definition: adns.h:276
ADNS_API const char * adns_errabbrev(adns_status st)
Definition: general.c:275
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
adns_status
Definition: adns.h:215
#define CSP_ADDSTR(s)
Definition: types.c:41
adns_rr_addr * addrs
Definition: adns.h:279
static adns_status csp_addr(vbuf *vb, const adns_rr_addr *rrp)
Definition: types.c:313
ADNS_API const char * adns_strerror(adns_status st)
Definition: general.c:268
const char * errstr(int errcode)

Referenced by cs_hostaddr(), and cs_inthostaddr().

◆ csp_mailbox()

static adns_status csp_mailbox ( vbuf vb,
const char mailbox 
)
static

Definition at line 896 of file types.c.

896  {
897  return csp_domain(vb,mailbox);
898 }
static adns_status csp_domain(vbuf *vb, const char *domain)
Definition: types.c:362

Referenced by cs_rp(), and cs_soa().

◆ csp_qstring()

static adns_status csp_qstring ( vbuf vb,
const char dp,
int  len 
)
static

Definition at line 112 of file types.c.

112  {
113  unsigned char ch;
114  char buf[10];
115  int cn;
116 
117  CSP_ADDSTR("\"");
118  for (cn=0; cn<len; cn++) {
119  ch= *dp++;
120  if (ch == '\\') {
121  CSP_ADDSTR("\\\\");
122  } else if (ch == '"') {
123  CSP_ADDSTR("\\\"");
124  } else if (ch >= 32 && ch <= 126) {
125  if (!adns__vbuf_append(vb,&ch,1)) R_NOMEM;
126  } else {
127  sprintf(buf,"\\x%02x",ch);
128  CSP_ADDSTR(buf);
129  }
130  }
131  CSP_ADDSTR("\"");
132 
133  return adns_s_ok;
134 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BYTE cn[]
Definition: cert.c:2938
#define sprintf(buf, format,...)
Definition: sprintf.c:55
int adns__vbuf_append(vbuf *vb, const byte *data, int len)
Definition: general.c:131
#define CSP_ADDSTR(s)
Definition: types.c:41
#define R_NOMEM
Definition: types.c:40
GLenum GLsizei len
Definition: glext.h:6722

Referenced by cs_hinfo(), cs_txt(), and csp_hostaddr().

◆ di_addr()

static int di_addr ( adns_state  ads,
const void datap_a,
const void datap_b 
)
static

Definition at line 300 of file types.c.

300  {
301  const adns_rr_addr *ap= datap_a, *bp= datap_b;
302 
303  assert(ap->addr.sa.sa_family == AF_INET);
304  return dip_inaddr(ads, ap->addr.inet.sin_addr, bp->addr.inet.sin_addr);
305 }
adns_state ads
Definition: adh-query.c:35
#define assert(x)
Definition: debug.h:53
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
static int dip_inaddr(adns_state ads, struct in_addr a, struct in_addr b)
Definition: types.c:259
#define AF_INET
Definition: tcpip.h:117

Referenced by div_addr().

◆ di_hostaddr()

static int di_hostaddr ( adns_state  ads,
const void datap_a,
const void datap_b 
)
static

Definition at line 534 of file types.c.

534  {
535  const adns_rr_hostaddr *ap= datap_a, *bp= datap_b;
536 
537  return dip_hostaddr(ads, ap,bp);
538 }
adns_state ads
Definition: adh-query.c:35
static int dip_hostaddr(adns_state ads, const adns_rr_hostaddr *ap, const adns_rr_hostaddr *bp)
Definition: types.c:523
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

◆ di_inaddr()

static int di_inaddr ( adns_state  ads,
const void datap_a,
const void datap_b 
)
static

Definition at line 269 of file types.c.

269  {
270  const struct in_addr *ap= datap_a, *bp= datap_b;
271 
272  return dip_inaddr(ads,*ap,*bp);
273 }
adns_state ads
Definition: adh-query.c:35
Definition: tcpip.h:125
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
static int dip_inaddr(adns_state ads, struct in_addr a, struct in_addr b)
Definition: types.c:259

◆ di_mx()

static int di_mx ( adns_state  ads,
const void datap_a,
const void datap_b 
)
static

Definition at line 643 of file types.c.

643  {
644  const adns_rr_inthostaddr *ap= datap_a, *bp= datap_b;
645 
646  if (ap->i < bp->i) return 0;
647  if (ap->i > bp->i) return 1;
648  return dip_hostaddr(ads, &ap->ha, &bp->ha);
649 }
adns_state ads
Definition: adh-query.c:35
static int dip_hostaddr(adns_state ads, const adns_rr_hostaddr *ap, const adns_rr_hostaddr *bp)
Definition: types.c:523
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

◆ di_mx_raw()

static int di_mx_raw ( adns_state  ads,
const void datap_a,
const void datap_b 
)
static

Definition at line 615 of file types.c.

615  {
616  const adns_rr_intstr *ap= datap_a, *bp= datap_b;
617 
618  if (ap->i < bp->i) return 0;
619  if (ap->i > bp->i) return 1;
620  return 0;
621 }
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

◆ dip_hostaddr()

static int dip_hostaddr ( adns_state  ads,
const adns_rr_hostaddr ap,
const adns_rr_hostaddr bp 
)
static

Definition at line 523 of file types.c.

523  {
524  if (ap->astatus != bp->astatus) return ap->astatus;
525  if (ap->astatus) return 0;
526 
527  assert(ap->addrs[0].addr.sa.sa_family == AF_INET);
528  assert(bp->addrs[0].addr.sa.sa_family == AF_INET);
529  return dip_inaddr(ads,
530  ap->addrs[0].addr.inet.sin_addr,
531  bp->addrs[0].addr.inet.sin_addr);
532 }
adns_state ads
Definition: adh-query.c:35
adns_status astatus
Definition: adns.h:277
struct sockaddr sa
Definition: adns.h:270
#define assert(x)
Definition: debug.h:53
union adns_rr_addr::@3957 addr
adns_rr_addr * addrs
Definition: adns.h:279
struct sockaddr_in inet
Definition: adns.h:271
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
static int dip_inaddr(adns_state ads, struct in_addr a, struct in_addr b)
Definition: types.c:259
#define AF_INET
Definition: tcpip.h:117

Referenced by di_hostaddr(), and di_mx().

◆ dip_inaddr()

static int dip_inaddr ( adns_state  ads,
struct in_addr  a,
struct in_addr  b 
)
static

Definition at line 259 of file types.c.

259  {
260  int ai, bi;
261 
262  if (!ads->nsortlist) return 0;
263 
264  ai= search_sortlist(ads,a);
265  bi= search_sortlist(ads,b);
266  return bi<ai;
267 }
int nsortlist
Definition: internal.h:300
adns_state ads
Definition: adh-query.c:35
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static int search_sortlist(adns_state ads, struct in_addr ad)
Definition: types.c:249
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by di_addr(), di_inaddr(), and dip_hostaddr().

◆ div_addr()

static int div_addr ( void context,
const void datap_a,
const void datap_b 
)
static

Definition at line 307 of file types.c.

307  {
308  const adns_state ads= context;
309 
310  return di_addr(ads, datap_a, datap_b);
311 }
adns_state ads
Definition: adh-query.c:35
Definition: http.c:7094
static int di_addr(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:300

Referenced by pap_findaddrs().

◆ icb_hostaddr()

static void icb_hostaddr ( adns_query  parent,
adns_query  child 
)
static

Definition at line 442 of file types.c.

442  {
443  adns_answer *cans= child->answer;
444  adns_rr_hostaddr *rrp= child->ctx.info.hostaddr;
445  adns_state ads= parent->ads;
446  adns_status st;
447 
448  st= cans->status;
449  rrp->astatus= st;
450  rrp->naddrs= (st>0 && st<=adns_s_max_tempfail) ? -1 : cans->nrrs;
451  rrp->addrs= cans->rrs.addr;
453 
454  if (parent->children.head) {
455  LIST_LINK_TAIL(ads->childw,parent);
456  } else {
458  }
459 }
adns_state ads
Definition: adh-query.c:35
adns_status astatus
Definition: adns.h:277
adns_rr_addr * addr
Definition: adns.h:322
static HWND child
Definition: cursoricon.c:298
void adns__query_done(adns_query qu)
Definition: query.c:503
void adns__transfer_interim(adns_query from, adns_query to, void *block, size_t sz)
Definition: query.c:366
#define LIST_LINK_TAIL(list, node)
Definition: dlist.h:51
adns_status
Definition: adns.h:215
r parent
Definition: btrfs.c:2944
adns_rr_addr * addrs
Definition: adns.h:279
adns_status status
Definition: adns.h:311
union adns_answer::@3958 rrs
int nrrs
Definition: adns.h:316

Referenced by pap_hostaddr().

◆ icb_ptr()

static void icb_ptr ( adns_query  parent,
adns_query  child 
)
static

Definition at line 688 of file types.c.

688  {
689  adns_answer *cans= child->answer;
690  const adns_rr_addr *queried, *found;
691  adns_state ads= parent->ads;
692  int i;
693 
694  if (cans->status == adns_s_nxdomain || cans->status == adns_s_nodata) {
696  return;
697  } else if (cans->status) {
699  return;
700  }
701 
702  queried= &parent->ctx.info.ptr_parent_addr;
703  for (i=0, found=cans->rrs.addr; i<cans->nrrs; i++, found++) {
704  if (queried->len == found->len &&
705  !memcmp(&queried->addr,&found->addr,(size_t) queried->len)) {
706  if (!parent->children.head) {
708  return;
709  } else {
710  LIST_LINK_TAIL(ads->childw,parent);
711  return;
712  }
713  }
714  }
715 
717 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
adns_state ads
Definition: adh-query.c:35
adns_rr_addr * addr
Definition: adns.h:322
union adns_rr_addr::@3957 addr
static HWND child
Definition: cursoricon.c:298
void adns__query_done(adns_query qu)
Definition: query.c:503
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LIST_LINK_TAIL(list, node)
Definition: dlist.h:51
int len
Definition: adns.h:268
r parent
Definition: btrfs.c:2944
adns_status status
Definition: adns.h:311
union adns_answer::@3958 rrs
void adns__query_fail(adns_query qu, adns_status stat)
Definition: query.c:547

Referenced by pa_ptr().

◆ mf_flat()

static void mf_flat ( adns_query  qu,
void data 
)
static

Definition at line 986 of file types.c.

986 { }

◆ mf_hostaddr()

static void mf_hostaddr ( adns_query  qu,
void datap 
)
static

Definition at line 549 of file types.c.

549  {
550  adns_rr_hostaddr *rrp= datap;
551 
552  mfp_hostaddr(qu,rrp);
553 }
static void mfp_hostaddr(adns_query qu, adns_rr_hostaddr *rrp)
Definition: types.c:540

◆ mf_inthostaddr()

static void mf_inthostaddr ( adns_query  qu,
void datap 
)
static

Definition at line 655 of file types.c.

655  {
656  adns_rr_inthostaddr *rrp= datap;
657 
658  mfp_hostaddr(qu,&rrp->ha);
659 }
adns_rr_hostaddr ha
Definition: adns.h:288
static void mfp_hostaddr(adns_query qu, adns_rr_hostaddr *rrp)
Definition: types.c:540

◆ mf_intstr()

static void mf_intstr ( adns_query  qu,
void datap 
)
static

Definition at line 150 of file types.c.

150  {
151  adns_rr_intstr *rrp= datap;
152 
153  adns__makefinal_str(qu,&rrp->str);
154 }
char * str
Definition: adns.h:298
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553

◆ mf_intstrpair()

static void mf_intstrpair ( adns_query  qu,
void datap 
)
static

Definition at line 801 of file types.c.

801  {
802  adns_rr_intstrpair *rrp= datap;
803 
804  adns__makefinal_str(qu,&rrp->array[0].str);
805  adns__makefinal_str(qu,&rrp->array[1].str);
806 }
adns_rr_intstr array[2]
Definition: adns.h:302
char * str
Definition: adns.h:298
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553

◆ mf_manyistr()

static void mf_manyistr ( adns_query  qu,
void datap 
)
static

Definition at line 160 of file types.c.

160  {
161  adns_rr_intstr **rrp= datap;
162  adns_rr_intstr *te, *table;
163  void *tablev;
164  int tc;
165 
166  for (tc=0, te= *rrp; te->i >= 0; te++, tc++);
167  tablev= *rrp;
168  adns__makefinal_block(qu,&tablev,sizeof(*te)*(tc+1));
169  *rrp= table= tablev;
170  for (te= *rrp; te->i >= 0; te++)
171  adns__makefinal_str(qu,&te->str);
172 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
const GLfloat * tc
Definition: glext.h:8925
char * str
Definition: adns.h:298
void adns__makefinal_block(adns_query qu, void **blpp, size_t sz)
Definition: query.c:565
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553

◆ mf_soa()

static void mf_soa ( adns_query  qu,
void datap 
)
static

Definition at line 957 of file types.c.

957  {
958  adns_rr_soa *rrp= datap;
959 
960  adns__makefinal_str(qu,&rrp->mname);
961  adns__makefinal_str(qu,&rrp->rname);
962 }
char * mname
Definition: adns.h:306
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553
char * rname
Definition: adns.h:306

◆ mf_str()

static void mf_str ( adns_query  qu,
void datap 
)
static

Definition at line 140 of file types.c.

140  {
141  char **rrp= datap;
142 
143  adns__makefinal_str(qu,rrp);
144 }
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553

◆ mf_strpair()

static void mf_strpair ( adns_query  qu,
void datap 
)
static

Definition at line 790 of file types.c.

790  {
791  adns_rr_strpair *rrp= datap;
792 
793  adns__makefinal_str(qu,&rrp->array[0]);
794  adns__makefinal_str(qu,&rrp->array[1]);
795 }
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553
char * array[2]
Definition: adns.h:283

◆ mfp_hostaddr()

static void mfp_hostaddr ( adns_query  qu,
adns_rr_hostaddr rrp 
)
static

Definition at line 540 of file types.c.

540  {
541  void *tablev;
542 
543  adns__makefinal_str(qu,&rrp->host);
544  tablev= rrp->addrs;
545  adns__makefinal_block(qu, &tablev, rrp->naddrs*sizeof(*rrp->addrs));
546  rrp->addrs= tablev;
547 }
char * host
Definition: adns.h:276
adns_rr_addr * addrs
Definition: adns.h:279
void adns__makefinal_block(adns_query qu, void **blpp, size_t sz)
Definition: query.c:565
void adns__makefinal_str(adns_query qu, char **strp)
Definition: query.c:553

Referenced by mf_hostaddr(), and mf_inthostaddr().

◆ pa_addr()

static adns_status pa_addr ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 288 of file types.c.

288  {
289  adns_rr_addr *storeto= datap;
290  const byte *dgram= pai->dgram;
291 
292  if (max-cbyte != 4) return adns_s_invaliddata;
293  storeto->len= sizeof(storeto->addr.inet);
294  memset(&storeto->addr,0,sizeof(storeto->addr.inet));
295  storeto->addr.inet.sin_family= AF_INET;
296  memcpy(&storeto->addr.inet.sin_addr,dgram+cbyte,4);
297  return adns_s_ok;
298 }
#define max(a, b)
Definition: svc.c:63
union adns_rr_addr::@3957 addr
int len
Definition: adns.h:268
static int cbyte
Definition: adnsresfilter.c:73
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct sockaddr_in inet
Definition: adns.h:271
const byte * dgram
Definition: internal.h:119
#define AF_INET
Definition: tcpip.h:117
#define memset(x, y, z)
Definition: compat.h:39

Referenced by pap_findaddrs().

◆ pa_dom_raw()

static adns_status pa_dom_raw ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 373 of file types.c.

373  {
374  char **rrp= datap;
375  adns_status st;
376 
377  st= pap_domain(pai, &cbyte, max, rrp, pdf_quoteok);
378  if (st) return st;
379 
380  if (cbyte != max) return adns_s_invaliddata;
381  return adns_s_ok;
382 }
#define max(a, b)
Definition: svc.c:63
adns_status
Definition: adns.h:215
static int cbyte
Definition: adnsresfilter.c:73
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342

◆ pa_hinfo()

static adns_status pa_hinfo ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 812 of file types.c.

812  {
813  adns_rr_intstrpair *rrp= datap;
814  adns_status st;
815  int i;
816 
817  for (i=0; i<2; i++) {
818  st= pap_qstring(pai, &cbyte, max, &rrp->array[i].i, &rrp->array[i].str);
819  if (st) return st;
820  }
821 
822  if (cbyte != max) return adns_s_invaliddata;
823 
824  return adns_s_ok;
825 }
#define max(a, b)
Definition: svc.c:63
static adns_status pap_qstring(const parseinfo *pai, int *cbyte_io, int max, int *len_r, char **str_r)
Definition: types.c:84
adns_rr_intstr array[2]
Definition: adns.h:302
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
adns_status
Definition: adns.h:215
static int cbyte
Definition: adnsresfilter.c:73
char * str
Definition: adns.h:298

◆ pa_host_raw()

static adns_status pa_host_raw ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 388 of file types.c.

388  {
389  char **rrp= datap;
390  adns_status st;
391 
392  st= pap_domain(pai, &cbyte, max, rrp,
394  if (st) return st;
395 
396  if (cbyte != max) return adns_s_invaliddata;
397  return adns_s_ok;
398 }
#define max(a, b)
Definition: svc.c:63
adns_query qu
Definition: internal.h:117
adns_status
Definition: adns.h:215
static int cbyte
Definition: adnsresfilter.c:73
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342

◆ pa_hostaddr()

static adns_status pa_hostaddr ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 512 of file types.c.

512  {
513  adns_rr_hostaddr *rrp= datap;
514  adns_status st;
515 
516  st= pap_hostaddr(pai, &cbyte, max, rrp);
517  if (st) return st;
518  if (cbyte != max) return adns_s_invaliddata;
519 
520  return adns_s_ok;
521 }
#define max(a, b)
Definition: svc.c:63
adns_status
Definition: adns.h:215
static adns_status pap_hostaddr(const parseinfo *pai, int *cbyte_io, int max, adns_rr_hostaddr *rrp)
Definition: types.c:461
static int cbyte
Definition: adnsresfilter.c:73

◆ pa_inaddr()

static adns_status pa_inaddr ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 241 of file types.c.

241  {
242  struct in_addr *storeto= datap;
243 
244  if (max-cbyte != 4) return adns_s_invaliddata;
245  memcpy(storeto, pai->dgram + cbyte, 4);
246  return adns_s_ok;
247 }
#define max(a, b)
Definition: svc.c:63
static int cbyte
Definition: adnsresfilter.c:73
Definition: tcpip.h:125
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const byte * dgram
Definition: internal.h:119

◆ pa_mx()

static adns_status pa_mx ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 627 of file types.c.

627  {
628  const byte *dgram= pai->dgram;
629  adns_rr_inthostaddr *rrp= datap;
630  adns_status st;
631  int pref;
632 
633  if (cbyte+2 > max) return adns_s_invaliddata;
634  GET_W(cbyte,pref);
635  rrp->i= pref;
636  st= pap_hostaddr(pai, &cbyte, max, &rrp->ha);
637  if (st) return st;
638 
639  if (cbyte != max) return adns_s_invaliddata;
640  return adns_s_ok;
641 }
#define max(a, b)
Definition: svc.c:63
adns_rr_hostaddr ha
Definition: adns.h:288
adns_status
Definition: adns.h:215
static adns_status pap_hostaddr(const parseinfo *pai, int *cbyte_io, int max, adns_rr_hostaddr *rrp)
Definition: types.c:461
static int cbyte
Definition: adnsresfilter.c:73
#define GET_W(cb, tv)
Definition: internal.h:717
const byte * dgram
Definition: internal.h:119

◆ pa_mx_raw()

static adns_status pa_mx_raw ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 598 of file types.c.

598  {
599  const byte *dgram= pai->dgram;
600  adns_rr_intstr *rrp= datap;
601  adns_status st;
602  int pref;
603 
604  if (cbyte+2 > max) return adns_s_invaliddata;
605  GET_W(cbyte,pref);
606  rrp->i= pref;
607  st= pap_domain(pai, &cbyte, max, &rrp->str,
609  if (st) return st;
610 
611  if (cbyte != max) return adns_s_invaliddata;
612  return adns_s_ok;
613 }
#define max(a, b)
Definition: svc.c:63
adns_query qu
Definition: internal.h:117
adns_status
Definition: adns.h:215
static int cbyte
Definition: adnsresfilter.c:73
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342
char * str
Definition: adns.h:298
#define GET_W(cb, tv)
Definition: internal.h:717
const byte * dgram
Definition: internal.h:119

◆ pa_ptr()

static adns_status pa_ptr ( const parseinfo pai,
int  dmstart,
int  max,
void datap 
)
static

Definition at line 719 of file types.c.

719  {
720  static const char *(expectdomain[])= { DNS_INADDR_ARPA };
721 
722  char **rrp= datap;
723  adns_status st;
724  adns_rr_addr *ap;
726  char *ep;
727  byte ipv[4];
728  char labbuf[4];
729  int cbyte, i, lablen, labstart, l, id;
730  adns_query nqu;
731  qcontext ctx;
732 
733  cbyte= dmstart;
734  st= pap_domain(pai, &cbyte, max, rrp,
736  if (st) return st;
737  if (cbyte != max) return adns_s_invaliddata;
738 
739  ap= &pai->qu->ctx.info.ptr_parent_addr;
740  if (!ap->len) {
741  adns__findlabel_start(&fls, pai->ads, -1, pai->qu,
742  pai->qu->query_dgram, pai->qu->query_dglen,
743  pai->qu->query_dglen, DNS_HDRSIZE, 0);
744  for (i=0; i<4; i++) {
745  st= adns__findlabel_next(&fls,&lablen,&labstart); assert(!st);
746  if (lablen<=0 || lablen>3) return adns_s_querydomainwrong;
747  memcpy(labbuf, pai->qu->query_dgram + labstart, (size_t) lablen); labbuf[lablen]= 0;
748  ipv[3-i]= (unsigned char)strtoul(labbuf,&ep,10); if (*ep) return adns_s_querydomainwrong;
749  if (lablen>1 && pai->qu->query_dgram[labstart]=='0')
751  }
752  for (i=0; i<(int)sizeof(expectdomain)/(int)sizeof(*expectdomain); i++) {
753  st= adns__findlabel_next(&fls,&lablen,&labstart); assert(!st);
754  l= strlen(expectdomain[i]);
755  if (lablen != l || memcmp(pai->qu->query_dgram + labstart, expectdomain[i], (size_t)l))
757  }
758  st= adns__findlabel_next(&fls,&lablen,0); assert(!st);
759  if (lablen) return adns_s_querydomainwrong;
760 
761  ap->len= sizeof(struct sockaddr_in);
762  memset(&ap->addr,0,sizeof(ap->addr.inet));
763  ap->addr.inet.sin_family= AF_INET;
764  ap->addr.inet.sin_addr.s_addr=
765  htonl((u_long)(ipv[0]<<24) | (ipv[1]<<16) | (ipv[2]<<8) | (ipv[3]));
766  }
767 
768  st= adns__mkquery_frdgram(pai->ads, &pai->qu->vb, &id,
769  pai->dgram, pai->dglen, dmstart,
771  if (st) return st;
772 
773  ctx.ext= 0;
774  ctx.callback= icb_ptr;
775  memset(&ctx.info,0,(size_t) sizeof(ctx.info));
777  &pai->qu->vb, id,
778  adns_qf_quoteok_query, pai->now, &ctx);
779  if (st) return st;
780 
781  nqu->parent= pai->qu;
782  LIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.);
783  return adns_s_ok;
784 }
#define max(a, b)
Definition: svc.c:63
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
struct adns__query::@3961 children
union qcontext::@3959 info
adns_query qu
Definition: internal.h:117
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
unsigned long u_long
Definition: linux.h:269
adns_rr_addr ptr_parent_addr
Definition: internal.h:176
#define DNS_INADDR_ARPA
Definition: internal.h:80
#define htonl(x)
Definition: module.h:212
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define assert(x)
Definition: debug.h:53
adns_status adns__findlabel_next(findlabel_state *fls, int *lablen_r, int *labstart_r)
Definition: parse.c:74
#define DNS_HDRSIZE
Definition: internal.h:76
adns_status adns__internal_submit(adns_state ads, adns_query *query_r, const typeinfo *typei, vbuf *qumsg_vb, int id, adns_queryflags flags, struct timeval now, const qcontext *ctx)
Definition: query.c:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int fls(int x)
Definition: bitops.h:157
adns_status
Definition: adns.h:215
unsigned char
Definition: typeof.h:29
#define LIST_LINK_TAIL_PART(list, node, part)
Definition: dlist.h:42
static int cbyte
Definition: adnsresfilter.c:73
r l[0]
Definition: byte_order.h:167
qcontext ctx
Definition: internal.h:233
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342
byte * query_dgram
Definition: internal.h:192
int query_dglen
Definition: internal.h:193
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const typeinfo * adns__findtype(adns_rrtype type)
Definition: types.c:1025
static void icb_ptr(adns_query parent, adns_query child)
Definition: types.c:688
adns_status adns__mkquery_frdgram(adns_state ads, vbuf *vb, int *id_r, const byte *qd_dgram, int qd_dglen, int qd_begin, adns_rrtype type, adns_queryflags flags)
Definition: transmit.c:138
const byte * dgram
Definition: internal.h:119
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
void adns__findlabel_start(findlabel_state *fls, adns_state ads, int serv, adns_query qu, const byte *dgram, int dglen, int max, int dmbegin, int *dmend_rlater)
Definition: parse.c:59
GLenum GLuint id
Definition: glext.h:5579
#define AF_INET
Definition: tcpip.h:117
adns_state ads
Definition: internal.h:116
#define memset(x, y, z)
Definition: compat.h:39
adns_query parent
Definition: internal.h:184
struct timeval now
Definition: internal.h:121
int dglen
Definition: internal.h:120
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ pa_rp()

static adns_status pa_rp ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 904 of file types.c.

904  {
905  adns_rr_strpair *rrp= datap;
906  adns_status st;
907 
908  st= pap_mailbox(pai, &cbyte, max, &rrp->array[0]);
909  if (st) return st;
910 
911  st= pap_domain(pai, &cbyte, max, &rrp->array[1], pdf_quoteok);
912  if (st) return st;
913 
914  if (cbyte != max) return adns_s_invaliddata;
915  return adns_s_ok;
916 }
#define max(a, b)
Definition: svc.c:63
adns_status
Definition: adns.h:215
static int cbyte
Definition: adnsresfilter.c:73
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342
static adns_status pap_mailbox(const parseinfo *pai, int *cbyte_io, int max, char **mb_r)
Definition: types.c:887
char * array[2]
Definition: adns.h:283

◆ pa_soa()

static adns_status pa_soa ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 933 of file types.c.

933  {
934  adns_rr_soa *rrp= datap;
935  const byte *dgram= pai->dgram;
936  adns_status st;
937  int msw, lsw, i;
938 
939  st= pap_domain(pai, &cbyte, max, &rrp->mname,
941  if (st) return st;
942 
943  st= pap_mailbox(pai, &cbyte, max, &rrp->rname);
944  if (st) return st;
945 
946  if (cbyte+20 != max) return adns_s_invaliddata;
947 
948  for (i=0; i<5; i++) {
949  GET_W(cbyte,msw);
950  GET_W(cbyte,lsw);
951  (&rrp->serial)[i]= (msw<<16) | lsw;
952  }
953 
954  return adns_s_ok;
955 }
#define max(a, b)
Definition: svc.c:63
adns_query qu
Definition: internal.h:117
unsigned long serial
Definition: adns.h:307
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
char * mname
Definition: adns.h:306
adns_status
Definition: adns.h:215
static int cbyte
Definition: adnsresfilter.c:73
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342
static adns_status pap_mailbox(const parseinfo *pai, int *cbyte_io, int max, char **mb_r)
Definition: types.c:887
#define GET_W(cb, tv)
Definition: internal.h:717
const byte * dgram
Definition: internal.h:119
char * rname
Definition: adns.h:306

◆ pa_txt()

static adns_status pa_txt ( const parseinfo pai,
int  cbyte,
int  max,
void datap 
)
static

Definition at line 178 of file types.c.

178  {
179  adns_rr_intstr **rrp= datap, *table, *te;
180  const byte *dgram= pai->dgram;
181  int ti, tc, l, startbyte;
182  adns_status st;
183 
184  startbyte= cbyte;
185  if (cbyte >= max) return adns_s_invaliddata;
186  tc= 0;
187  while (cbyte < max) {
188  GET_B(cbyte,l);
189  cbyte+= l;
190  tc++;
191  }
192  if (cbyte != max || !tc) return adns_s_invaliddata;
193 
194  table= adns__alloc_interim(pai->qu,sizeof(*table)*(tc+1));
195  if (!table) R_NOMEM;
196 
197  for (cbyte=startbyte, ti=0, te=table; ti<tc; ti++, te++) {
198  st= pap_qstring(pai, &cbyte, max, &te->i, &te->str);
199  if (st) return st;
200  }
201  assert(cbyte == max);
202 
203  te->i= -1;
204  te->str= 0;
205 
206  *rrp= table;
207  return adns_s_ok;
208 }
#define max(a, b)
Definition: svc.c:63
adns_query qu
Definition: internal.h:117
#define assert(x)
Definition: debug.h:53
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
#define GET_B(cb, tv)
Definition: internal.h:716
static adns_status pap_qstring(const parseinfo *pai, int *cbyte_io, int max, int *len_r, char **str_r)
Definition: types.c:84
void * adns__alloc_interim(adns_query qu, size_t sz)
Definition: query.c:342
adns_status
Definition: adns.h:215
const GLfloat * tc
Definition: glext.h:8925
#define R_NOMEM
Definition: types.c:40
static int cbyte
Definition: adnsresfilter.c:73
r l[0]
Definition: byte_order.h:167
const byte * dgram
Definition: internal.h:119

◆ pap_domain()

static adns_status pap_domain ( const parseinfo pai,
int cbyte_io,
int  max,
char **  domain_r,
parsedomain_flags  flags 
)
static

Definition at line 342 of file types.c.

343  {
344  adns_status st;
345  char *dm;
346 
347  st= adns__parse_domain(pai->qu->ads, pai->serv, pai->qu, &pai->qu->vb, flags,
348  pai->dgram,pai->dglen, cbyte_io, max);
349  if (st) return st;
350  if (!pai->qu->vb.used) return adns_s_invaliddata;
351 
352  dm= adns__alloc_interim(pai->qu, (size_t) pai->qu->vb.used+1);
353  if (!dm) R_NOMEM;
354 
355  dm[pai->qu->vb.used]= 0;
356  memcpy(dm,pai->qu->vb.buf, (size_t) pai->qu->vb.used);
357 
358  *domain_r= dm;
359  return adns_s_ok;
360 }
#define max(a, b)
Definition: svc.c:63
adns_query qu
Definition: internal.h:117
void * adns__alloc_interim(adns_query qu, size_t sz)
Definition: query.c:342
adns_status
Definition: adns.h:215
adns_state ads
Definition: internal.h:182
#define R_NOMEM
Definition: types.c:40
int serv
Definition: internal.h:118
GLbitfield flags
Definition: glext.h:7161
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
byte * buf
Definition: internal.h:112
int used
Definition: internal.h:111
adns_status adns__parse_domain(adns_state ads, int serv, adns_query qu, vbuf *vb, adns_queryflags flags, const byte *dgram, int dglen, int *cbyte_io, int max)
Definition: parse.c:117
const byte * dgram
Definition: internal.h:119
int dglen
Definition: internal.h:120

Referenced by pa_dom_raw(), pa_host_raw(), pa_mx_raw(), pa_ptr(), pa_rp(), pa_soa(), pap_hostaddr(), and pap_mailbox().

◆ pap_findaddrs()

static adns_status pap_findaddrs ( const parseinfo pai,
adns_rr_hostaddr ha,
int cbyte_io,
int  count,
int  dmstart 
)
static

Definition at line 404 of file types.c.

405  {
406  int rri, naddrs;
407  int type, class, rdlen, rdstart, ownermatched;
408  unsigned long ttl;
409  adns_status st;
410 
411  for (rri=0, naddrs=-1; rri<count; rri++) {
412  st= adns__findrr_anychk(pai->qu, pai->serv, pai->dgram, pai->dglen, cbyte_io,
413  &type, &class, &ttl, &rdlen, &rdstart,
414  pai->dgram, pai->dglen, dmstart, &ownermatched);
415  if (st) return st;
416  if (!ownermatched || class != DNS_CLASS_IN || type != adns_r_a) {
417  if (naddrs>0) break; else continue;
418  }
419  if (naddrs == -1) {
420  naddrs= 0;
421  }
422  if (!adns__vbuf_ensure(&pai->qu->vb, (int) ((naddrs+1)*sizeof(adns_rr_addr)))) R_NOMEM;
423  adns__update_expires(pai->qu,ttl,pai->now);
424  st= pa_addr(pai, rdstart,rdstart+rdlen,
425  pai->qu->vb.buf + naddrs*sizeof(adns_rr_addr));
426  if (st) return st;
427  naddrs++;
428  }
429  if (naddrs >= 0) {
430  ha->addrs= adns__alloc_interim(pai->qu, naddrs*sizeof(adns_rr_addr));
431  if (!ha->addrs) R_NOMEM;
432  memcpy(ha->addrs, pai->qu->vb.buf, naddrs*sizeof(adns_rr_addr));
433  ha->naddrs= naddrs;
434  ha->astatus= adns_s_ok;
435 
436  adns__isort(ha->addrs, naddrs, sizeof(adns_rr_addr), pai->qu->vb.buf,
437  div_addr, pai->ads);
438  }
439  return adns_s_ok;
440 }
void adns__isort(void *array, int nobjs, int sz, void *tempbuf, int(*needswap)(void *context, const void *a, const void *b), void *context)
Definition: general.c:319
adns_query qu
Definition: internal.h:117
adns_status adns__findrr_anychk(adns_query qu, int serv, const byte *dgram, int dglen, int *cbyte_io, int *type_r, int *class_r, unsigned long *ttl_r, int *rdlen_r, int *rdstart_r, const byte *eo_dgram, int eo_dglen, int eo_cbyte, int *eo_matched_r)
Definition: parse.c:163
static adns_status pa_addr(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:288
adns_status astatus
Definition: adns.h:277
GLuint GLuint GLsizei count
Definition: gl.h:1545
Definition: adns.h:120
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void adns__update_expires(adns_query qu, unsigned long ttl, struct timeval now)
Definition: query.c:458
void * adns__alloc_interim(adns_query qu, size_t sz)
Definition: query.c:342
int adns__vbuf_ensure(vbuf *vb, int want)
Definition: general.c:116
adns_status
Definition: adns.h:215
#define DNS_CLASS_IN
Definition: internal.h:78
#define R_NOMEM
Definition: types.c:40
int serv
Definition: internal.h:118
adns_rr_addr * addrs
Definition: adns.h:279
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
byte * buf
Definition: internal.h:112
const byte * dgram
Definition: internal.h:119
adns_state ads
Definition: internal.h:116
static int div_addr(void *context, const void *datap_a, const void *datap_b)
Definition: types.c:307
struct timeval now
Definition: internal.h:121
int dglen
Definition: internal.h:120

Referenced by pap_hostaddr().

◆ pap_hostaddr()

static adns_status pap_hostaddr ( const parseinfo pai,
int cbyte_io,
int  max,
adns_rr_hostaddr rrp 
)
static

Definition at line 461 of file types.c.

462  {
463  adns_status st;
464  int dmstart, cbyte;
465  qcontext ctx;
466  int id;
467  adns_query nqu;
468  adns_queryflags nflags;
469 
470  dmstart= cbyte= *cbyte_io;
471  st= pap_domain(pai, &cbyte, max, &rrp->host,
473  if (st) return st;
474  *cbyte_io= cbyte;
475 
476  rrp->astatus= adns_s_ok;
477  rrp->naddrs= -1;
478  rrp->addrs= 0;
479 
480  cbyte= pai->nsstart;
481 
482  st= pap_findaddrs(pai, rrp, &cbyte, pai->nscount, dmstart);
483  if (st) return st;
484  if (rrp->naddrs != -1) return adns_s_ok;
485 
486  st= pap_findaddrs(pai, rrp, &cbyte, pai->arcount, dmstart);
487  if (st) return st;
488  if (rrp->naddrs != -1) return adns_s_ok;
489 
490  st= adns__mkquery_frdgram(pai->ads, &pai->qu->vb, &id,
491  pai->dgram, pai->dglen, dmstart,
493  if (st) return st;
494 
495  ctx.ext= 0;
496  ctx.callback= icb_hostaddr;
497  ctx.info.hostaddr= rrp;
498 
499  nflags= adns_qf_quoteok_query;
500  if (!(pai->qu->flags & adns_qf_cname_loose)) nflags |= adns_qf_cname_forbid;
501 
503  &pai->qu->vb, id, nflags, pai->now, &ctx);
504  if (st) return st;
505 
506  nqu->parent= pai->qu;
507  LIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.);
508 
509  return adns_s_ok;
510 }
#define max(a, b)
Definition: svc.c:63
struct adns__query::@3961 children
adns_query qu
Definition: internal.h:117
int arcount
Definition: internal.h:120
adns_status astatus
Definition: adns.h:277
char * host
Definition: adns.h:276
int nscount
Definition: internal.h:120
adns_status adns__internal_submit(adns_state ads, adns_query *query_r, const typeinfo *typei, vbuf *qumsg_vb, int id, adns_queryflags flags, struct timeval now, const qcontext *ctx)
Definition: query.c:111
adns_status
Definition: adns.h:215
#define LIST_LINK_TAIL_PART(list, node, part)
Definition: dlist.h:42
static int cbyte
Definition: adnsresfilter.c:73
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342
adns_rr_addr * addrs
Definition: adns.h:279
static void icb_hostaddr(adns_query parent, adns_query child)
Definition: types.c:442
const typeinfo * adns__findtype(adns_rrtype type)
Definition: types.c:1025
adns_queryflags
Definition: adns.h:100
adns_status adns__mkquery_frdgram(adns_state ads, vbuf *vb, int *id_r, const byte *qd_dgram, int qd_dglen, int qd_begin, adns_rrtype type, adns_queryflags flags)
Definition: transmit.c:138
int nsstart
Definition: internal.h:120
const byte * dgram
Definition: internal.h:119
GLenum GLuint id
Definition: glext.h:5579
adns_state ads
Definition: internal.h:116
static adns_status pap_findaddrs(const parseinfo *pai, adns_rr_hostaddr *ha, int *cbyte_io, int count, int dmstart)
Definition: types.c:404
adns_query parent
Definition: internal.h:184
struct timeval now
Definition: internal.h:121
int dglen
Definition: internal.h:120

Referenced by pa_hostaddr(), and pa_mx().

◆ pap_mailbox()

static adns_status pap_mailbox ( const parseinfo pai,
int cbyte_io,
int  max,
char **  mb_r 
)
static

Definition at line 887 of file types.c.

888  {
889  if (pai->qu->typei->type & adns__qtf_mail822) {
890  return pap_mailbox822(pai, cbyte_io, max, mb_r);
891  } else {
892  return pap_domain(pai, cbyte_io, max, mb_r, pdf_quoteok);
893  }
894 }
#define max(a, b)
Definition: svc.c:63
adns_query qu
Definition: internal.h:117
const typeinfo * typei
Definition: internal.h:191
static adns_status pap_domain(const parseinfo *pai, int *cbyte_io, int max, char **domain_r, parsedomain_flags flags)
Definition: types.c:342
static adns_status pap_mailbox822(const parseinfo *pai, int *cbyte_io, int max, char **mb_r)
Definition: types.c:831
adns_rrtype type
Definition: internal.h:125

Referenced by pa_rp(), and pa_soa().

◆ pap_mailbox822()

static adns_status pap_mailbox822 ( const parseinfo pai,
int cbyte_io,
int  max,
char **  mb_r 
)
static

Definition at line 831 of file types.c.

832  {
833  int lablen, labstart, i, needquote, c, r, neednorm;
834  const unsigned char *p;
835  char *str;
837  adns_status st;
838  vbuf *vb;
839 
840  vb= &pai->qu->vb;
841  vb->used= 0;
843  -1, pai->qu,
844  pai->dgram, pai->dglen, max,
845  *cbyte_io, cbyte_io);
846  st= adns__findlabel_next(&fls,&lablen,&labstart);
847  if (!lablen) {
848  adns__vbuf_appendstr(vb,".");
849  goto x_ok;
850  }
851 
852  neednorm= 1;
853  for (i=0, needquote=0, p= pai->dgram+labstart; i<lablen; i++) {
854  c= *p++;
855  if ((c&~128) < 32 || (c&~128) == 127) return adns_s_invaliddata;
856  if (c == '.' && !neednorm) neednorm= 1;
857  else if (c==' ' || c>=127 || ctype_822special(c)) needquote++;
858  else neednorm= 0;
859  }
860 
861  if (needquote || neednorm) {
862  r= adns__vbuf_ensure(vb, lablen+needquote+4); if (!r) R_NOMEM;
863  adns__vbuf_appendq(vb,(byte*)"\"",1);
864  for (i=0, needquote=0, p= pai->dgram+labstart; i<lablen; i++, p++) {
865  c= *p;
866  if (c == '"' || c=='\\') adns__vbuf_appendq(vb,(byte*)"\\",1);
867  adns__vbuf_appendq(vb,p,1);
868  }
869  adns__vbuf_appendq(vb,(byte*)"\"",1);
870  } else {
871  r= adns__vbuf_append(vb, pai->dgram+labstart, lablen); if (!r) R_NOMEM;
872  }
873 
874  r= adns__vbuf_appendstr(vb,"@"); if (!r) R_NOMEM;
875 
876  st= adns__parse_domain_more(&fls,pai->ads, pai->qu,vb,0, pai->dgram);
877  if (st) return st;
878 
879  x_ok:
880  str= adns__alloc_interim(pai->qu, (size_t) vb->used+1); if (!str) R_NOMEM;
881  memcpy(str,vb->buf,(size_t) vb->used);
882  str[vb->used]= 0;
883  *mb_r= str;
884  return adns_s_ok;
885 }
#define max(a, b)
Definition: svc.c:63
adns_query qu
Definition: internal.h:117
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
void * adns__alloc_interim(adns_query qu, size_t sz)
Definition: query.c:342
adns_status adns__findlabel_next(findlabel_state *fls, int *lablen_r, int *labstart_r)
Definition: parse.c:74
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int fls(int x)
Definition: bitops.h:157
int adns__vbuf_ensure(vbuf *vb, int want)
Definition: general.c:116
adns_status
Definition: adns.h:215
int adns__vbuf_append(vbuf *vb, const byte *data, int len)
Definition: general.c:131
const WCHAR * str
void adns__vbuf_appendq(vbuf *vb, const byte *data, int len)
Definition: general.c:126
#define R_NOMEM
Definition: types.c:40
adns_status adns__parse_domain_more(findlabel_state *fls, adns_state ads, adns_query qu, vbuf *vb, parsedomain_flags flags, const byte *dgram)
Definition: parse.c:127
const GLubyte * c
Definition: glext.h:8905
int adns__vbuf_appendstr(vbuf *vb, const char *data)
Definition: general.c:149
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: internal.h:110
byte * buf
Definition: internal.h:112
static int ctype_822special(int c)
Definition: internal.h:702
int used
Definition: internal.h:111
const byte * dgram
Definition: internal.h:119
void adns__findlabel_start(findlabel_state *fls, adns_state ads, int serv, adns_query qu, const byte *dgram, int dglen, int max, int dmbegin, int *dmend_rlater)
Definition: parse.c:59
#define c
Definition: ke_i.h:80
GLfloat GLfloat p
Definition: glext.h:8902
adns_state ads
Definition: internal.h:116
int dglen
Definition: internal.h:120

Referenced by pap_mailbox().

◆ pap_qstring()

static adns_status pap_qstring ( const parseinfo pai,
int cbyte_io,
int  max,
int len_r,
char **  str_r 
)
static

Definition at line 84 of file types.c.

85  {
86  /* Neither len_r nor str_r may be null.
87  * End of datagram (overrun) is indicated by returning adns_s_invaliddata;
88  */
89  const byte *dgram= pai->dgram;
90  int l, cbyte;
91  char *str;
92 
93  cbyte= *cbyte_io;
94 
95  if (cbyte >= max) return adns_s_invaliddata;
96  GET_B(cbyte,l);
97  if (cbyte+l > max) return adns_s_invaliddata;
98 
99  str= adns__alloc_interim(pai->qu, (size_t)l+1);
100  if (!str) R_NOMEM;
101 
102  str[l]= 0;
103  memcpy(str,dgram+cbyte,(size_t)l);
104 
105  *len_r= l;
106  *str_r= str;
107  *cbyte_io= cbyte+l;
108 
109  return adns_s_ok;
110 }
#define max(a, b)
Definition: svc.c:63
adns_query qu
Definition: internal.h:117
#define GET_B(cb, tv)
Definition: internal.h:716
void * adns__alloc_interim(adns_query qu, size_t sz)
Definition: query.c:342
const WCHAR * str
#define R_NOMEM
Definition: types.c:40
static int cbyte
Definition: adnsresfilter.c:73
r l[0]
Definition: byte_order.h:167
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const byte * dgram
Definition: internal.h:119

Referenced by pa_hinfo(), and pa_txt().

◆ search_sortlist()

static int search_sortlist ( adns_state  ads,
struct in_addr  ad 
)
static

Definition at line 249 of file types.c.

249  {
250  const struct sortlist *slp;
251  int i;
252 
253  for (i=0, slp=ads->sortlist;
254  i<ads->nsortlist && !((ad.s_addr & slp->mask.s_addr) == slp->base.s_addr);
255  i++, slp++);
256  return i;
257 }
adns_state ads
Definition: adh-query.c:35
u32_t s_addr
Definition: inet.h:45
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct adns__state::sortlist sortlist[MAXSORTLIST]

Referenced by dip_inaddr().

Variable Documentation

◆ typeinfos

const typeinfo typeinfos[]
static
Initial value:
= {
FLAT_TYPE(a, "A", 0, inaddr, pa_inaddr, di_inaddr, cs_inaddr ),
DEEP_TYPE(ns_raw, "NS", "raw", str, pa_host_raw,0, cs_domain ),
DEEP_TYPE(cname, "CNAME", 0, str, pa_dom_raw, 0, cs_domain ),
DEEP_TYPE(soa_raw,"SOA", "raw", soa, pa_soa, 0, cs_soa ),
DEEP_TYPE(ptr_raw,"PTR", "raw", str, pa_host_raw,0, cs_domain ),
DEEP_TYPE(hinfo, "HINFO", 0, intstrpair, pa_hinfo, 0, cs_hinfo ),
DEEP_TYPE(mx_raw, "MX", "raw", intstr, pa_mx_raw, di_mx_raw, cs_inthost ),
DEEP_TYPE(txt, "TXT", 0, manyistr, pa_txt, 0, cs_txt ),
DEEP_TYPE(rp_raw, "RP", "raw", strpair, pa_rp, 0, cs_rp ),
DEEP_TYPE(ns, "NS", "+addr", hostaddr, pa_hostaddr,di_hostaddr,cs_hostaddr ),
DEEP_TYPE(ptr, "PTR","checked",str, pa_ptr, 0, cs_domain ),
DEEP_TYPE(mx, "MX", "+addr", inthostaddr,pa_mx, di_mx, cs_inthostaddr),
DEEP_TYPE(soa, "SOA","822", soa, pa_soa, 0, cs_soa ),
DEEP_TYPE(rp, "RP", "822", strpair, pa_rp, 0, cs_rp ),
}
#define DEEP_TYPE(code, rrt, fmt, memb, parser, comparer, printer)
Definition: types.c:997
static adns_status pa_soa(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:933
static adns_status cs_domain(vbuf *vb, const void *datap)
Definition: types.c:368
static adns_status cs_rp(vbuf *vb, const void *datap)
Definition: types.c:918
static int di_hostaddr(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:534
static adns_status pa_addr(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:288
static adns_status pa_hostaddr(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:512
static adns_status cs_hostaddr(vbuf *vb, const void *datap)
Definition: types.c:588
static adns_status cs_inthost(vbuf *vb, const void *datap)
Definition: types.c:675
static adns_status cs_txt(vbuf *vb, const void *datap)
Definition: types.c:210
static PVOID ptr
Definition: dispmode.c:27
static adns_status pa_hinfo(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:812
const WCHAR * str
static adns_status pa_inaddr(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:241
static int di_inaddr(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:269
static adns_status pa_host_raw(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:388
#define FLAT_TYPE(code, rrt, fmt, memb, parser, comparer, printer)
Definition: types.c:999
static adns_status cs_soa(vbuf *vb, const void *datap)
Definition: types.c:964
static adns_status pa_txt(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:178
static adns_status cs_inaddr(vbuf *vb, const void *datap)
Definition: types.c:275
static adns_status pa_rp(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:904
static adns_status pa_dom_raw(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:373
GLenum const GLvoid * addr
Definition: glext.h:9621
Definition: mxnamespace.c:44
static adns_status pa_ptr(const parseinfo *pai, int dmstart, int max, void *datap)
Definition: types.c:719
static adns_status pa_mx(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:627
static adns_status pa_mx_raw(const parseinfo *pai, int cbyte, int max, void *datap)
Definition: types.c:598
static adns_status cs_inthostaddr(vbuf *vb, const void *datap)
Definition: types.c:661
static int di_addr(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:300
static int di_mx(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:643
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static adns_status cs_hinfo(vbuf *vb, const void *datap)
Definition: types.c:227
static adns_status cs_addr(vbuf *vb, const void *datap)
Definition: types.c:331
static int di_mx_raw(adns_state ads, const void *datap_a, const void *datap_b)
Definition: types.c:615

Definition at line 1002 of file types.c.

Referenced by adns__findtype().