public static string JoinServiceName(string name, string type, string domain)
{
int len = 4 * (name.Length + type.Length + domain.Length) + 4;
IntPtr buf = Stdlib.malloc ((ulong) len);
int ret = avahi_service_name_join (buf, len,
Utility.StringToBytes (name),
Utility.StringToBytes (type),
Utility.StringToBytes (domain));
if (ret < 0) {
Utility.Free (buf);
return null; // FIXME, should throw exception
}
string service = Utility.PtrToString (buf);
Utility.Free (buf);
return service;
}