Print error if dnssd library not available
[deb_shairplay.git] / src / test / dnssd_test.m
CommitLineData
2340bcd3
JVH
1#include <stdlib.h>
2#include <stdio.h>
3#include <unistd.h>
4#include <Foundation/Foundation.h>
5
6#include "dnssd.h"
7#include "compat.h"
8
9int
10main(int argc, char *argv[])
11{
12 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
13 const char hwaddr[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB };
14 dnssd_t *dnssd;
15
067f00ef 16 dnssd = dnssd_init(NULL);
2340bcd3
JVH
17 if (!dnssd) {
18 printf("Failed to init dnssd\n");
19 return -1;
20 }
067f00ef
JVH
21 dnssd_register_raop(dnssd, "Test", 5000, hwaddr, sizeof(hwaddr));
22 dnssd_register_airplay(dnssd, "Test", 6000, hwaddr, sizeof(hwaddr));
2340bcd3
JVH
23
24 sleepms(60000);
25
26 dnssd_unregister_raop(dnssd);
27 dnssd_unregister_airplay(dnssd);
28 dnssd_destroy(dnssd);
29 [pool release];
30
31 return 0;
32}