]> git.meshlink.io Git - catta/blobdiff - avahi-common/strlst.h
fix some small bugs in publishing and resolving, and make uninstall work
[catta] / avahi-common / strlst.h
index 78cffb47a064c7ddfea24607547a799dff681283..925e944110d0013be7dcc422c53e7925fbee1556 100644 (file)
   USA.
 ***/
 
+/** \file strlst.h Implementation of a data type to store lists of strings */
+
 #include <sys/types.h>
 #include <inttypes.h>
 #include <stdarg.h>
 
 #include <avahi-common/cdecl.h>
-
-/** \file strlst.h Implementation of a data type to store lists of strings */
+#include <avahi-common/gccmacro.h>
 
 AVAHI_C_DECL_BEGIN
 
@@ -47,7 +48,7 @@ typedef struct AvahiStringList {
 /** Create a new string list by taking a variable list of NUL
  * terminated strings. The strings are copied using g_strdup(). The
  * argument list must be terminated by a NULL pointer. */
-AvahiStringList *avahi_string_list_new(const char *txt, ...);
+AvahiStringList *avahi_string_list_new(const char *txt, ...) AVAHI_GCC_SENTINEL;
 
 /** Same as avahi_string_list_new() but pass a va_list structure */
 AvahiStringList *avahi_string_list_new_va(va_list va);
@@ -65,6 +66,12 @@ void avahi_string_list_free(AvahiStringList *l);
  * start. */
 AvahiStringList *avahi_string_list_add(AvahiStringList *l, const char *text);
 
+/** Append a new NUL terminated formatted string to the specified string list */
+AvahiStringList *avahi_string_list_add_printf(AvahiStringList *l, const char *format, ...) AVAHI_GCC_PRINTF_ATTR23;
+
+/** Append a new NUL terminated formatted string to the specified string list */
+AvahiStringList *avahi_string_list_add_vprintf(AvahiStringList *l, const char *format, va_list va);
+
 /** Append an arbitrary length byte string to the list. Returns the
  * new list start. */
 AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const uint8_t *text, size_t size);
@@ -79,7 +86,7 @@ AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, size_t size)
 /** Same as avahi_string_list_add(), but takes a variable number of
  * NUL terminated strings. The argument list must be terminated by a
  * NULL pointer. Returns the new list start. */
-AvahiStringList *avahi_string_list_add_many(AvahiStringList *r, ...);
+AvahiStringList *avahi_string_list_add_many(AvahiStringList *r, ...) AVAHI_GCC_SENTINEL;
 
 /** Same as avahi_string_list_add_many(), but use a va_list
  * structure. Returns the new list start. */
@@ -109,6 +116,36 @@ AvahiStringList* avahi_string_list_reverse(AvahiStringList *l);
 /** Return the number of elements in the string list */
 unsigned avahi_string_list_length(const AvahiStringList *l);
 
+/** Find the string list entry for the given DNS-SD TXT key */
+AvahiStringList *avahi_string_list_find(AvahiStringList *l, const char *key);
+
+/** Return the DNS-SD TXT key and value for the specified string list
+ * item. If size is not NULL it will be filled with the length of
+ * value. (for strings containing NUL bytes). If the entry doesn't
+ * contain a value *value will be set to NULL. You need to
+ * avahi_free() the strings returned in *key and *value. */
+int avahi_string_list_get_pair(AvahiStringList *l, char **key, char **value, size_t *size);
+
+/** Add a new DNS-SD TXT key value pair to the string list. value may
+ * be NULL in case you want to specify a key without a value */
+AvahiStringList *avahi_string_list_add_pair(AvahiStringList *l, const char *key, const char *value);
+
+/** Same as avahi_string_list_add_pair() but allow strings containing NUL bytes in *value. */
+AvahiStringList *avahi_string_list_add_pair_arbitrary(AvahiStringList *l, const char *key, const uint8_t *value, size_t size);
+
+/** Returns the next item in the string list */
+AvahiStringList *avahi_string_list_get_next(AvahiStringList *l);
+
+/** Returns the text for the current item */
+uint8_t *avahi_string_list_get_text(AvahiStringList *l);
+
+/** Returns the size of the current text */
+size_t avahi_string_list_get_size(AvahiStringList *l);
+
+/** Try to find a magic service cookie in the specified DNS-SD string
+ * list. Or return AVAHI_SERVICE_COOKIE_INVALID if none is found. */
+uint32_t avahi_string_list_get_service_cookie(AvahiStringList *l);
+
 AVAHI_C_DECL_END
 
 #endif