sresolv
1.12.11
|
00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2005 Nokia Corporation. 00005 * 00006 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation; either version 2.1 of 00011 * the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 * 00023 */ 00024 00025 #ifndef SOFIA_RESOLV_SRES_CACHE_H 00026 00027 #define SOFIA_RESOLV_SRES_CACHE_H 00028 00043 #include "sofia-resolv/sres_config.h" 00044 00045 #ifdef __cplusplus 00046 extern "C" { 00047 #endif 00048 00049 #ifndef SRES_CACHE_T 00050 #define SRES_CACHE_T 00051 00052 typedef struct sres_cache sres_cache_t; 00053 #endif 00054 00055 #ifndef SRES_RECORD_T 00056 #define SRES_RECORD_T 00057 00058 typedef union sres_record sres_record_t; 00059 #endif 00060 00061 enum { 00063 SRES_CACHE_TIMER_INTERVAL = 5, 00064 #define SRES_CACHE_TIMER_INTERVAL (SRES_CACHE_TIMER_INTERVAL) 00065 }; 00066 00068 SRESPUBFUN sres_cache_t *sres_cache_new(int n); 00069 00071 SRESPUBFUN sres_cache_t *sres_cache_ref(sres_cache_t *); 00072 00074 SRESPUBFUN void sres_cache_unref(sres_cache_t *); 00075 00077 SRESPUBFUN int sres_cache_get(sres_cache_t *cache, 00078 uint16_t type, 00079 char const *domain, 00080 sres_record_t ***return_cached); 00081 00083 SRESPUBFUN int sres_cache_filter(sres_cache_t *cache, 00084 sres_record_t **answers, 00085 uint16_t type); 00086 00088 SRESPUBFUN void sres_cache_free_answers(sres_cache_t *, sres_record_t **); 00089 00091 SRESPUBFUN void sres_cache_free_one(sres_cache_t *, sres_record_t *answer); 00092 00094 SRESPUBFUN 00095 sres_record_t **sres_cache_copy_answers(sres_cache_t *, sres_record_t **); 00096 00098 SRESPUBFUN void sres_cache_clean(sres_cache_t *cache, time_t now); 00099 00101 SRESPUBFUN 00102 sres_record_t *sres_cache_alloc_record(sres_cache_t *cache, 00103 sres_record_t const *template, 00104 size_t extra); 00105 00107 SRESPUBFUN void sres_cache_free_record(sres_cache_t *cache, void *rr); 00108 00110 SRESPUBFUN void sres_cache_store(sres_cache_t *, sres_record_t *, time_t now); 00111 00113 SRESPUBFUN int sres_cache_set_srv_priority(sres_cache_t *, 00114 char const *domain, 00115 char const *target, 00116 uint16_t port, 00117 uint32_t newttl, 00118 uint16_t newprio); 00119 00120 #ifdef __cplusplus 00121 } 00122 #endif 00123 00124 #endif /* SOFIA_RESOLV_SRES_CACHED_H */