Back to index

glibc  2.9
Defines | Functions
res_comp.c File Reference
#include <sys/types.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <ctype.h>
#include <resolv.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <shlib-compat.h>

Go to the source code of this file.

Defines

#define PERIOD   0x2e
#define hyphenchar(c)   ((c) == 0x2d)
#define underscorechar(c)   ((c) == 0x5f)
#define bslashchar(c)   ((c) == 0x5c)
#define periodchar(c)   ((c) == PERIOD)
#define asterchar(c)   ((c) == 0x2a)
#define alphachar(c)
#define digitchar(c)   ((c) >= 0x30 && (c) <= 0x39)
#define borderchar(c)   (alphachar(c) || digitchar(c))
#define middlechar(c)   (borderchar(c) || hyphenchar(c) || underscorechar(c))
#define domainchar(c)   ((c) > 0x20 && (c) < 0x7f)

Functions

int dn_expand (const u_char *msg, const u_char *eom, const u_char *src, char *dst, int dstsiz)
 libresolv_hidden_def (dn_expand)
 libresolv_hidden_def (dn_comp)
 libresolv_hidden_def (dn_skipname)
 libresolv_hidden_def (res_hnok)
int res_mailok (const char *dn)
int res_dnok (const char *dn)
 libresolv_hidden_def (res_dnok)
 libresolv_hidden_def (__putlong)
 libresolv_hidden_def (__putshort)
u_int16_t _getshort (const u_char *src)

Define Documentation

#define alphachar (   c)
Value:
(((c) >= 0x41 && (c) <= 0x5a) \
                 || ((c) >= 0x61 && (c) <= 0x7a))
#define asterchar (   c)    ((c) == 0x2a)
#define borderchar (   c)    (alphachar(c) || digitchar(c))
#define bslashchar (   c)    ((c) == 0x5c)
#define digitchar (   c)    ((c) >= 0x30 && (c) <= 0x39)
#define domainchar (   c)    ((c) > 0x20 && (c) < 0x7f)
#define hyphenchar (   c)    ((c) == 0x2d)
#define middlechar (   c)    (borderchar(c) || hyphenchar(c) || underscorechar(c))
#define PERIOD   0x2e
#define periodchar (   c)    ((c) == PERIOD)
#define underscorechar (   c)    ((c) == 0x5f)

Function Documentation

Definition at line 251 of file res_comp.c.

{ return (ns_get16(src)); }

Here is the call graph for this function:

int dn_expand ( const u_char msg,
const u_char eom,
const u_char src,
char *  dst,
int  dstsiz 
)

Definition at line 90 of file res_comp.c.

{
       int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz);

       if (n > 0 && dst[0] == '.')
              dst[0] = '\0';
       return (n);
}

Here is the call graph for this function:

Definition at line 99 of file res_comp.c.

{
       return (ns_name_compress(src, dst, (size_t)dstsiz,
                             (const u_char **)dnptrs,
                             (const u_char **)lastdnptr));
}

Here is the call graph for this function:

Definition at line 114 of file res_comp.c.

                                                  {
       const u_char *saveptr = ptr;

       if (ns_name_skip(&ptr, eom) == -1)
              return (-1);
       return (ptr - saveptr);
}

Here is the call graph for this function:

Definition at line 127 of file res_comp.c.

                         {
       int ppch = '\0', pch = PERIOD, ch = *dn++;

       while (ch != '\0') {
              int nch = *dn++;

              if (periodchar(ch)) {
                     (void)NULL;
              } else if (periodchar(pch)) {
                     if (!borderchar(ch))
                            return (0);
              } else if (periodchar(nch) || nch == '\0') {
                     if (!borderchar(ch))
                            return (0);
              } else {
                     if (!middlechar(ch))
                            return (0);
              }
              ppch = pch, pch = ch, ch = nch;
       }
       return (1);
}

Here is the call graph for this function:

Definition at line 176 of file res_comp.c.

                          {
       if (asterchar(dn[0])) {
              if (periodchar(dn[1]))
                     return (res_hnok(dn+2));
              if (dn[1] == '\0')
                     return (1);
       }
       return (res_hnok(dn));
}

Here is the call graph for this function:

Definition at line 234 of file res_comp.c.

                                           { ns_put32(src, dst); }

Here is the call graph for this function:

libresolv_hidden_def ( __putlong  )

Definition at line 246 of file res_comp.c.

                                            { ns_put16(src, dst); }

Here is the call graph for this function:

libresolv_hidden_def ( __putshort  )

Definition at line 248 of file res_comp.c.

                                      { return (ns_get32(src)); }

Here is the call graph for this function:

int res_dnok ( const char *  dn)

Definition at line 226 of file res_comp.c.

                         {
       int ch;

       while ((ch = *dn++) != '\0')
              if (!domainchar(ch))
                     return (0);
       return (1);
}

Here is the call graph for this function:

int res_mailok ( const char *  dn)

Definition at line 198 of file res_comp.c.

                           {
       int ch, escaped = 0;

       /* "." is a valid missing representation */
       if (*dn == '\0')
              return (1);

       /* otherwise <label>.<hostname> */
       while ((ch = *dn++) != '\0') {
              if (!domainchar(ch))
                     return (0);
              if (!escaped && periodchar(ch))
                     break;
              if (escaped)
                     escaped = 0;
              else if (bslashchar(ch))
                     escaped = 1;
       }
       if (periodchar(ch))
              return (res_hnok(dn));
       return (0);
}

Here is the call graph for this function: