summaryrefslogtreecommitdiffstats
path: root/x11vnc/screen.c
diff options
context:
space:
mode:
authorrunge <runge>2007-02-12 23:44:39 +0000
committerrunge <runge>2007-02-12 23:44:39 +0000
commit241f3ed566d34bf5b6c67ebebcc00727134d93b2 (patch)
treee42ddc70dc6a50503a2e22aef238c7a1fde7fb43 /x11vnc/screen.c
parent0016cd4280ee9a0d088454a508a9c7f6bde33f62 (diff)
downloadlibtdevnc-241f3ed566d34bf5b6c67ebebcc00727134d93b2.tar.gz
libtdevnc-241f3ed566d34bf5b6c67ebebcc00727134d93b2.zip
x11vnc: add avahi (aka mDNS/Zeroconf/Bonjour...) support thanks to Diego Petteno. add -find -create
Diffstat (limited to 'x11vnc/screen.c')
-rw-r--r--x11vnc/screen.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/x11vnc/screen.c b/x11vnc/screen.c
index 3d4ee0c..e8d6dbc 100644
--- a/x11vnc/screen.c
+++ b/x11vnc/screen.c
@@ -23,6 +23,7 @@
#include "linuxfb.h"
#include "macosx.h"
#include "macosxCG.h"
+#include "avahi.h"
#include <rfb/rfbclient.h>
@@ -2888,6 +2889,13 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
install_passwds();
}
+#define DO_AVAHI \
+ if (avahi) { \
+ avahi_initialise(); \
+ avahi_advertise(vnc_desktop_name, host, lport); \
+ usleep(1000*1000); \
+ }
+
void announce(int lport, int ssl, char *iface) {
char *host = this_host();
@@ -2911,17 +2919,20 @@ void announce(int lport, int ssl, char *iface) {
if (lport >= 5900) {
snprintf(vnc_desktop_name, sz, "%s:%d",
host, lport - 5900);
+ DO_AVAHI
fprintf(stderr, "\n%s %s\n", tvdt,
vnc_desktop_name);
} else {
snprintf(vnc_desktop_name, sz, "%s:%d",
host, lport);
+ DO_AVAHI
fprintf(stderr, "\n%s %s\n", tvdt,
vnc_desktop_name);
}
} else if (lport >= 5900) {
snprintf(vnc_desktop_name, sz, "%s:%d",
host, lport - 5900);
+ DO_AVAHI
fprintf(stderr, "\n%s %s\n", tvdt, vnc_desktop_name);
if (lport >= 6000) {
rfbLog("possible aliases: %s:%d, "
@@ -2931,6 +2942,7 @@ void announce(int lport, int ssl, char *iface) {
} else {
snprintf(vnc_desktop_name, sz, "%s:%d",
host, lport);
+ DO_AVAHI
fprintf(stderr, "\n%s %s\n", tvdt, vnc_desktop_name);
rfbLog("possible alias: %s::%d\n",
host, lport);