Commit 768bf9b8 authored by Mickaël Turnel's avatar Mickaël Turnel

Add stubs for mdns register functions

parent 5ac4a3e1
......@@ -29,6 +29,17 @@ typedef void (*belle_sip_mdns_register_callback_t)(void *data, int error);
BELLE_SIP_BEGIN_DECLS
#ifdef __cplusplus
extern "C"
{
#endif
/**
* Tells if multicast DNS is available.
* @return true if it is available, false otherwise.
**/
BELLESIP_EXPORT int belle_sip_mdns_register_available(void);
/**
* Asynchronously performs the mdns registration (advertisement).
* @param service the queried service ("sip", "stun", "turn"...).
......@@ -50,6 +61,10 @@ BELLESIP_EXPORT belle_sip_mdns_register_t *belle_sip_mdns_register(const char *s
**/
BELLESIP_EXPORT void belle_sip_mdns_unregister(belle_sip_mdns_register_t *context);
#ifdef __cplusplus
} /* end extern "C" */
#endif
BELLE_SIP_END_DECLS
#endif /* BELLE_SIP_MDNS_REGISTER_H */
\ No newline at end of file
#endif /* BELLE_SIP_MDNS_REGISTER_H */
......@@ -59,9 +59,6 @@ if(ZLIB_FOUND)
list(APPEND LIBS ${ZLIB_LIBRARIES})
endif()
if(DNSSD_FOUND)
set(MDNS_SOURCE_FILES_C
belle_sip_mdns_register.c
)
list(APPEND LIBS ${DNSSD_LIBRARIES})
endif()
if(WIN32)
......@@ -113,6 +110,7 @@ set(BELLE_SIP_SOURCE_FILES_C
belle_sip_headers_impl.c
belle_sip_internal.h
belle_sip_loop.c
belle_sip_mdns_register.c
belle_sip_object.c
belle_sip_parameters.c
belle_sip_resolver.c
......@@ -157,7 +155,6 @@ set(BELLE_SIP_SOURCE_FILES_C
${SDP_GENERATED_SOURCE_FILES_C}
${SIP_MESSAGE_GENERATED_SOURCE_FILES_C}
${TUNNEL_SOURCE_FILES_C}
${MDNS_SOURCE_FILES_C}
)
add_definitions(
......
......@@ -19,6 +19,7 @@
#include "belle_sip_internal.h"
#include <bctoolbox/defs.h>
#ifdef HAVE_MDNS
#include <dns_sd.h>
#ifndef _WIN32
......@@ -118,8 +119,18 @@ void *mdns_register_poll(void *data) {
return NULL;
}
#endif
int belle_sip_mdns_register_available(void) {
#ifdef HAVE_MDNS
return TRUE;
#else
return FALSE;
#endif
}
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) {
#ifdef HAVE_MDNS
belle_sip_mdns_register_t *reg = belle_sip_mdns_register_create(cb, data);
DNSServiceErrorType error;
TXTRecordRef txt_ref;
......@@ -167,9 +178,13 @@ belle_sip_mdns_register_t *belle_sip_mdns_register(const char *service, const ch
}
return reg;
#else
return NULL;
#endif
}
void belle_sip_mdns_unregister(belle_sip_mdns_register_t *reg) {
#ifdef HAVE_MDNS
if (!reg) return;
if (reg->running) {
......@@ -179,4 +194,5 @@ void belle_sip_mdns_unregister(belle_sip_mdns_register_t *reg) {
DNSServiceRefDeallocate(reg->service_ref);
belle_sip_object_unref(reg);
}
\ No newline at end of file
#endif
}
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