rfc1035.cc File Reference
#include "squid.h"
#include "dns/rfc1035.h"
#include "dns/rfc2671.h"
#include "util.h"
#include <cassert>
#include <cstring>
Include dependency graph for rfc1035.cc:

Go to the source code of this file.

Macros

#define RFC1035_MAXLABELSZ   63
 
#define rfc1035_unpack_error   15
 
#define RFC1035_UNPACK_DEBUG   (void)0
 

Functions

int rfc1035HeaderPack (char *buf, size_t sz, rfc1035_message *hdr)
 
static int rfc1035LabelPack (char *buf, size_t sz, const char *label)
 
static int rfc1035NamePack (char *buf, size_t sz, const char *name)
 
int rfc1035QuestionPack (char *buf, const size_t sz, const char *name, const unsigned short type, const unsigned short _class)
 
int rfc1035HeaderUnpack (const char *buf, size_t sz, unsigned int *off, rfc1035_message *h)
 
static int rfc1035NameUnpack (const char *buf, size_t sz, unsigned int *off, unsigned short *rdlength, char *name, size_t ns, int rdepth)
 
int rfc1035RRPack (char *buf, const size_t sz, const rfc1035_rr *RR)
 
static int rfc1035RRUnpack (const char *buf, size_t sz, unsigned int *off, rfc1035_rr *RR)
 
const char * rfc1035ErrorMessage (int n)
 
void rfc1035RRDestroy (rfc1035_rr **rr, int n)
 
static int rfc1035QueryUnpack (const char *buf, size_t sz, unsigned int *off, rfc1035_query *query)
 
void rfc1035MessageDestroy (rfc1035_message **msg)
 
int rfc1035QueryCompare (const rfc1035_query *a, const rfc1035_query *b)
 
int rfc1035MessageUnpack (const char *buf, size_t sz, rfc1035_message **answer)
 
ssize_t rfc1035BuildAQuery (const char *hostname, char *buf, size_t sz, unsigned short qid, rfc1035_query *query, ssize_t edns_sz)
 
ssize_t rfc1035BuildPTRQuery (const struct in_addr addr, char *buf, size_t sz, unsigned short qid, rfc1035_query *query, ssize_t edns_sz)
 
void rfc1035SetQueryID (char *buf, unsigned short qid)
 

Macro Definition Documentation

◆ RFC1035_MAXLABELSZ

#define RFC1035_MAXLABELSZ   63

Definition at line 40 of file rfc1035.cc.

◆ RFC1035_UNPACK_DEBUG

#define RFC1035_UNPACK_DEBUG   (void)0

Definition at line 46 of file rfc1035.cc.

◆ rfc1035_unpack_error

#define rfc1035_unpack_error   15

Definition at line 41 of file rfc1035.cc.

Function Documentation

◆ rfc1035BuildAQuery()

◆ rfc1035BuildPTRQuery()

◆ rfc1035ErrorMessage()

const char * rfc1035ErrorMessage ( int  n)

◆ rfc1035HeaderPack()

◆ rfc1035HeaderUnpack()

◆ rfc1035LabelPack()

static int rfc1035LabelPack ( char *  buf,
size_t  sz,
const char *  label 
)
static

Definition at line 101 of file rfc1035.cc.

References assert, and RFC1035_MAXLABELSZ.

Referenced by rfc1035NamePack().

◆ rfc1035MessageDestroy()

◆ rfc1035MessageUnpack()

◆ rfc1035NamePack()

static int rfc1035NamePack ( char *  buf,
size_t  sz,
const char *  name 
)
static

Definition at line 126 of file rfc1035.cc.

References assert, rfc1035LabelPack(), xfree, and xstrdup.

Referenced by rfc1035QuestionPack(), and rfc1035RRPack().

◆ rfc1035NameUnpack()

static int rfc1035NameUnpack ( const char *  buf,
size_t  sz,
unsigned int off,
unsigned short *  rdlength,
char *  name,
size_t  ns,
int  rdepth 
)
static

◆ rfc1035QueryCompare()

int rfc1035QueryCompare ( const rfc1035_query a,
const rfc1035_query b 
)

Definition at line 550 of file rfc1035.cc.

References _rfc1035_query::name, _rfc1035_query::qclass, and _rfc1035_query::qtype.

Referenced by idnsGrokReply().

◆ rfc1035QueryUnpack()

static int rfc1035QueryUnpack ( const char *  buf,
size_t  sz,
unsigned int off,
rfc1035_query query 
)
static

◆ rfc1035QuestionPack()

int rfc1035QuestionPack ( char *  buf,
const size_t  sz,
const char *  name,
const unsigned short  type,
const unsigned short  _class 
)

Definition at line 149 of file rfc1035.cc.

References assert, and rfc1035NamePack().

Referenced by rfc1035BuildAQuery(), rfc1035BuildPTRQuery(), and rfc3596BuildHostQuery().

◆ rfc1035RRDestroy()

void rfc1035RRDestroy ( rfc1035_rr **  rr,
int  n 
)

Definition at line 483 of file rfc1035.cc.

References xfree.

Referenced by rfc1035MessageDestroy().

◆ rfc1035RRPack()

int rfc1035RRPack ( char *  buf,
const size_t  sz,
const rfc1035_rr RR 
)

◆ rfc1035RRUnpack()

static int rfc1035RRUnpack ( const char *  buf,
size_t  sz,
unsigned int off,
rfc1035_rr RR 
)
static

◆ rfc1035SetQueryID()

void rfc1035SetQueryID ( char *  buf,
unsigned short  qid 
)

Definition at line 739 of file rfc1035.cc.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors