Skip to content

Commit

Permalink
dns_sd_avahi: Move Avahi includes to dns_sd_avahi.c
Browse files Browse the repository at this point in the history
No need to have these in a header.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed Apr 9, 2021
1 parent 5cc28e9 commit b86e5c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
10 changes: 8 additions & 2 deletions dns_sd_avahi.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@
*
* */

#include "debug.h"
#include "iio-private.h"
#include "network.h"
#include "iio-lock.h"

#include <time.h>

#include <unistd.h>
#include "debug.h"

#include <avahi-common/address.h>
#include <avahi-common/error.h>
#include <avahi-common/simple-watch.h>
#include <avahi-common/malloc.h>
#include <avahi-client/client.h>
#include <avahi-client/lookup.h>

/*
* Fundamentally, this builds up a linked list to manage
Expand Down
20 changes: 6 additions & 14 deletions network.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,25 @@
#endif /* _WIN32 */

#ifdef HAVE_DNS_SD
#ifdef HAVE_AVAHI
#include <avahi-common/address.h>
#include <avahi-common/error.h>
#include <avahi-common/simple-watch.h>
#include <avahi-common/malloc.h>
#include <avahi-client/client.h>
#include <avahi-client/lookup.h>
#define DNS_SD_ADDRESS_STR_MAX AVAHI_ADDRESS_STR_MAX
#else /* !HAVE_AVAHI */

#define DNS_SD_ADDRESS_STR_MAX (40) /* IPv6 Max = 4*8 + 7 + 1 for NUL */
#endif /* HAVE_AVAHI */

/* MacOS doesn't include ENOMEDIUM (No medium found) like Linux does */
#ifndef ENOMEDIUM
#define ENOMEDIUM ENOENT
#endif

struct AvahiSimplePoll;
struct AvahiAddress;

/* Common structure which all dns_sd_[*] files fill out
* Anything that is dynamically allocated (malloc) needs to be managed
*/
struct dns_sd_discovery_data {
struct iio_mutex *lock;
#ifdef HAVE_AVAHI
AvahiSimplePoll *poll;
AvahiAddress *address;
struct AvahiSimplePoll *poll;
struct AvahiAddress *address;
uint16_t found, resolved;
#endif /* HAVE_AVAHI */
char addr_str[DNS_SD_ADDRESS_STR_MAX];
char *hostname;
uint16_t port;
Expand Down

0 comments on commit b86e5c9

Please sign in to comment.