summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorSiqi LIU <me@siqi.fr>2013-07-19 19:06:17 +0200
committerSiqi LIU <me@siqi.fr>2013-07-19 19:06:17 +0200
commitdcae25c5edf083b4beabcd91215df686d7aa24f6 (patch)
tree36d11b23d99be93bd9b7fb2d6b606ff0bfab36ca /sd
parent6037852b701d42217e934eba4f1a53d1a7a6cfd1 (diff)
server-end bonjour protocol implementation
Change-Id: I2676d5ebb7da232141769c44b7e5de13c257954d
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/remotecontrol/DiscoveryService.mm1
-rw-r--r--sd/source/ui/remotecontrol/OSXNetworkService.h33
-rw-r--r--sd/source/ui/remotecontrol/OSXNetworkService.mm43
3 files changed, 77 insertions, 0 deletions
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.mm b/sd/source/ui/remotecontrol/DiscoveryService.mm
new file mode 100644
index 000000000000..3cad7cdfb61d
--- /dev/null
+++ b/sd/source/ui/remotecontrol/DiscoveryService.mm
@@ -0,0 +1 @@
+#include "DiscoveryService.cxx" \ No newline at end of file
diff --git a/sd/source/ui/remotecontrol/OSXNetworkService.h b/sd/source/ui/remotecontrol/OSXNetworkService.h
new file mode 100644
index 000000000000..f0af0dac655b
--- /dev/null
+++ b/sd/source/ui/remotecontrol/OSXNetworkService.h
@@ -0,0 +1,33 @@
+/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OSXNETWORKSERVICE_H
+#define INCLUDED_OSXNETWORKSERVICE_H
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+ #include <premac.h>
+ #import <CoreFoundation/CoreFoundation.h>
+ #import <Foundation/NSNetServices.h>
+ #import <Foundation/NSRunLoop.h>
+ #include <postmac.h>
+
+@interface OSXNetworkService : NSObject<NSNetServiceDelegate>
+{
+ NSNetService *netService;
+}
+
+- (void) publishImpressRemoteServiceOnLocalNetworkWithName:(NSString *)sName;
+
+@end
+
+#endif /* INCLUDED_OSXNETWORKSERVICE_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/remotecontrol/OSXNetworkService.mm b/sd/source/ui/remotecontrol/OSXNetworkService.mm
new file mode 100644
index 000000000000..0cbfb3e14349
--- /dev/null
+++ b/sd/source/ui/remotecontrol/OSXNetworkService.mm
@@ -0,0 +1,43 @@
+/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#include <osl/conditn.hxx> // Include this early to avoid error as check() gets defined by some SDK header to empty
+
+#include <premac.h>
+ #import <CoreFoundation/CoreFoundation.h>
+ #import "OSXNetworkService.h"
+#include <postmac.h>
+
+@implementation OSXNetworkService
+
+- (void) publishImpressRemoteServiceOnLocalNetworkWithName:(NSString *)sName
+{
+ netService = [[NSNetService alloc] initWithDomain:@"local" type:@"_impressremote._tcp" name:sName port:1599];
+
+ if (netService != nil)
+ {
+ [netService setDelegate:self];
+ [netService scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ [netService publish];
+ }
+}
+
+-(void)netService:(NSNetService *)aNetService
+ didNotPublish:(NSDictionary *)dict {
+ NSLog(@"Service did not publish: %@", dict);
+}
+
+- (void)dealloc {
+ [netService stop];
+ [netService release];
+ [super dealloc];
+}
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */