rfc1035.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef SQUID_RFC1035_H
10#define SQUID_RFC1035_H
11
12#if HAVE_SYS_TYPES_H
13#include <sys/types.h>
14#endif
15#if HAVE_NETINET_IN_H
16#include <netinet/in.h>
17#endif
18#if HAVE_ARPA_INET_H
19#include <arpa/inet.h>
20#endif
21
22#include "rfc2181.h"
23
32#define RFC1035_MAXHOSTNAMESZ RFC2181_MAXHOSTNAMELEN
33
34#define RFC1035_DEFAULT_PACKET_SZ 512
35
37{
38public:
40 unsigned short type;
41 unsigned short _class;
42 unsigned int ttl;
43 unsigned short rdlength;
44 char *rdata;
45};
46
50 unsigned short qtype;
51 unsigned short qclass;
52};
53
56 unsigned short id;
57 unsigned int qr:1;
58 unsigned int opcode:4;
59 unsigned int aa:1;
60 unsigned int tc:1;
61 unsigned int rd:1;
62 unsigned int ra:1;
63 unsigned int rcode:4;
64 unsigned short qdcount;
65 unsigned short ancount;
66 unsigned short nscount;
67 unsigned short arcount;
70};
71
72SQUIDCEXTERN ssize_t rfc1035BuildAQuery(const char *hostname,
73 char *buf,
74 size_t sz,
75 unsigned short qid,
76 rfc1035_query * query,
77 ssize_t edns_sz);
78SQUIDCEXTERN ssize_t rfc1035BuildPTRQuery(const struct in_addr,
79 char *buf,
80 size_t sz,
81 unsigned short qid,
82 rfc1035_query * query,
83 ssize_t edns_sz);
84SQUIDCEXTERN void rfc1035SetQueryID(char *, unsigned short qid);
85SQUIDCEXTERN int rfc1035MessageUnpack(const char *buf,
86 size_t sz,
87 rfc1035_message ** answer);
91SQUIDCEXTERN const char * rfc1035ErrorMessage(int n);
92
93#define RFC1035_TYPE_A 1
94#define RFC1035_TYPE_CNAME 5
95#define RFC1035_TYPE_PTR 12
96#define RFC1035_CLASS_IN 1
97
98/* Child Library RFC3596 Depends on some otherwise internal functions */
100 size_t sz,
101 rfc1035_message * hdr);
102SQUIDCEXTERN int rfc1035HeaderUnpack(const char *buf,
103 size_t sz,
104 unsigned int *off,
105 rfc1035_message * h);
107 size_t sz,
108 const char *name,
109 const unsigned short type,
110 const unsigned short _class);
111SQUIDCEXTERN int rfc1035RRPack(char *buf, size_t sz, const rfc1035_rr * RR);
112
113#endif /* SQUID_RFC1035_H */
114
unsigned short _class
Definition: rfc1035.h:41
char * rdata
Definition: rfc1035.h:44
char name[RFC1035_MAXHOSTNAMESZ]
Definition: rfc1035.h:39
unsigned short type
Definition: rfc1035.h:40
unsigned short rdlength
Definition: rfc1035.h:43
unsigned int ttl
Definition: rfc1035.h:42
int type
Definition: errorpage.cc:152
SQUIDCEXTERN const char * rfc1035ErrorMessage(int n)
Definition: rfc1035.cc:448
SQUIDCEXTERN ssize_t rfc1035BuildAQuery(const char *hostname, char *buf, size_t sz, unsigned short qid, rfc1035_query *query, ssize_t edns_sz)
Definition: rfc1035.cc:662
SQUIDCEXTERN int rfc1035QueryCompare(const rfc1035_query *, const rfc1035_query *)
Definition: rfc1035.cc:554
SQUIDCEXTERN ssize_t rfc1035BuildPTRQuery(const struct in_addr, char *buf, size_t sz, unsigned short qid, rfc1035_query *query, ssize_t edns_sz)
Definition: rfc1035.cc:701
SQUIDCEXTERN void rfc1035SetQueryID(char *, unsigned short qid)
Definition: rfc1035.cc:743
SQUIDCEXTERN void rfc1035RRDestroy(rfc1035_rr **rr, int n)
Definition: rfc1035.cc:487
#define RFC1035_MAXHOSTNAMESZ
Definition: rfc1035.h:32
SQUIDCEXTERN int rfc1035HeaderPack(char *buf, size_t sz, rfc1035_message *hdr)
Definition: rfc1035.cc:60
SQUIDCEXTERN int rfc1035QuestionPack(char *buf, size_t sz, const char *name, const unsigned short type, const unsigned short _class)
Definition: rfc1035.cc:153
SQUIDCEXTERN int rfc1035MessageUnpack(const char *buf, size_t sz, rfc1035_message **answer)
Definition: rfc1035.cc:588
SQUIDCEXTERN int rfc1035HeaderUnpack(const char *buf, size_t sz, unsigned int *off, rfc1035_message *h)
Definition: rfc1035.cc:184
SQUIDCEXTERN void rfc1035MessageDestroy(rfc1035_message **message)
Definition: rfc1035.cc:534
SQUIDCEXTERN int rfc1035RRPack(char *buf, size_t sz, const rfc1035_rr *RR)
Definition: rfc1035.cc:329
#define SQUIDCEXTERN
Definition: squid.h:21
unsigned short ancount
Definition: rfc1035.h:65
unsigned short nscount
Definition: rfc1035.h:66
unsigned int rd
Definition: rfc1035.h:61
unsigned int tc
Definition: rfc1035.h:60
unsigned short qdcount
Definition: rfc1035.h:64
unsigned int opcode
Definition: rfc1035.h:58
unsigned int rcode
Definition: rfc1035.h:63
unsigned int aa
Definition: rfc1035.h:59
rfc1035_rr * answer
Definition: rfc1035.h:69
unsigned short id
Definition: rfc1035.h:56
unsigned int ra
Definition: rfc1035.h:62
unsigned int qr
Definition: rfc1035.h:57
rfc1035_query * query
Definition: rfc1035.h:68
unsigned short arcount
Definition: rfc1035.h:67
unsigned short qclass
Definition: rfc1035.h:51
char name[RFC1035_MAXHOSTNAMESZ]
Definition: rfc1035.h:49
unsigned short qtype
Definition: rfc1035.h:50
void const char int sz
Definition: stub_cbdata.cc:16

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors