summaryrefslogtreecommitdiffstats
path: root/avahi-common
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-06-24 19:38:29 +0000
committerLennart Poettering <lennart@poettering.net>2005-06-24 19:38:29 +0000
commit36c53c0c4c5764f4a5f14b2b49b9f3c7ef8d9adb (patch)
treec3d93d7627aca6b26648e7588c2456638cf49380 /avahi-common
parent9962a048634c590db23a00db1d01daada779844c (diff)
* update default TTL generation to match RFC
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@145 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-common')
-rw-r--r--avahi-common/rr.c8
-rw-r--r--avahi-common/rr.h10
2 files changed, 11 insertions, 7 deletions
diff --git a/avahi-common/rr.c b/avahi-common/rr.c
index 13160fc..b0c03a9 100644
--- a/avahi-common/rr.c
+++ b/avahi-common/rr.c
@@ -70,7 +70,7 @@ void avahi_key_unref(AvahiKey *k) {
}
}
-AvahiRecord *avahi_record_new(AvahiKey *k) {
+AvahiRecord *avahi_record_new(AvahiKey *k, guint32 ttl) {
AvahiRecord *r;
g_assert(k);
@@ -81,19 +81,19 @@ AvahiRecord *avahi_record_new(AvahiKey *k) {
memset(&r->data, 0, sizeof(r->data));
- r->ttl = AVAHI_DEFAULT_TTL;
+ r->ttl = ttl != (guint32) -1 ? ttl : AVAHI_DEFAULT_TTL;
return r;
}
-AvahiRecord *avahi_record_new_full(const gchar *name, guint16 class, guint16 type) {
+AvahiRecord *avahi_record_new_full(const gchar *name, guint16 class, guint16 type, guint32 ttl) {
AvahiRecord *r;
AvahiKey *k;
g_assert(name);
k = avahi_key_new(name, class, type);
- r = avahi_record_new(k);
+ r = avahi_record_new(k, ttl);
avahi_key_unref(k);
return r;
diff --git a/avahi-common/rr.h b/avahi-common/rr.h
index da0b285..13e6a4c 100644
--- a/avahi-common/rr.h
+++ b/avahi-common/rr.h
@@ -48,7 +48,11 @@ enum {
AVAHI_DNS_UNICAST_RESPONSE = 0x8000
};
-#define AVAHI_DEFAULT_TTL (120*60)
+/** The default TTL for RRs which contain a host name of some kind. */
+#define AVAHI_DEFAULT_TTL_HOST_NAME (120)
+
+/** The default TTL for all other records. */
+#define AVAHI_DEFAULT_TTL (75*60)
typedef struct {
guint ref;
@@ -112,8 +116,8 @@ gboolean avahi_key_is_pattern(const AvahiKey *k);
guint avahi_key_hash(const AvahiKey *k);
-AvahiRecord *avahi_record_new(AvahiKey *k);
-AvahiRecord *avahi_record_new_full(const gchar *name, guint16 class, guint16 type);
+AvahiRecord *avahi_record_new(AvahiKey *k, guint32 ttl);
+AvahiRecord *avahi_record_new_full(const gchar *name, guint16 class, guint16 type, guint32 ttl);
AvahiRecord *avahi_record_ref(AvahiRecord *r);
void avahi_record_unref(AvahiRecord *r);