当前位置: 首页>>代码示例>>C++>>正文


C++ DNSServiceProcessResult函数代码示例

本文整理汇总了C++中DNSServiceProcessResult函数的典型用法代码示例。如果您正苦于以下问题:C++ DNSServiceProcessResult函数的具体用法?C++ DNSServiceProcessResult怎么用?C++ DNSServiceProcessResult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DNSServiceProcessResult函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ProcessDNSMessages

void ProcessDNSMessages() {
	static boolean initialized;
	
	if ( !initialized ) {
		initialized = true;
		DNSServiceErrorType err = DNSServiceBrowse ( 
													&browseRef, 
													0,					/* flags */
													0,					/* interface */
													serviceName, 
													NULL,				/* domain */
													DNSServiceBrowseReplyCallback, 
													NULL				/* context */
													);  
		if ( err != kDNSServiceErr_NoError ) {
			printf( "DNSServiceBrowse error\n" );
			return;
		}		
	}
	
	// poll the socket for updates
	int	socket = DNSServiceRefSockFD( browseRef );
	if ( socket <= 0 ) {
		return;
	}
	fd_set	set;
	FD_ZERO( &set );
	FD_SET( socket, &set );
	
	struct timeval tv;
	memset( &tv, 0, sizeof( tv ) );
	if ( select( socket+1, &set, NULL, NULL, &tv ) > 0 ) {
		DNSServiceProcessResult( browseRef );
	}	
}
开发者ID:KoalaWarfare,项目名称:DOOM-IOS2,代码行数:35,代码来源:iphone_net.c

示例2: lock

void CZeroconfWIN::ProcessResults()
{
  CSingleLock lock(m_data_guard);
  DNSServiceErrorType err = DNSServiceProcessResult(m_service);
  if (err != kDNSServiceErr_NoError)
    CLog::Log(LOGERROR, "ZeroconfWIN: DNSServiceProcessResult returned (error = %ld)", (int) err);
}
开发者ID:2BReality,项目名称:xbmc,代码行数:7,代码来源:ZeroconfWIN.cpp

示例3: 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;
}
开发者ID:M-o-a-T,项目名称:owfs,代码行数:26,代码来源:ow_browse.c

示例4: DNSServiceRefSockFD

void AutoDiscoveryServerImpl::update()
{
    int dns_sd_fd  = client    ? DNSServiceRefSockFD(client   ) : -1;
    int nfds = dns_sd_fd + 1;
    fd_set readfds;
    struct timeval tv;
    int result;
    
//     (dns_sd_fd2 > dns_sd_fd) nfds = dns_sd_fd2 + 1;

    // 1. Set up the fd_set as usual here.
    // This example client has no file descriptors of its own,
    // but a real application would call FD_SET to add them to the set here
    FD_ZERO(&readfds);

    // 2. Add the fd for our client(s) to the fd_set
    if (client   ) FD_SET(dns_sd_fd , &readfds);
    //if (client_pa) FD_SET(dns_sd_fd2, &readfds);

    // 3. Set up the timeout.
    tv.tv_sec  = 0;
    tv.tv_usec = 0;

    result = select(nfds, &readfds, (fd_set*)NULL, (fd_set*)NULL, &tv);
    if (result > 0)
    {
        DNSServiceErrorType err = kDNSServiceErr_NoError;
        if      (client    && FD_ISSET(dns_sd_fd , &readfds)) err = DNSServiceProcessResult(client   );
//        else if (client_pa && FD_ISSET(dns_sd_fd2, &readfds)) err = DNSServiceProcessResult(client_pa);
//        if (err) { fprintf(stderr, "DNSServiceProcessResult returned %d\n", err); stopNow = 1; }
    }
}
开发者ID:yueying,项目名称:osg,代码行数:32,代码来源:AutoDiscoveryWinImpl.cpp

示例5: wxASSERT

void *	wxServiceDiscoveryTaskBase::wxServiceDiscoveryServiceHelperThread::Entry()
{
		//	static wxCriticalSection section;
		//	wxCriticalSectionLocker section_locker( section );
		
		wxASSERT( ! wxThread::IsMain() );
		
		bool cancel_running = false;
		DNSServiceErrorType err = kDNSServiceErr_NoError; 
		
		do
		{
			err = DNSServiceProcessResult( m_ServiceRef );
			
			if ( err )
			{
				if ( err == kDNSServiceErr_Unknown )
				{
					wxLogDebug( wxT("Received an unknown bonjour error, but this was probably just a method of quitting our thread.") );
				}
				else
				{
					wxLogDebug( wxT("got error!  %d"),
								err );
				}
				cancel_running = true;
			}
			
		} while ( ! TestDestroy() && !cancel_running );
		
		return NULL;
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:32,代码来源:servicediscoverytaskbase.cpp

示例6: 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;
}
开发者ID:A600,项目名称:xbmc,代码行数:26,代码来源:ZeroconfBrowserWIN.cpp

示例7: FD_ZERO

 ConnectionError Client::recv( int timeout )
 {
   if( m_connection && m_connection->state() == StateConnected )
     return ClientBase::recv( timeout );
   else
   {
     if( !m_currentRef )
       return ConnNoError;
     
     struct timeval tv;
     
     fd_set fds;
     FD_ZERO( &fds );
     // the following causes a C4127 warning in VC++ Express 2008 and possibly other versions.
     // however, the reason for the warning can't be fixed in gloox.
     FD_SET( DNSServiceRefSockFD( m_currentRef ), &fds );
     
     tv.tv_sec = timeout / 1000000;
     tv.tv_usec = timeout % 1000000;
     
     if( select( FD_SETSIZE, &fds, 0, 0, timeout == -1 ? 0 : &tv ) > 0 )
     {
       if( FD_ISSET( DNSServiceRefSockFD( m_currentRef ), &fds ) != 0 )
         DNSServiceProcessResult( m_currentRef );
     }
     
     return ConnNoError;
   }
 }
开发者ID:crazyit,项目名称:iGame,代码行数:29,代码来源:linklocalclient.cpp

示例8: DNSServiceProcessResult

void ZeroconfBrowser::socketReadyRead()
{
	DNSServiceErrorType err = DNSServiceProcessResult(m_DnsServiceRef);
	if (err != kDNSServiceErr_NoError) {
		emit error(err);
	}
}
开发者ID:donggeol,项目名称:OSjumper,代码行数:7,代码来源:ZeroconfBrowser.cpp

示例9: register_service

  void register_service(DNSServiceRef service) {
    // Run until break.
    int dns_sd_fd = DNSServiceRefSockFD(service);
    fd_set readfds;
    struct timeval tv;
    int result;

    while (should_run()) {
      FD_ZERO(&readfds);
      FD_SET(dns_sd_fd, &readfds);
      tv.tv_sec = LONG_TIME;
      tv.tv_usec = 0;
                      // highest fd in set + 1
      result = select(dns_sd_fd+1, &readfds, (fd_set*)NULL, (fd_set*)NULL, &tv);
      if (result > 0) {
        DNSServiceErrorType err = kDNSServiceErr_NoError;
        // Execute callback
        if (FD_ISSET(dns_sd_fd, &readfds)) err = DNSServiceProcessResult(service);

        if (err) {
          // An error occured. Halt.
          fprintf(stderr, "DNSServiceProcessResult returned %d\n", err);
          quit();
        }
      }	else if (errno != EINTR) {
        // Error.
        fprintf(stderr, "ZeroConf error (%d %s)\n", errno, strerror(errno));
        if (errno != EINTR) quit();
      }
    }
  }
开发者ID:aspeteRakete,项目名称:oscit,代码行数:31,代码来源:zeroconf_registration.cpp

示例10: _ptpip_enumerate

static void
_ptpip_enumerate (
	DNSServiceRef sdRef, DNSServiceFlags flags,
	uint32_t interfaceIndex, DNSServiceErrorType errorCode,
	const char *serviceName, const char *regtype, const char *replyDomain,
	void *context
) {
	struct mdnsinfo mdnsi;
	DNSServiceRef		sd;

	if (errorCode != kDNSServiceErr_NoError) {
		gp_log (GP_LOG_ERROR, "ptpip", "Error on _ptp._tcp query.");
		return;
	}
	gp_log (GP_LOG_DEBUG, "ptpip", "found %s, %s, %s", serviceName, regtype, replyDomain);
	mdnsi.list = context;
	mdnsi.name = serviceName;
	DNSServiceResolve (&sd,
		0,
		interfaceIndex,
		serviceName,
		regtype,
		replyDomain,
		_ptpip_resolved,
		&mdnsi
	);
	DNSServiceProcessResult (sd);
	DNSServiceRefDeallocate (sd);
}
开发者ID:CastorGemini,项目名称:libgphoto2,代码行数:29,代码来源:ptpip.c

示例11: _SocketCallBack

/* static */ void
_SocketCallBack(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void* data, void* info) {

	DNSServiceErrorType err;
	__CFNetServiceBrowser* browser = info;

	(void)s;		// unused
	(void)type;		// unused
	(void)address;  // unused
	(void)data;		// unused

	CFRetain(browser);

	// Dispatch to process the result
	err = DNSServiceProcessResult(browser->_browse);

	// If there was an error, need to infor the client.
	if (err) {

		// Dispatch based upon search type.
		if (browser->_domainSearch)
			_DomainEnumReply(browser->_browse, 0, 0, err, NULL, info);
		else
			_BrowseReply(browser->_browse, 0, 0, err, NULL, NULL, NULL, info);
	}

	CFRelease(browser);
}
开发者ID:jmgao,项目名称:CFNetwork,代码行数:28,代码来源:CFNetServiceBrowser.c

示例12: assert

bool MLNetServiceHub::pollService(DNSServiceRef dnsServiceRef, double timeOutInSeconds, DNSServiceErrorType &err)
{
	assert(dnsServiceRef);

	err = kDNSServiceErr_NoError;
	
  fd_set readfds;
	FD_ZERO(&readfds);
	
  int dns_sd_fd = DNSServiceRefSockFD(dnsServiceRef);
  int nfds = dns_sd_fd+1;
	FD_SET(dns_sd_fd, &readfds);
	
  struct timeval tv;
  tv.tv_sec = long(floor(timeOutInSeconds));
  tv.tv_usec = long(1000000*(timeOutInSeconds - tv.tv_sec));
	
	int result = select(nfds,&readfds,NULL,NULL,&tv);
	if(result>0 && FD_ISSET(dns_sd_fd, &readfds))
	{
		err = DNSServiceProcessResult(dnsServiceRef);
		return true;
	}
	
	return false;
}
开发者ID:EQ4,项目名称:madronalib,代码行数:26,代码来源:MLNetServiceHub.cpp

示例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);
	}
}
开发者ID:Leon555,项目名称:Mac-src-essentials,代码行数:34,代码来源:mshow.c

示例14: dlog

LONG
CSecondPage::OnServiceEvent(WPARAM inWParam, LPARAM inLParam)
{
	if (WSAGETSELECTERROR(inLParam) && !(HIWORD(inLParam)))
    {
		dlog( kDebugLevelError, "OnServiceEvent: window error\n" );
    }
    else
    {
		SOCKET sock = (SOCKET) inWParam;

		// iterate thru list
		ServiceRefList::iterator begin = m_serviceRefList.begin();
		ServiceRefList::iterator end   = m_serviceRefList.end();

		while (begin != end)
		{
			DNSServiceRef ref = *begin++;

			check(ref != NULL);

			if ((SOCKET) DNSServiceRefSockFD(ref) == sock)
			{
				DNSServiceProcessResult(ref);
				break;
			}
		}
	}

	return ( 0 );
}
开发者ID:HQarroum,项目名称:android-mdns,代码行数:31,代码来源:SecondPage.cpp

示例15: switch

LRESULT CALLBACK wxServiceDiscoveryTaskBase::WndProc(HWND inWindow,
													 UINT inMsg,
													 WPARAM inWParam,
													 LPARAM inLParam ) 
{ 
    LRESULT result; 
    switch(inMsg) 
	{ 
        case DNSSD_EVENT: 
			// Process the DNS-SD event. All DNS-SD callbacks occur from 
			// within this function. 
			{
				void * ptr = GetProp( inWindow, PROPNAME );

				wxServiceDiscoveryTaskBase * self = reinterpret_cast<wxServiceDiscoveryTaskBase *>( ptr );

				if (DNSServiceProcessResult( self->m_rServiceRef ) != kDNSServiceErr_NoError) 
					result = -1; 
				else 
					result = 0; 
			}
			break; 

		case WM_NCDESTROY:

			RemoveProp( inWindow, PROPNAME );
			// fall through

        default: 
			result = DefWindowProc(inWindow, inMsg, inWParam, inLParam); 
			break; 
	} 
    return(result); 
} 
开发者ID:stahta01,项目名称:wxCode_components,代码行数:34,代码来源:servicediscoverytaskbase.cpp


注:本文中的DNSServiceProcessResult函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。