summaryrefslogtreecommitdiff
path: root/src/lacdns-cache.h
blob: e1d868337d9832bca24677516c5e5ce66ffbafc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- */

/*  Lac - Library for asynchronous communication
 *  Copyright (C) 2002  Søren Sandmann (sandmann@daimi.au.dk)
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public
 *  License along with this library; if not, write to the 
 *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 *  Boston, MA  02111-1307, USA.
 */

#include "lac.h"
#include "lacdns-messages.h"

typedef enum {
    CACHE_NOTHING_KNOWN,      /* not known whether name even exists */
    CACHE_NO_SUCH_NAME,       /* name does not exist */
    CACHE_NAME_EXISTS,        /* name exists, but nothing known
                               * about this type of data
                               */
    CACHE_NO_DATA,            /* name exists and has no data of this type */
    CACHE_DATA_FOUND,         /* name exists and has data of this type */
} CacheResultType;

typedef struct CacheResult CacheResult;
struct CacheResult {
    CacheResultType     type;
    RRType              rr_type;
    GList *             records;        /* of pointer to const RData */
};

CacheResult *cache_lookup              (const DomainName     *name,
                                        RRType                type);
CacheResult *cache_lookup_recursive    (const DomainName     *name,
                                        RRType                type);
RData       *cache_lookup_cname        (const DomainName     *name);
RData       *cache_lookup_soa          (const DomainName     *name);
void         cache_result_free         (CacheResult          *result);
void         cache_insert_positive     (const ResourceRecord *rr,
                                        gboolean             *cname_cycle);
void         cache_insert_no_such_name (const DomainName     *name,
                                        guint                 time_to_live);
void         cache_insert_no_data      (const DomainName     *name,
                                        RRType                type,
                                        guint32               time_to_live);
void         cache_delete_by_type      (const DomainName     *name,
                                        RRType                type);
void         cache_delete_rdata        (const DomainName     *name,
                                        const RData          *rdata);