dns_sd.h File Reference

DNS-SD (DNS-Based Service Discovery) More...

#include "core/net.h"
#include "dns/dns_common.h"
#include "mdns/mdns_common.h"

Go to the source code of this file.

Data Structures

struct  DnsSdSettings
 DNS-SD settings. More...
 
struct  DnsSdService
 DNS-SD service descriptor. More...
 
struct  _DnsSdContext
 DNS-SD context. More...
 

Macros

#define DNS_SD_SUPPORT   DISABLED
 
#define DNS_SD_TICK_INTERVAL   250
 
#define DNS_SD_SERVICE_LIST_SIZE   2
 
#define DNS_SD_MAX_SERVICE_NAME_LEN   16
 
#define DNS_SD_MAX_INSTANCE_NAME_LEN   32
 
#define DNS_SD_MAX_METADATA_LEN   128
 
#define DNS_SD_DEFAULT_RR_TTL   120
 
#define DnsSdContext   struct _DnsSdContext
 

Typedefs

typedef void(* DnsSdStateChangeCallback) (DnsSdContext *context, NetInterface *interface, MdnsState state)
 FSM state change callback. More...
 

Functions

void dnsSdGetDefaultSettings (DnsSdSettings *settings)
 Initialize settings with default values. More...
 
error_t dnsSdInit (DnsSdContext *context, const DnsSdSettings *settings)
 DNS-DS initialization. More...
 
error_t dnsSdStart (DnsSdContext *context)
 Start mDNS responder. More...
 
error_t dnsSdStop (DnsSdContext *context)
 Stop mDNS responder. More...
 
MdnsState dnsSdGetState (DnsSdContext *context)
 Retrieve current state. More...
 
error_t dnsSdSetInstanceName (DnsSdContext *context, const char_t *instanceName)
 Set service instance name. More...
 
error_t dnsSdRegisterService (DnsSdContext *context, const char_t *serviceName, uint16_t priority, uint16_t weight, uint16_t port, const char_t *metadata)
 Register a DNS-SD service. More...
 
error_t dnsSdUnregisterService (DnsSdContext *context, const char_t *serviceName)
 Unregister a DNS-SD service. More...
 
uint_t dnsSdGetNumServices (DnsSdContext *context)
 Get the number of registered services. More...
 
error_t dnsSdStartProbing (DnsSdContext *context)
 Restart probing process. More...
 
void dnsSdTick (DnsSdContext *interface)
 DNS-SD responder timer handler. More...
 
void dnsSdLinkChangeEvent (DnsSdContext *interface)
 Callback function for link change event. More...
 

Variables

systime_t dnsSdTickCounter
 

Detailed Description

DNS-SD (DNS-Based Service Discovery)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2022 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.2.0

Definition in file dns_sd.h.

Macro Definition Documentation

◆ DNS_SD_DEFAULT_RR_TTL

#define DNS_SD_DEFAULT_RR_TTL   120

Definition at line 83 of file dns_sd.h.

◆ DNS_SD_MAX_INSTANCE_NAME_LEN

#define DNS_SD_MAX_INSTANCE_NAME_LEN   32

Definition at line 69 of file dns_sd.h.

◆ DNS_SD_MAX_METADATA_LEN

#define DNS_SD_MAX_METADATA_LEN   128

Definition at line 76 of file dns_sd.h.

◆ DNS_SD_MAX_SERVICE_NAME_LEN

#define DNS_SD_MAX_SERVICE_NAME_LEN   16

Definition at line 62 of file dns_sd.h.

◆ DNS_SD_SERVICE_LIST_SIZE

#define DNS_SD_SERVICE_LIST_SIZE   2

Definition at line 55 of file dns_sd.h.

◆ DNS_SD_SUPPORT

#define DNS_SD_SUPPORT   DISABLED

Definition at line 41 of file dns_sd.h.

◆ DNS_SD_TICK_INTERVAL

#define DNS_SD_TICK_INTERVAL   250

Definition at line 48 of file dns_sd.h.

◆ DnsSdContext

#define DnsSdContext   struct _DnsSdContext

Definition at line 90 of file dns_sd.h.

