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


C++ Browser::remove_service方法代码示例

本文整理汇总了C++中Browser::remove_service方法的典型用法代码示例。如果您正苦于以下问题:C++ Browser::remove_service方法的具体用法?C++ Browser::remove_service怎么用?C++ Browser::remove_service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Browser的用法示例。


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

示例1: browse_callback

    void Browser::browse_callback(AvahiServiceBrowser *b,
				  AvahiIfIndex interface,
				  AvahiProtocol protocol,
				  AvahiBrowserEvent event,
				  const char *name,
				  const char *type,
				  const char *domain,
				  AvahiLookupResultFlags,
				  void* data)
    {
	assert(b);
	AvahiClient *client = avahi_service_browser_get_client(b);
	assert(data);
	Browser *browser = static_cast<Browser *>(data);

	switch (event) {
	case AVAHI_BROWSER_FAILURE:
	    cerr << "[Browser] " << avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))) << endl;
	    throw BrowserError(avahi_client_errno(client));
	    //a->Stop();
	    return;

	case AVAHI_BROWSER_NEW:
	    //cerr << "[Browser] New service '" << name << "' of type '" << type << "' in domain '" << domain << "'" << endl;

	    if (!(avahi_service_resolver_new(client, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC,
					     (AvahiLookupFlags)0, resolve_callback, browser)))
		cerr << "Failed to resolve service '" << name << "': " << avahi_strerror(avahi_client_errno(client)) << endl;
	    break;

	case AVAHI_BROWSER_REMOVE:
	    //cerr << "[Browser] Removed service " << name << " of type " << type << " in domain " << domain << endl;
	    // XXX Remove cached service, broadcast
	    browser->remove_service(name);
	    break;

	case AVAHI_BROWSER_ALL_FOR_NOW:
	    //cerr << "[Browser] All for now." << endl;
	    break;

	case AVAHI_BROWSER_CACHE_EXHAUSTED:
	    //cerr << "[Browser] Cache exhausted." << endl;
	    break;
	}
    }
开发者ID:mhaberler,项目名称:directoryd,代码行数:45,代码来源:Browser.cpp


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