Commit 98aa3085 authored by Mickaël Turnel's avatar Mickaël Turnel

Add name parameter in case we need multiple mDNS services on same machine

parent d29416f7
...@@ -34,6 +34,7 @@ BELLE_SIP_BEGIN_DECLS ...@@ -34,6 +34,7 @@ BELLE_SIP_BEGIN_DECLS
* @param service the queried service ("sip", "stun", "turn"...). * @param service the queried service ("sip", "stun", "turn"...).
* @param transport the queried transport ("udp", "tcp", "tls"). * @param transport the queried transport ("udp", "tcp", "tls").
* @param domain the local domain name in which the service will be registered. * @param domain the local domain name in which the service will be registered.
* @param name the name of the mdns service, if NULL it is the computer's name. Only useful for multiple registrations to avoid conflicts.
* @param port the port of the service. * @param port the port of the service.
* @param priority the priority of the service, lower value means more preferred. * @param priority the priority of the service, lower value means more preferred.
* @param weight a relative weight for services within the same local domain that have the same priority, higher value means more preferred. * @param weight a relative weight for services within the same local domain that have the same priority, higher value means more preferred.
...@@ -41,7 +42,7 @@ BELLE_SIP_BEGIN_DECLS ...@@ -41,7 +42,7 @@ BELLE_SIP_BEGIN_DECLS
* @param data a user pointer passed through the callback as first argument. * @param data a user pointer passed through the callback as first argument.
* @return a #belle_sip_register_t that can be used to cancel the registration if needed. The context must have been ref'd with belle_sip_object_ref(). * @return a #belle_sip_register_t that can be used to cancel the registration if needed. The context must have been ref'd with belle_sip_object_ref().
**/ **/
BELLESIP_EXPORT belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const char *transport, const char *domain, int port, int prio, int weight, belle_sip_mdns_register_callback_t cb, void *data); BELLESIP_EXPORT belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const char *transport, const char *domain, const char* name, int port, int prio, int weight, belle_sip_mdns_register_callback_t cb, void *data);
/** /**
* Cancels the mdns registration. * Cancels the mdns registration.
......
...@@ -119,7 +119,7 @@ void *mdns_register_poll(void *data) { ...@@ -119,7 +119,7 @@ void *mdns_register_poll(void *data) {
return NULL; return NULL;
} }
belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const char *transport, const char *domain, int port, int prio, int weight, belle_sip_mdns_register_callback_t cb, void *data) { belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const char *transport, const char *domain, const char *name, int port, int prio, int weight, belle_sip_mdns_register_callback_t cb, void *data) {
belle_sip_mdns_register_t *reg = belle_sip_mdns_register_create(cb, data); belle_sip_mdns_register_t *reg = belle_sip_mdns_register_create(cb, data);
DNSServiceErrorType error; DNSServiceErrorType error;
TXTRecordRef txt_ref; TXTRecordRef txt_ref;
...@@ -140,7 +140,7 @@ belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const ch ...@@ -140,7 +140,7 @@ belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const ch
error = DNSServiceRegister(&reg->service_ref error = DNSServiceRegister(&reg->service_ref
, 0 , 0
, 0 , 0
, NULL , name
, prefix , prefix
, domain , domain
, NULL , NULL
...@@ -154,7 +154,7 @@ belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const ch ...@@ -154,7 +154,7 @@ belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const ch
TXTRecordDeallocate(&txt_ref); TXTRecordDeallocate(&txt_ref);
if (error != kDNSServiceErr_NoError) { if (error != kDNSServiceErr_NoError) {
belle_sip_error("%s Register error [%s%s]: code %d", __FUNCTION__, prefix, domain, error); belle_sip_error("%s Register error [_%s._%s.%s]: code %d", __FUNCTION__, service, transport, domain, error);
belle_sip_object_unref(reg); belle_sip_object_unref(reg);
return NULL; return NULL;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment