Kaydet (Commit) dcae25c5 authored tarafından Siqi LIU's avatar Siqi LIU

server-end bonjour protocol implementation

Change-Id: I2676d5ebb7da232141769c44b7e5de13c257954d
üst 6037852b
#include "DiscoveryService.cxx"
\ No newline at end of file
/* -*- 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: */
/* -*- 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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment