本文整理匯總了C++中DNSServiceRefDeallocate函數的典型用法代碼示例。如果您正苦於以下問題:C++ DNSServiceRefDeallocate函數的具體用法?C++ DNSServiceRefDeallocate怎麽用?C++ DNSServiceRefDeallocate使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DNSServiceRefDeallocate函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: DNSServiceResolve
bool CZeroconfBrowserWIN::doResolveService(CZeroconfBrowser::ZeroconfService& fr_service, double f_timeout)
{
DNSServiceErrorType err;
DNSServiceRef sdRef = NULL;
err = DNSServiceResolve(&sdRef, 0, kDNSServiceInterfaceIndexAny, fr_service.GetName(), fr_service.GetType(), fr_service.GetDomain(), ResolveCallback, &fr_service);
if( err != kDNSServiceErr_NoError )
{
if (sdRef)
DNSServiceRefDeallocate(sdRef);
CLog::Log(LOGERROR, "ZeroconfBrowserWIN: DNSServiceResolve returned (error = %ld)", (int) err);
return false;
}
err = DNSServiceProcessResult(sdRef);
if (err != kDNSServiceErr_NoError)
CLog::Log(LOGERROR, "ZeroconfBrowserWIN::doResolveService DNSServiceProcessResult returned (error = %ld)", (int) err);
if (sdRef)
DNSServiceRefDeallocate(sdRef);
return true;
}
示例2: lock
void CZeroconfMDNS::doStop()
{
{
CSingleLock lock(m_data_guard);
CLog::Log(LOGDEBUG, "ZeroconfMDNS: Shutdown services");
for(tServiceMap::iterator it = m_services.begin(); it != m_services.end(); ++it)
{
DNSServiceRefDeallocate(it->second.serviceRef);
TXTRecordDeallocate(&it->second.txtRecordRef);
CLog::Log(LOGDEBUG, "ZeroconfMDNS: Removed service %s", it->first.c_str());
}
m_services.clear();
}
{
CSingleLock lock(m_data_guard);
#if defined(TARGET_WINDOWS_STORE)
CLog::Log(LOGERROR, "ZeroconfMDNS: WSAAsyncSelect not yet supported for TARGET_WINDOWS_STORE");
#else
WSAAsyncSelect( (SOCKET) DNSServiceRefSockFD( m_service ), g_hWnd, BONJOUR_EVENT, 0 );
#endif //TARGET_WINDOWS
if (m_service)
DNSServiceRefDeallocate(m_service);
m_service = NULL;
}
}
示例3: FreeOutAll
void FreeOutAll(void)
{
struct connection_out *next = Outbound_Control.head;
struct connection_out *now;
Outbound_Control.head = NULL;
Outbound_Control.active = 0;
while (next) {
now = next;
next = now->next;
LEVEL_DEBUG("Freeing outbound %s #%d",now->zero.name,now->index);
SAFEFREE(now->zero.name) ;
SAFEFREE(now->zero.type) ;
SAFEFREE(now->zero.domain) ;
SAFEFREE(now->name) ;
SAFEFREE(now->host) ;
SAFEFREE(now->service) ;
if (now->ai) {
freeaddrinfo(now->ai);
now->ai = NULL;
}
#if OW_ZERO
if (libdnssd != NULL) {
if (now->sref0) {
DNSServiceRefDeallocate(now->sref0);
}
if (now->sref1) {
DNSServiceRefDeallocate(now->sref1);
}
}
#endif
owfree(now);
}
}
示例4: main
int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
DNSServiceRef ref1, ref2, ref3, ref4 = NULL;
DNSServiceRegister(&ref1, 0, 0, "simple", "_simple._tcp", NULL, NULL, 4711, 0, NULL, NULL, NULL);
DNSServiceRegister(&ref2, 0, 0, "subtype #1", "_simple._tcp,_subtype1", NULL, NULL, 4711, 0, NULL, NULL, NULL);
DNSServiceRegister(&ref3, 0, 0, "subtype #2", "_simple._tcp,_subtype1,_subtype2", NULL, NULL, 4711, 0, NULL, NULL, NULL);
DNSServiceRegister(&ref4, 0, 0, "subtype #3", "_simple._tcp,,", NULL, NULL, 4711, 0, NULL, NULL, NULL);
assert(!ref4);
DNSServiceRegister(&ref4, 0, 0, "subtype #3", "", NULL, NULL, 4711, 0, NULL, NULL, NULL);
assert(!ref4);
DNSServiceRegister(&ref4, 0, 0, "subtype #3", ",", NULL, NULL, 4711, 0, NULL, NULL, NULL);
assert(!ref4);
DNSServiceRegister(&ref4, 0, 0, "subtype #3", ",,", NULL, NULL, 4711, 0, NULL, NULL, NULL);
assert(!ref4);
DNSServiceBrowse(&ref4, 0, 0, "_simple._tcp,_gurke", NULL, reply, NULL);
sleep(20);
DNSServiceRefDeallocate(ref1);
DNSServiceRefDeallocate(ref2);
DNSServiceRefDeallocate(ref3);
DNSServiceRefDeallocate(ref4);
return 0;
}
示例5: player_sd_fini
void
player_sd_fini(player_sd_t* sd)
{
int i;
player_sd_mdns_t* mdns = (player_sd_mdns_t*)(sd->sdRef);
if(mdns->browseRef_valid)
{
DNSServiceRefDeallocate(mdns->browseRef);
mdns->browseRef_valid = 0;
}
for(i=0;i<mdns->mdnsDevs_len;i++)
{
if(mdns->mdnsDevs[i].valid)
{
DNSServiceRefDeallocate(mdns->mdnsDevs[i].regRef);
mdns->mdnsDevs[i].valid = 0;
}
}
pthread_mutex_destroy(&(mdns->mutex));
if(mdns->mdnsDevs)
free(mdns->mdnsDevs);
free(mdns);
free(sd);
}
示例6: WSAAsyncSelect
OSStatus
CConfigPropertySheet::TearDownBrowsing()
{
OSStatus err = kNoErr;
if ( m_browseDomainsRef )
{
err = WSAAsyncSelect( DNSServiceRefSockFD( m_browseDomainsRef ), m_hWnd, 0, 0 );
check_noerr( err );
DNSServiceRefDeallocate( m_browseDomainsRef );
m_browseDomainsRef = NULL;
}
if ( m_regDomainsRef )
{
err = WSAAsyncSelect( DNSServiceRefSockFD( m_regDomainsRef ), m_hWnd, 0, 0 );
check_noerr( err );
DNSServiceRefDeallocate( m_regDomainsRef );
m_regDomainsRef = NULL;
}
return err;
}
示例7: TerminateGameService
void TerminateGameService() {
if ( localServer ) {
localServer = false;
}
DNSServiceRefDeallocate( serviceRef );
memset( serviceInterfaces, 0, sizeof( serviceInterfaces ) );
}
示例8: mdns_main_free
static int
mdns_main_free(void)
{
struct mdns_service *s;
struct mdns_browser *mb;
struct mdns_record *r;
for(s = mdns_services; mdns_services; s = mdns_services)
{
mdns_services = s->next;
mdns_service_free(s);
}
for (mb = mdns_browsers; mdns_browsers; mb = mdns_browsers)
{
mdns_browsers = mb->next;
mdns_browser_free(mb);
}
for (r = mdns_records; mdns_records; r = mdns_records)
{
mdns_records = r->next;
mdns_record_free(r);
}
if(mdns_ev_main)
event_free(mdns_ev_main);
mdns_ev_main = NULL;
if(mdns_sdref_main)
DNSServiceRefDeallocate(mdns_sdref_main);
mdns_sdref_main = NULL;
return -1;
}
示例9: mdns_resolver_free
static int
mdns_resolver_free(struct mdns_resolver *rs) {
struct mdns_addr_lookup *lu;
if (! rs)
return -1;
/* free/cancel all lookups */
for(lu = rs->lookups; lu; lu = rs->lookups)
{
rs->lookups = lu->next;
mdns_addr_lookup_free(lu);
}
if(rs->timer)
event_free(rs->timer);
if(rs->sdref)
DNSServiceRefDeallocate(rs->sdref);
free(rs->service);
free(rs->regtype);
free(rs->domain);
free(rs);
return -1;
}
示例10: OW_Browse_Bonjour
// Called in a thread
static void * OW_Browse_Bonjour(void * v)
{
struct connection_in * in = v ;
DNSServiceErrorType dnserr;
DETACH_THREAD;
MONITOR_RLOCK ;
dnserr = DNSServiceBrowse(&in->master.browse.bonjour_browse, 0, 0, "_owserver._tcp", NULL, BrowseBack, NULL);
if (dnserr != kDNSServiceErr_NoError) {
LEVEL_CONNECT("DNSServiceBrowse error = %d", dnserr);
MONITOR_RUNLOCK ;
return VOID_RETURN ;
}
// Blocks, which is why this is in it's own thread
while (DNSServiceProcessResult(in->master.browse.bonjour_browse) == kDNSServiceErr_NoError) {
//printf("DNSServiceProcessResult ref %ld\n",(long int)rs->sref) ;
continue;
}
DNSServiceRefDeallocate(in->master.browse.bonjour_browse);
in->master.browse.bonjour_browse = 0 ;
MONITOR_RUNLOCK ;
return VOID_RETURN;
}
示例11: registration
void registration(Thread *thread) {
// release calling thread semaphore
thread->thread_ready();
DNSServiceErrorType error;
DNSServiceRef service;
error = DNSServiceRegister(&service,
0, // no flags
0, // all network interfaces
master_->name_.c_str(), // name
master_->service_type_.c_str(), // service type
"", // register in default domain(s)
NULL, // use default host name
htons(master_->port_),// port number
0, // length of TXT record
NULL, // no TXT record
Implementation::register_callback, // callback function
(void*)master_); // context
if (error == kDNSServiceErr_NoError) {
pthread_cleanup_push(registration_cleanup, &service);
register_service(service);
pthread_cleanup_pop(0); // 0 = do not execute on pop
} else {
fprintf(stderr,"Could not register service %s.%s on port %u (error %d)\n", master_->name_.c_str(), master_->service_type_.c_str(), master_->port_, error);//, strerror(errno));
}
DNSServiceRefDeallocate(service);
}
示例12: publish_main_service
static int publish_main_service(struct userdata *u) {
DNSServiceErrorType err;
TXTRecordRef txt;
pa_assert(u);
if (u->main_service) {
DNSServiceRefDeallocate(u->main_service);
u->main_service = NULL;
}
TXTRecordCreate(&txt, 0, NULL);
txt_record_server_data(u->core, &txt);
err = DNSServiceRegister(&u->main_service,
0, /* flags */
kDNSServiceInterfaceIndexAny,
u->service_name,
SERVICE_TYPE_SERVER,
NULL, /* domain */
NULL, /* host */
compute_port(u),
TXTRecordGetLength(&txt),
TXTRecordGetBytesPtr(&txt),
NULL, NULL);
if (err != kDNSServiceErr_NoError) {
pa_log("%s(): DNSServiceRegister() returned err %d", __func__, err);
return err;
}
TXTRecordDeallocate(&txt);
return 0;
}
示例13: socket_callback
/*
* CFRunloop callback that calls DNSServiceProcessResult() when
* there's new data on the socket.
*/
static void
socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void *data, void *context)
{
struct cbinfo *info = context;
DNSServiceErrorType err;
if (callbackType == kCFSocketNoCallBack) {
printf("socket_callback: kCFSocketNoCallBack?\n");
return;
}
if ((err = DNSServiceProcessResult(info->sdref)) != kDNSServiceErr_NoError) {
printf("DNSServiceProcessResult() returned an error! %d\n", err);
if (err == kDNSServiceErr_BadReference) {
printf("bad reference?: %p, %d, %p, %p %p\n", s, (int)callbackType, address, data, context);
return;
}
if ((context == &nfsinfo) || (context == &mountdinfo)) {
/* bail if there's a problem with the main browse connection */
exit(1);
}
/* dump the troublesome service connection */
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), info->rls, kCFRunLoopDefaultMode);
CFRelease(info->rls);
CFSocketInvalidate(info->sockref);
CFRelease(info->sockref);
DNSServiceRefDeallocate(info->sdref);
free(info);
}
}
示例14: dnssd_service_free_client
static void
dnssd_service_free_client(DNSServiceRef *client) {
if (*client) {
DNSServiceRefDeallocate(*client);
*client = NULL;
}
}
示例15: PR_CancelJob
void
CBFDNSSDService::Cleanup()
{
m_stopped = PR_TRUE;
if ( m_job )
{
PR_CancelJob( m_job );
m_job = NULL;
}
if ( m_threadPool != NULL )
{
PR_ShutdownThreadPool( m_threadPool );
m_threadPool = NULL;
}
if ( m_fileDesc != NULL )
{
PR_Close( m_fileDesc );
m_fileDesc = NULL;
}
if ( m_sdRef )
{
DNSServiceRefDeallocate( m_sdRef );
m_sdRef = NULL;
}
}