O2 2.0
A communication protocol for interactive music and media applications.
o2zcdisc.h
1// o2zcdisc.h -- ZeroConf interface and discovery
2//
3
4#ifndef O2_NO_ZEROCONF
5#ifdef __linux__
6#define USE_AVAHI 1
7#endif
8#ifdef __APPLE__
9#define USE_BONJOUR 1
10#endif
11#ifdef WIN32
12#define USE_BONJOUR 1
13#endif
14
15class Zc_info : public Proxy_info {
16public:
17 Fds_info *info;
18 Zc_info() : Proxy_info(NULL, O2TAG_ZC) { };
19 virtual ~Zc_info() { };
20
21 virtual O2err connected() { return O2_FAIL; } // we never connect
22 virtual O2err accepted(Fds_info *conn) { return O2_FAIL; } // not a server
23 virtual O2err deliver(O2netmsg_ptr msg) = 0;
24 bool local_is_synchronized() { return false; } // not a service
25};
26
27O2err o2_zcdisc_initialize();
28
29void o2_zc_register_record(int port);
30
31
32#ifdef USE_BONJOUR
33#include <dns_sd.h>
34
35class Bonjour_info : public Zc_info {
36public:
37 DNSServiceRef sd_ref; // use NULL to indicate the connection has ended
38 Bonjour_info(DNSServiceRef sr);
39 ~Bonjour_info();
40 virtual O2err deliver(O2netmsg_ptr msg);
41};
42
43
44#elif USE_AVAHI
45
46void o2_poll_avahi();
47void zc_cleanup();
48
49#endif
50
51#endif
Definition: o2network.h:147
Definition: o2node.h:291
Definition: o2zcdisc.h:15
O2err
return values used generally by O2 functions
Definition: o2.h:329
@ O2_FAIL
a non-specific error occurred.
Definition: o2.h:339
Definition: o2network.h:57