dns_sd_responder.h File Reference

DNS-SD responder (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  DnsSdResponderSettings
 DNS-SD responder settings. More...
 
struct  _DnsSdResponderService
 DNS-SD service descriptor. More...
 
struct  _DnsSdResponderContext
 DNS-SD responder context. More...
 

Macros

#define DNS_SD_RESPONDER_SUPPORT   DISABLED
 
#define DNS_SD_RESPONDER_TICK_INTERVAL   250
 
#define DNS_SD_MAX_SERVICE_NAME_LEN   32
 
#define DNS_SD_MAX_INSTANCE_NAME_LEN   32
 
#define DNS_SD_MAX_METADATA_LEN   128
 
#define DNS_SD_DEFAULT_RR_TTL   120
 
#define DnsSdResponderContext   struct _DnsSdResponderContext
 
#define DnsSdResponderService   struct _DnsSdResponderService
 

Typedefs

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

Functions

void dnsSdResponderGetDefaultSettings (DnsSdResponderSettings *settings)
 Initialize settings with default values. More...
 
error_t dnsSdResponderInit (DnsSdResponderContext *context, const DnsSdResponderSettings *settings)
 DNS-DS initialization. More...
 
error_t dnsSdResponderStart (DnsSdResponderContext *context)
 Start DNS-SD responder. More...
 
error_t dnsSdResponderStop (DnsSdResponderContext *context)
 Stop DNS-SD responder. More...
 
error_t dnsSdResponderRegisterService (DnsSdResponderContext *context, uint_t index, const char_t *instanceName, 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 dnsSdResponderUnregisterService (DnsSdResponderContext *context, uint_t index)
 Unregister a DNS-SD service. More...
 
error_t dnsSdResponderStartProbing (DnsSdResponderContext *context)
 Restart probing process. More...
 
void dnsSdResponderTick (DnsSdResponderContext *interface)
 DNS-SD responder timer handler. More...
 
void dnsSdResponderLinkChangeEvent (DnsSdResponderContext *interface)
 Callback function for link change event. More...
 

Variables

systime_t dnsSdResponderTickCounter
 

Detailed Description

DNS-SD responder (DNS-Based Service Discovery)

License

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

Copyright (C) 2010-2024 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.4.4

Definition in file dns_sd_responder.h.

Macro Definition Documentation

◆ DNS_SD_DEFAULT_RR_TTL

#define DNS_SD_DEFAULT_RR_TTL   120

Definition at line 76 of file dns_sd_responder.h.

◆ DNS_SD_MAX_INSTANCE_NAME_LEN

#define DNS_SD_MAX_INSTANCE_NAME_LEN   32

Definition at line 62 of file dns_sd_responder.h.

◆ DNS_SD_MAX_METADATA_LEN

#define DNS_SD_MAX_METADATA_LEN   128

Definition at line 69 of file dns_sd_responder.h.

◆ DNS_SD_MAX_SERVICE_NAME_LEN

#define DNS_SD_MAX_SERVICE_NAME_LEN   32

Definition at line 55 of file dns_sd_responder.h.

◆ DNS_SD_RESPONDER_SUPPORT

#define DNS_SD_RESPONDER_SUPPORT   DISABLED

Definition at line 41 of file dns_sd_responder.h.

◆ DNS_SD_RESPONDER_TICK_INTERVAL

#define DNS_SD_RESPONDER_TICK_INTERVAL   250

Definition at line 48 of file dns_sd_responder.h.

◆ DnsSdResponderContext

#define DnsSdResponderContext   struct _DnsSdResponderContext

Definition at line 83 of file dns_sd_responder.h.

◆ DnsSdResponderService

#define DnsSdResponderService   struct _DnsSdResponderService

Definition at line 87 of file dns_sd_responder.h.

Typedef Documentation

◆ DnsSdStateChangeCallback

typedef void(* DnsSdStateChangeCallback) (DnsSdResponderService *service, NetInterface *interface, MdnsState state)

FSM state change callback.

Definition at line 99 of file dns_sd_responder.h.

Function Documentation

◆ dnsSdResponderGetDefaultSettings()

void dnsSdResponderGetDefaultSettings ( DnsSdResponderSettings settings)

Initialize settings with default values.

Parameters
[out]settingsStructure that contains DNS-SD responder settings

Definition at line 61 of file dns_sd_responder.c.

◆ dnsSdResponderInit()

error_t dnsSdResponderInit ( DnsSdResponderContext context,
const DnsSdResponderSettings settings 
)

DNS-DS initialization.

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

Definition at line 86 of file dns_sd_responder.c.

◆ dnsSdResponderLinkChangeEvent()

void dnsSdResponderLinkChangeEvent ( DnsSdResponderContext context)

Callback function for link change event.

Parameters
[in]contextPointer to the DNS-SD responder context

Definition at line 622 of file dns_sd_responder.c.

◆ dnsSdResponderRegisterService()

error_t dnsSdResponderRegisterService ( DnsSdResponderContext context,
uint_t  index,
const char_t instanceName,
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 responder context
[in]indexZero-based index identifying a slot
[in]instanceNameNULL-terminated string that contains the service instance name
[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 239 of file dns_sd_responder.c.

◆ dnsSdResponderStart()

error_t dnsSdResponderStart ( DnsSdResponderContext context)

Start DNS-SD responder.

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

Definition at line 153 of file dns_sd_responder.c.

◆ dnsSdResponderStartProbing()

error_t dnsSdResponderStartProbing ( DnsSdResponderContext context)

Restart probing process.

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

Definition at line 410 of file dns_sd_responder.c.

◆ dnsSdResponderStop()

error_t dnsSdResponderStop ( DnsSdResponderContext context)

Stop DNS-SD responder.

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

Definition at line 191 of file dns_sd_responder.c.

◆ dnsSdResponderTick()

void dnsSdResponderTick ( DnsSdResponderContext 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 responder context

Definition at line 439 of file dns_sd_responder.c.

◆ dnsSdResponderUnregisterService()

error_t dnsSdResponderUnregisterService ( DnsSdResponderContext context,
uint_t  index 
)

Unregister a DNS-SD service.

Parameters
[in]contextPointer to the DNS-SD responder context
[in]indexZero-based index identifying the service to be unregistered
Returns
Error code

Definition at line 365 of file dns_sd_responder.c.

Variable Documentation

◆ dnsSdResponderTickCounter

systime_t dnsSdResponderTickCounter
extern

Definition at line 53 of file dns_sd_responder.c.