Back to index

courier  0.68.2
Defines | Functions | Variables
rfc1035str.c File Reference
#include "rfc1035.h"
#include <string.h>

Go to the source code of this file.

Defines

#define COMPARE(a, b)   stricmp((a), (b))

Functions

void rfc1035_type_itostr (int n, void(*func)(const char *, void *), void *arg)
int rfc1035_type_strtoi (const char *n)
const char * rfc1035_class_itostr (int n)
int rfc1035_class_strtoi (const char *n)
const char * rfc1035_opcode_itostr (int n)
int rfc1035_opcode_strtoi (const char *n)
const char * rfc1035_rcode_itostr (int n)
int rfc1035_rcode_strtoi (const char *n)

Variables

struct {
const char * name
int num
typetab []
struct {
const char * name
int num
classtab []
struct {
const char * name
int num
opcodetab []
struct {
const char * name
int num
rcodetab []

Define Documentation

#define COMPARE (   a,
 
)    stricmp((a), (b))

Definition at line 58 of file rfc1035str.c.


Function Documentation

const char* rfc1035_class_itostr ( int  n)

Definition at line 89 of file rfc1035str.c.

{
unsigned i;

       for (i=0; i<sizeof(classtab)/sizeof(classtab[0]); i++)
              if (classtab[i].num == n) return (classtab[i].name);
       return ("unknown");
}

Here is the caller graph for this function:

int rfc1035_class_strtoi ( const char *  n)

Definition at line 98 of file rfc1035str.c.

{
unsigned i;

       for (i=0; i<sizeof(classtab)/sizeof(classtab[0]); i++)
              if (COMPARE(classtab[i].name, n) == 0) return (classtab[i].num);
       return (-1);
}

Here is the caller graph for this function:

const char* rfc1035_opcode_itostr ( int  n)

Definition at line 107 of file rfc1035str.c.

{
unsigned i;

       for (i=0; i<sizeof(opcodetab)/sizeof(opcodetab[0]); i++)
              if (opcodetab[i].num == n) return (opcodetab[i].name);
       return ("unknown");
}

Here is the caller graph for this function:

int rfc1035_opcode_strtoi ( const char *  n)

Definition at line 116 of file rfc1035str.c.

{
unsigned i;

       for (i=0; i<sizeof(opcodetab)/sizeof(opcodetab[0]); i++)
              if (COMPARE(opcodetab[i].name, n) == 0)
                            return (opcodetab[i].num);
       return (-1);
}
const char* rfc1035_rcode_itostr ( int  n)

Definition at line 126 of file rfc1035str.c.

{
unsigned i;

       for (i=0; i<sizeof(rcodetab)/sizeof(rcodetab[0]); i++)
              if (rcodetab[i].num == n) return (rcodetab[i].name);
       return ("unknown");
}

Here is the caller graph for this function:

int rfc1035_rcode_strtoi ( const char *  n)

Definition at line 135 of file rfc1035str.c.

{
unsigned i;

       for (i=0; i<sizeof(rcodetab)/sizeof(rcodetab[0]); i++)
              if (COMPARE(rcodetab[i].name, n) == 0)
                            return (rcodetab[i].num);
       return (-1);
}
void rfc1035_type_itostr ( int  n,
void(*)(const char *, void *)  func,
void *  arg 
)

Definition at line 61 of file rfc1035str.c.

{
       unsigned i;
       char buf[30];

       for (i=0; i<sizeof(typetab)/sizeof(typetab[0]); i++)
              if (typetab[i].num == n)
              {
                     (*func)(typetab[i].name, arg);
                     return;
              }

       snprintf(buf, sizeof(buf), "TYPE%d", n);

       buf[sizeof(buf)-1]=0;

       (*func)(buf, arg);
}

Here is the caller graph for this function:

int rfc1035_type_strtoi ( const char *  n)

Definition at line 80 of file rfc1035str.c.

{
unsigned i;

       for (i=0; i<sizeof(typetab)/sizeof(typetab[0]); i++)
              if (COMPARE(typetab[i].name, n) == 0) return (typetab[i].num);
       return (-1);
}

Here is the caller graph for this function:


Variable Documentation

struct { ... } classtab[] [static]
struct { ... } opcodetab[] [static]
struct { ... } rcodetab[] [static]
struct { ... } typetab[] [static]