Helper functions for DNS-SD responder. More...
#include "core/net.h"
#include "mdns/mdns_responder.h"
#include "dns_sd/dns_sd_responder.h"
#include "dns_sd/dns_sd_responder_misc.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL DNS_SD_TRACE_LEVEL |
Detailed Description
Helper functions for DNS-SD responder.
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.
- Version
- 2.4.4
Definition in file dns_sd_responder_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL DNS_SD_TRACE_LEVEL |
Definition at line 32 of file dns_sd_responder_misc.c.
Function Documentation
◆ dnsSdResponderChangeInstanceName()
void dnsSdResponderChangeInstanceName | ( | DnsSdResponderService * | service | ) |
Programmatically change the service instance name.
- Parameters
-
[in] service Pointer to a DNS-SD service
Definition at line 87 of file dns_sd_responder_misc.c.
◆ dnsSdResponderChangeState()
void dnsSdResponderChangeState | ( | DnsSdResponderService * | service, |
MdnsState | newState, | ||
systime_t | delay | ||
) |
Update FSM state.
- Parameters
-
[in] service Pointer to a DNS-SD service [in] newState New state to switch to [in] delay Initial delay
Definition at line 52 of file dns_sd_responder_misc.c.
◆ dnsSdResponderCompareSrvRecord()
int_t dnsSdResponderCompareSrvRecord | ( | NetInterface * | interface, |
DnsSdResponderService * | service, | ||
const MdnsMessage * | message, | ||
const DnsResourceRecord * | record | ||
) |
Compare SRV resource records.
- Parameters
-
[in] interface Underlying network interface [in] service Pointer to a DNS-SD service [in] message Pointer to mDNS message [in] record Pointer the resource record
- Returns
- The function returns 0 if the resource record match the SRV resource record of the host, -1 if the resource record lexicographically precedes it, or 1 if the resource record lexicographically precedes it
Definition at line 1419 of file dns_sd_responder_misc.c.
◆ dnsSdResponderCompareTxtRecord()
int_t dnsSdResponderCompareTxtRecord | ( | DnsSdResponderService * | service, |
const MdnsMessage * | message, | ||
const DnsResourceRecord * | record | ||
) |
Compare TXT resource records.
- Parameters
-
[in] service Pointer to a DNS-SD service [in] message Pointer to mDNS message [in] record Pointer the resource record
- Returns
- The function returns 0 if the resource record match the TXT resource record of the host, -1 if the resource record lexicographically precedes it, or 1 if the resource record lexicographically precedes it
Definition at line 1539 of file dns_sd_responder_misc.c.
◆ dnsSdResponderFormatNsecRecord()
error_t dnsSdResponderFormatNsecRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdResponderService * | service, | ||
bool_t | cacheFlush, | ||
uint32_t | ttl | ||
) |
Format NSEC resource record.
- Parameters
-
[in] interface Underlying network interface [in,out] message Pointer to the mDNS message [in] service Pointer to a DNS-SD service [in] cacheFlush Cache-flush bit [in] ttl Resource record TTL (cache lifetime)
- Returns
- Error code
Definition at line 1225 of file dns_sd_responder_misc.c.
◆ dnsSdResponderFormatPtrRecord()
error_t dnsSdResponderFormatPtrRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdResponderService * | service, | ||
uint32_t | ttl | ||
) |
Format PTR resource record.
- Parameters
-
[in] interface Underlying network interface [in,out] message Pointer to the mDNS message [in] service Pointer to a DNS-SD service [in] ttl Resource record TTL (cache lifetime)
- Returns
- Error code
Definition at line 950 of file dns_sd_responder_misc.c.
◆ dnsSdResponderFormatServiceEnumPtrRecord()
error_t dnsSdResponderFormatServiceEnumPtrRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdResponderService * | service, | ||
uint32_t | ttl | ||
) |
Format PTR resource record (in response to a meta-query)
- Parameters
-
[in] interface Underlying network interface [in,out] message Pointer to the mDNS message [in] service Pointer to a DNS-SD service [in] ttl Resource record TTL (cache lifetime)
- Returns
- Error code
Definition at line 871 of file dns_sd_responder_misc.c.
◆ dnsSdResponderFormatSrvRecord()
error_t dnsSdResponderFormatSrvRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdResponderService * | service, | ||
bool_t | cacheFlush, | ||
uint32_t | ttl | ||
) |
Format SRV resource record.
- Parameters
-
[in] interface Underlying network interface [in,out] message Pointer to the mDNS message [in] service Pointer to a DNS-SD service [in] cacheFlush Cache-flush bit [in] ttl Resource record TTL (cache lifetime)
- Returns
- Error code
Definition at line 1044 of file dns_sd_responder_misc.c.
◆ dnsSdResponderFormatTxtRecord()
error_t dnsSdResponderFormatTxtRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdResponderService * | service, | ||
bool_t | cacheFlush, | ||
uint32_t | ttl | ||
) |
Format TXT resource record.
- Parameters
-
[in] interface Underlying network interface [in,out] message Pointer to the mDNS message [in] service Pointer to a DNS-SD service [in] cacheFlush Cache-flush bit [in] ttl Resource record TTL (cache lifetime)
- Returns
- Error code
Definition at line 1142 of file dns_sd_responder_misc.c.
◆ dnsSdResponderGenerateAdditionalRecords()
void dnsSdResponderGenerateAdditionalRecords | ( | NetInterface * | interface, |
MdnsMessage * | response, | ||
bool_t | legacyUnicast | ||
) |
Additional record generation.
- Parameters
-
[in] interface Underlying network interface [in,out] response mDNS response message [in] legacyUnicast This flag is set for legacy unicast responses
Definition at line 727 of file dns_sd_responder_misc.c.
◆ dnsSdResponderGetNextTiebreakerRecord()
DnsResourceRecord* dnsSdResponderGetNextTiebreakerRecord | ( | DnsSdResponderService * | service, |
const MdnsMessage * | query, | ||
size_t | offset, | ||
DnsResourceRecord * | record | ||
) |
Sort the tiebreaker records in lexicographical order.
- Parameters
-
[in] service Pointer to a DNS-SD service [in] query Incoming mDNS query message [in] offset Offset to first byte of the Authority Section [in] record Pointer to the current record
- Returns
- Pointer to the next record, if any
Definition at line 1338 of file dns_sd_responder_misc.c.
◆ dnsSdResponderParseAnRecord()
void dnsSdResponderParseAnRecord | ( | NetInterface * | interface, |
const MdnsMessage * | response, | ||
size_t | offset, | ||
const DnsResourceRecord * | record | ||
) |
Parse a resource record from the Answer Section.
- Parameters
-
[in] interface Underlying network interface [in] response Incoming mDNS response message [in] offset Offset to first byte of the resource record to be checked [in] record Pointer to the resource record
Definition at line 647 of file dns_sd_responder_misc.c.
◆ dnsSdResponderParseNsRecords()
void dnsSdResponderParseNsRecords | ( | NetInterface * | interface, |
const MdnsMessage * | query, | ||
size_t | offset | ||
) |
Parse the Authority Section.
- Parameters
-
[in] interface Underlying network interface [in] query Incoming mDNS query message [in] offset Offset to first byte of the resource record
Definition at line 537 of file dns_sd_responder_misc.c.
◆ dnsSdResponderParseQuestion()
error_t dnsSdResponderParseQuestion | ( | NetInterface * | interface, |
const MdnsMessage * | query, | ||
size_t | offset, | ||
const DnsQuestion * | question, | ||
MdnsMessage * | response | ||
) |
Parse a question.
- Parameters
-
[in] interface Underlying network interface [in] query Incoming mDNS query message [in] offset Offset to first byte of the question [in] question Pointer to the question [in,out] response mDNS response message
- Returns
- Error code
Definition at line 387 of file dns_sd_responder_misc.c.
◆ dnsSdResponderSendAnnouncement()
error_t dnsSdResponderSendAnnouncement | ( | DnsSdResponderService * | service | ) |
Send announcement packet.
- Parameters
-
[in] service Pointer to a DNS-SD service
- Returns
- Error code
Definition at line 245 of file dns_sd_responder_misc.c.
◆ dnsSdResponderSendGoodbye()
error_t dnsSdResponderSendGoodbye | ( | DnsSdResponderService * | service | ) |
Send goodbye packet.
- Parameters
-
[in] service Pointer to a DNS-SD service
- Returns
- Error code
Definition at line 315 of file dns_sd_responder_misc.c.
◆ dnsSdResponderSendProbe()
error_t dnsSdResponderSendProbe | ( | DnsSdResponderService * | service | ) |
Send probe packet.
- Parameters
-
[in] service Pointer to a DNS-SD service
- Returns
- Error code
Definition at line 162 of file dns_sd_responder_misc.c.