Helper functions for DNS-SD. More...
#include <stdlib.h>
#include "core/net.h"
#include "mdns/mdns_responder.h"
#include "dns_sd/dns_sd.h"
#include "dns_sd/dns_sd_misc.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL DNS_SD_TRACE_LEVEL |
Functions | |
void | dnsSdChangeState (DnsSdContext *context, MdnsState newState, systime_t delay) |
Update FSM state. More... | |
void | dnsSdChangeInstanceName (DnsSdContext *context) |
Programmatically change the service instance name. More... | |
error_t | dnsSdSendProbe (DnsSdContext *context) |
Send probe packet. More... | |
error_t | dnsSdSendAnnouncement (DnsSdContext *context) |
Send announcement packet. More... | |
error_t | dnsSdSendGoodbye (DnsSdContext *context, const DnsSdService *service) |
Send goodbye packet. More... | |
error_t | dnsSdParseQuestion (NetInterface *interface, const MdnsMessage *query, size_t offset, const DnsQuestion *question, MdnsMessage *response) |
Parse a question. More... | |
void | dnsSdParseNsRecords (NetInterface *interface, const MdnsMessage *query, size_t offset) |
Parse the Authority Section. More... | |
void | dnsSdParseNsRecord (NetInterface *interface, const MdnsMessage *query, size_t offset, const DnsResourceRecord *record) |
Parse a resource record from the Authority Section. More... | |
void | dnsSdParseAnRecord (NetInterface *interface, const MdnsMessage *response, size_t offset, const DnsResourceRecord *record) |
Parse a resource record from the Answer Section. More... | |
void | dnsSdGenerateAdditionalRecords (NetInterface *interface, MdnsMessage *response, bool_t legacyUnicast) |
Additional record generation. More... | |
error_t | dnsSdFormatServiceEnumPtrRecord (NetInterface *interface, MdnsMessage *message, const DnsSdService *service, uint32_t ttl) |
Format PTR resource record (in response to a meta-query) More... | |
error_t | dnsSdFormatPtrRecord (NetInterface *interface, MdnsMessage *message, const DnsSdService *service, uint32_t ttl) |
Format PTR resource record. More... | |
error_t | dnsSdFormatSrvRecord (NetInterface *interface, MdnsMessage *message, const DnsSdService *service, bool_t cacheFlush, uint32_t ttl) |
Format SRV resource record. More... | |
error_t | dnsSdFormatTxtRecord (NetInterface *interface, MdnsMessage *message, const DnsSdService *service, bool_t cacheFlush, uint32_t ttl) |
Format TXT resource record. More... | |
error_t | dnsSdFormatNsecRecord (NetInterface *interface, MdnsMessage *message, const DnsSdService *service, bool_t cacheFlush, uint32_t ttl) |
Format NSEC resource record. More... | |
Detailed Description
Helper functions for DNS-SD.
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.2
Definition in file dns_sd_misc.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL DNS_SD_TRACE_LEVEL |
Definition at line 32 of file dns_sd_misc.c.
Function Documentation
◆ dnsSdChangeInstanceName()
void dnsSdChangeInstanceName | ( | DnsSdContext * | context | ) |
Programmatically change the service instance name.
- Parameters
-
[in] context Pointer to the DNS-SD context
Definition at line 88 of file dns_sd_misc.c.
◆ dnsSdChangeState()
void dnsSdChangeState | ( | DnsSdContext * | context, |
MdnsState | newState, | ||
systime_t | delay | ||
) |
Update FSM state.
- Parameters
-
[in] context Pointer to the DNS-SD context [in] newState New state to switch to [in] delay Initial delay
Definition at line 53 of file dns_sd_misc.c.
◆ dnsSdFormatNsecRecord()
error_t dnsSdFormatNsecRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdService * | 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 1313 of file dns_sd_misc.c.
◆ dnsSdFormatPtrRecord()
error_t dnsSdFormatPtrRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdService * | 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 1041 of file dns_sd_misc.c.
◆ dnsSdFormatServiceEnumPtrRecord()
error_t dnsSdFormatServiceEnumPtrRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdService * | 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 962 of file dns_sd_misc.c.
◆ dnsSdFormatSrvRecord()
error_t dnsSdFormatSrvRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdService * | 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 1127 of file dns_sd_misc.c.
◆ dnsSdFormatTxtRecord()
error_t dnsSdFormatTxtRecord | ( | NetInterface * | interface, |
MdnsMessage * | message, | ||
const DnsSdService * | 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 1227 of file dns_sd_misc.c.
◆ dnsSdGenerateAdditionalRecords()
void dnsSdGenerateAdditionalRecords | ( | 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 817 of file dns_sd_misc.c.
◆ dnsSdParseAnRecord()
void dnsSdParseAnRecord | ( | 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 746 of file dns_sd_misc.c.
◆ dnsSdParseNsRecord()
void dnsSdParseNsRecord | ( | NetInterface * | interface, |
const MdnsMessage * | query, | ||
size_t | offset, | ||
const DnsResourceRecord * | record | ||
) |
Parse a resource record from 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 [in] record Pointer to the resource record
Definition at line 651 of file dns_sd_misc.c.
◆ dnsSdParseNsRecords()
void dnsSdParseNsRecords | ( | 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 607 of file dns_sd_misc.c.
◆ dnsSdParseQuestion()
error_t dnsSdParseQuestion | ( | 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 450 of file dns_sd_misc.c.
◆ dnsSdSendAnnouncement()
error_t dnsSdSendAnnouncement | ( | DnsSdContext * | context | ) |
Send announcement packet.
- Parameters
-
[in] context Pointer to the DNS-SD context
- Returns
- Error code
Definition at line 281 of file dns_sd_misc.c.
◆ dnsSdSendGoodbye()
error_t dnsSdSendGoodbye | ( | DnsSdContext * | context, |
const DnsSdService * | service | ||
) |
Send goodbye packet.
- Parameters
-
[in] context Pointer to the DNS-SD context [in] service Pointer to a DNS-SD service
- Returns
- Error code
Definition at line 370 of file dns_sd_misc.c.
◆ dnsSdSendProbe()
error_t dnsSdSendProbe | ( | DnsSdContext * | context | ) |
Send probe packet.
- Parameters
-
[in] context Pointer to the DNS-SD context
- Returns
- Error code
Definition at line 163 of file dns_sd_misc.c.