Fix python bindings to hold a reference to sessions
[deb_shairplay.git] / src / test / dnssd_test.c
CommitLineData
2340bcd3
JVH
1#include <stdlib.h>
2#include <stdio.h>
3#include <unistd.h>
4
5#include "dnssd.h"
6#include "compat.h"
7
8int
9main(int argc, char *argv[])
10{
11 const char hwaddr[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB };
12 dnssd_t *dnssd;
13
14
15#ifdef WIN32
16 WORD wVersionRequested;
17 WSADATA wsaData;
18
19 wVersionRequested = MAKEWORD(2, 2);
20 if (WSAStartup(wVersionRequested, &wsaData) != 0) {
21 return -1;
22 }
23 if (LOBYTE(wsaData.wVersion) != 2 ||
24 HIBYTE(wsaData.wVersion) != 2) {
25 return -1;
26 }
27#endif
28
067f00ef 29 dnssd = dnssd_init(NULL);
2340bcd3
JVH
30 if (!dnssd) {
31 printf("Failed to init dnssd\n");
32 return -1;
33 }
067f00ef
JVH
34 dnssd_register_raop(dnssd, "Test", 5000, hwaddr, sizeof(hwaddr));
35 dnssd_register_airplay(dnssd, "Test", 6000, hwaddr, sizeof(hwaddr));
2340bcd3
JVH
36
37 sleepms(60000);
38
39 dnssd_unregister_raop(dnssd);
40 dnssd_unregister_airplay(dnssd);
41 dnssd_destroy(dnssd);
42
43#ifdef WIN32
44 WSACleanup();
45#endif
46
47 return 0;
48}