Typedef Documentation

◆ DnsSdStateChangeCallback

typedef void(* DnsSdStateChangeCallback) (DnsSdContext *context, NetInterface *interface, MdnsState state)

FSM state change callback.

Definition at line 102 of file dns_sd.h.

Function Documentation

◆ dnsSdGetDefaultSettings()

void dnsSdGetDefaultSettings ( DnsSdSettings settings)

Initialize settings with default values.

Parameters
[out]settingsStructure that contains DNS-SD settings

Definition at line 62 of file dns_sd.c.

◆ dnsSdGetNumServices()

uint_t dnsSdGetNumServices ( DnsSdContext context)

Get the number of registered services.

Parameters
[in]contextPointer to the DNS-SD context
Returns
Number of registered services

Definition at line 456 of file dns_sd.c.

◆ dnsSdGetState()

MdnsState dnsSdGetState ( DnsSdContext context)

Retrieve current state.

Parameters
[in]contextPointer to the DNS-SD context
Returns
Current DNS-SD state

Definition at line 187 of file dns_sd.c.

◆ dnsSdInit()

error_t dnsSdInit ( DnsSdContext context,
const DnsSdSettings settings 
)

DNS-DS initialization.

Parameters
[in]contextPointer to the DNS-SD context
[in]settingsDNS-SD specific settings
Returns
Error code

Definition at line 83 of file dns_sd.c.

◆ dnsSdLinkChangeEvent()

void dnsSdLinkChangeEvent ( DnsSdContext context)

Callback function for link change event.

Parameters
[in]contextPointer to the DNS-SD context

Definition at line 680 of file dns_sd.c.

◆ dnsSdRegisterService()

error_t dnsSdRegisterService ( DnsSdContext context,
const char_t serviceName,
uint16_t  priority,
uint16_t  weight,
uint16_t  port,
const char_t metadata 
)

Register a DNS-SD service.

Parameters
[in]contextPointer to the DNS-SD context
[in]serviceNameNULL-terminated string that contains the name of the service to be registered
[in]priorityPriority field
[in]weightWeight field
[in]portPort number
[in]metadataNULL-terminated string that contains the discovery-time metadata (TXT record)
Returns
Error code

Definition at line 267 of file dns_sd.c.

◆ dnsSdSetInstanceName()

error_t dnsSdSetInstanceName ( DnsSdContext context,
const char_t instanceName 
)

Set service instance name.

Parameters
[in]contextPointer to the DNS-SD context
[in]instanceNameNULL-terminated string that contains the service instance name
Returns
Error code

Definition at line 211 of file dns_sd.c.

◆ dnsSdStart()

error_t dnsSdStart ( DnsSdContext context)

Start mDNS responder.

Parameters
[in]contextPointer to the DNS-SD context
Returns
Error code

Definition at line 125 of file dns_sd.c.

◆ dnsSdStartProbing()

error_t dnsSdStartProbing ( DnsSdContext context)

Restart probing process.

Parameters
[in]contextPointer to the DNS-SD context
Returns
Error code

Definition at line 491 of file dns_sd.c.

◆ dnsSdStop()

error_t dnsSdStop ( DnsSdContext context)

Stop mDNS responder.

Parameters
[in]contextPointer to the DNS-SD context
Returns
Error code

Definition at line 156 of file dns_sd.c.

◆ dnsSdTick()

void dnsSdTick ( DnsSdContext context)

DNS-SD responder timer handler.

This routine must be periodically called by the TCP/IP stack to manage DNS-SD operation

Parameters
[in]contextPointer to the DNS-SD context

Definition at line 514 of file dns_sd.c.

◆ dnsSdUnregisterService()

error_t dnsSdUnregisterService ( DnsSdContext context,
const char_t serviceName 
)

Unregister a DNS-SD service.

Parameters
[in]contextPointer to the DNS-SD context
[in]serviceNameNULL-terminated string that contains the name of the service to be unregistered
Returns
Error code

Definition at line 414 of file dns_sd.c.

Variable Documentation

◆ dnsSdTickCounter

systime_t dnsSdTickCounter
extern

Definition at line 54 of file dns_sd.c.