summaryrefslogtreecommitdiffstats
path: root/avahi-common
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-08-16 01:29:28 +0000
committerLennart Poettering <lennart@poettering.net>2005-08-16 01:29:28 +0000
commitee4cc41fafaac0a2d76c1c791f6d43a6b6d937a7 (patch)
tree2fed674760fcb3031faac25e6bb5bd019cfad151 /avahi-common
parent91c63aa9b11519356a319d28a134fa3693da02a9 (diff)
* start implementing error handling in avahi-client
* doxygen document timeval.h * add two more AVAHI_GCC_SENTINELs git-svn-id: file:///home/lennart/svn/public/avahi/trunk@350 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-common')
-rw-r--r--avahi-common/dbus.h3
-rw-r--r--avahi-common/domain.h8
-rw-r--r--avahi-common/error.c5
-rw-r--r--avahi-common/error.h3
-rw-r--r--avahi-common/timeval.h17
5 files changed, 28 insertions, 8 deletions
diff --git a/avahi-common/dbus.h b/avahi-common/dbus.h
index e3aef6c..3b27421 100644
--- a/avahi-common/dbus.h
+++ b/avahi-common/dbus.h
@@ -60,7 +60,8 @@ AVAHI_C_DECL_BEGIN
#define AVAHI_DBUS_ERR_DBUS_ERROR "org.freedesktop.Avahi.DBusError"
#define AVAHI_DBUS_ERR_NOT_CONNECTED "org.freedesktop.Avahi.NotConnectedError"
#define AVAHI_DBUS_ERR_NO_MEMORY "org.freedesktop.Avahi.NoMemoryError"
-#define AVAHI_DBUS_ERR_INVALID_OBJECT "org.freedesktop.Avahi.InvalidObject"
+#define AVAHI_DBUS_ERR_INVALID_OBJECT "org.freedesktop.Avahi.InvalidObjectError"
+#define AVAHI_DBUS_ERR_NO_DAEMON "org.freedesktop.Avahi.NoDaemonError"
AVAHI_C_DECL_END
diff --git a/avahi-common/domain.h b/avahi-common/domain.h
index c9cc39e..88cf4d3 100644
--- a/avahi-common/domain.h
+++ b/avahi-common/domain.h
@@ -1,5 +1,5 @@
#ifndef foodomainhfoo
-#define foodimainhfoo
+#define foodomainhfoo
/* $Id$ */
@@ -30,7 +30,9 @@
#include <avahi-common/cdecl.h>
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
+#endif
/** Normalize a domain name into canonical form. This drops trailing
* dots and removes useless backslash escapes. avahi_free() the
@@ -68,8 +70,8 @@ int avahi_is_valid_host_name(const char *t);
/** Return some kind of hash value for the domain, useful for using domains as hash table keys. */
unsigned avahi_domain_hash(const char *name);
-
-
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
+#endif
#endif
diff --git a/avahi-common/error.c b/avahi-common/error.c
index 0635161..67a5701 100644
--- a/avahi-common/error.c
+++ b/avahi-common/error.c
@@ -48,8 +48,9 @@ const char *avahi_strerror(int error) {
"Invalid operation",
"An unexpected DBUS error occured",
"Could not get a connection to the daemon",
- "Memory exhausted"
- "The object passed in was not valid"
+ "Memory exhausted",
+ "The object passed in was not valid",
+ "Daemon not running",
};
if (-error < 0 || -error >= -AVAHI_ERR_MAX)
diff --git a/avahi-common/error.h b/avahi-common/error.h
index 2cdda5f..b367ffb 100644
--- a/avahi-common/error.h
+++ b/avahi-common/error.h
@@ -56,6 +56,7 @@ enum {
AVAHI_ERR_NOT_CONNECTED = -23, /**< Could not get a connection to the daemon */
AVAHI_ERR_NO_MEMORY = -24, /**< Memory exhausted */
AVAHI_ERR_INVALID_OBJECT = -25, /**< The object passed to this function was invalid */
+ AVAHI_ERR_NO_DAEMON = -26, /**< Daemon not running */
/****
**** IF YOU ADD A NEW ERROR CODE HERE, PLEASE DON'T FORGET TO ADD
@@ -66,7 +67,7 @@ enum {
**** Also remember to update the MAX value below.
****/
- AVAHI_ERR_MAX = -26
+ AVAHI_ERR_MAX = -27
};
/** Return a human readable error string for the specified error code */
diff --git a/avahi-common/timeval.h b/avahi-common/timeval.h
index c046a19..5bbe1a7 100644
--- a/avahi-common/timeval.h
+++ b/avahi-common/timeval.h
@@ -27,17 +27,32 @@
#include <avahi-common/cdecl.h>
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_BEGIN
+#endif
+/** A numeric data type for storing microsecond values. (signed 64bit integer) */
typedef int64_t AvahiUsec;
+/** Compare two timeval structures and return a ngeative value when a < b, 0 when a == b and a positive value otherwise */
int avahi_timeval_compare(const struct timeval *a, const struct timeval *b);
+
+/** Calculate the difference between to timeval structures as microsecond value */
AvahiUsec avahi_timeval_diff(const struct timeval *a, const struct timeval *b);
+
+/** Add a number of microseconds to the specified timeval structure and return it. *a is modified. */
struct timeval* avahi_timeval_add(struct timeval *a, AvahiUsec usec);
+/** Return the difference between the current time and *a. Positive if *a was earlier */
AvahiUsec avahi_age(const struct timeval *a);
-struct timeval *avahi_elapse_time(struct timeval *tv, unsigned msec, unsigned jitter);
+/** Fill *tv with the current time plus "ms" milliseconds plus an
+ * extra jitter of "j" milliseconds. Pass 0 for j if you don't want
+ * the jitter */
+struct timeval *avahi_elapse_time(struct timeval *tv, unsigned ms, unsigned j);
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
AVAHI_C_DECL_END
+#endif
#endif