netatalk: afp_mdns.c File Reference

netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
afp_mdns.c File Reference

mDNS based Zeroconf support More...

`#include <poll.h>`
`#include <pthread.h>`
`#include <time.h>`
`#include <unistd.h>`
`#include <atalk/logger.h>`
`#include <atalk/netatalk_conf.h>`
`#include <atalk/unicode.h>`
`#include <atalk/util.h>`
`#include "afp_mdns.h"`
`#include "afp_zeroconf.h"`

## Functions
int | TXTRecordPrintf (TXTRecordRef *rec, const char *key, const char *fmt,...)
int | TXTRecordKeyPrintf (TXTRecordRef *rec, const char *key_fmt, int key_var, const char *fmt,...)
static void * | polling_thread (void *arg)
static void | RegisterReply (DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain, void *context)
| This is the callback for the service register function.
static void | unregister_stuff (void)
static void | register_stuff (const AFPObj *obj)
void | md_zeroconf_register (const AFPObj *obj)
int | md_zeroconf_unregister (void)
| Tries to shutdown this loop impl.

## Variables
static DNSServiceRef * | svc_refs = NULL
static int | svc_ref_count = 0
static pthread_t | poller
static struct pollfd * | fds

## Detailed Description

mDNS based Zeroconf support

Author
  Lee Essen lee.e.nosp@m.ssen.nosp@m.@nowo.nosp@m.nlin.nosp@m.e.co..nosp@m.uk

Note
  Based on: avahi support from Daniel S. Haischt me@da.nosp@m.niel.nosp@m..stef.nosp@m.an.h.nosp@m.aisch.nosp@m.t.na.nosp@m.me

## Function Documentation

## ◆ md_zeroconf_register()

void md_zeroconf_register | ( | const AFPObj * | obj | ) |

Tries to setup the Zeroconf thread and any neccessary config setting.

## ◆ md_zeroconf_unregister()

int md_zeroconf_unregister | ( | void |  | ) |

Tries to shutdown this loop impl.

Note
  Call this function from inside this thread.

## ◆ polling_thread()

void * polling_thread | ( | void * | arg | ) |
| static

This is the thread that polls the filehandles

## ◆ register_stuff()

void register_stuff | ( | const AFPObj * | obj | ) |
| static

This function tries to register the AFP DNS SRV service type.

## ◆ RegisterReply()

void RegisterReply | ( | DNSServiceRef | sdRef,
|  | DNSServiceFlags | flags,
|  | DNSServiceErrorType | errorCode,
|  | const char * | name,
|  | const char * | regtype,
|  | const char * | domain,
|  | void * | context )
| static

This is the callback for the service register function.

Note
  actually there isn't a lot we can do if we get problems, so we don't really need to do anything other than report the issue.

## ◆ TXTRecordKeyPrintf()

int TXTRecordKeyPrintf | ( | TXTRecordRef * | rec,
|  | const char * | key_fmt,
|  | int | key_var,
|  | const char * | fmt,
|  |  | ... )

## ◆ TXTRecordPrintf()

int TXTRecordPrintf | ( | TXTRecordRef * | rec,
|  | const char * | key,
|  | const char * | fmt,
|  |  | ... )

## ◆ unregister_stuff()

void unregister_stuff | ( | void |  | ) |
| static

This function unregisters anything we have already registered and frees associated memory

## Variable Documentation

## ◆ fds

struct pollfd* fds
| static

## ◆ poller

pthread_t poller
| static

## ◆ svc_ref_count

int svc_ref_count = 0
| static

## ◆ svc_refs

DNSServiceRef* svc_refs = NULL
| static