+ list = avahi_string_list_add (list, Utility.StringToBytes (item));
+ }
+ }
+
+ AddService (iface, proto, flags, name, type, domain, host, port, list);
+ }
+
+ public void AddService (int iface, Protocol proto, PublishFlags flags, string name, string type, string domain,
+ string host, UInt16 port, params byte[][] txt)
+ {
+ IntPtr list = avahi_string_list_new (IntPtr.Zero);
+
+ if (txt != null) {
+ foreach (byte[] item in txt) {
+ list = avahi_string_list_add (list, item);
+ }
+ }
+
+ AddService (iface, proto, flags, name, type, domain, host, port, list);
+ }
+
+ private void AddService (int iface, Protocol proto, PublishFlags flags, string name, string type,
+ string domain, string host, UInt16 port, IntPtr list)
+ {
+ int ret = avahi_entry_group_add_service_strlst (handle, iface, proto, flags,
+ Utility.StringToBytes (name),
+ Utility.StringToBytes (type),
+ Utility.StringToBytes (domain),
+ Utility.StringToBytes (host), port, list);
+
+ avahi_string_list_free (list);
+
+ if (ret < 0) {
+ client.ThrowError ();
+ }
+ }
+
+ public void UpdateService (string name, string type, string domain, params string[] txt)
+ {
+ UpdateService (-1, Protocol.Unspecified, PublishFlags.None, name, type, domain, txt);
+ }
+
+ public void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
+ string domain, params string[] txt)
+ {
+ IntPtr list = avahi_string_list_new (IntPtr.Zero);
+
+ if (txt != null) {
+ foreach (string item in txt) {
+ list = avahi_string_list_add (list, Utility.StringToBytes (item));
+ }
+ }
+
+ UpdateService (iface, proto, flags, name, type, domain, list);
+ }
+
+ public void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
+ string domain, params byte[][] txt)
+ {
+ IntPtr list = avahi_string_list_new (IntPtr.Zero);
+
+ if (txt != null) {
+ foreach (byte[] item in txt) {
+ list = avahi_string_list_add (list, item);
+ }
+ }
+
+ UpdateService (iface, proto, flags, name, type, domain, list);
+ }
+
+ private void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
+ string domain, IntPtr list)
+ {
+ lock (client) {
+ int ret = avahi_entry_group_update_service_strlst (handle, iface, proto, flags,
+ Utility.StringToBytes (name),
+ Utility.StringToBytes (type),
+ Utility.StringToBytes (domain),
+ list);
+
+ avahi_string_list_free (list);
+
+ if (ret < 0) {
+ client.ThrowError ();