dns_sd_responder_misc.c File Reference

Helper functions for DNS-SD responder. More...

Go to the source code of this file.

Macros

#define TRACE_LEVEL   DNS_SD_TRACE_LEVEL
 

Functions

void dnsSdResponderChangeState (DnsSdResponderService *service, MdnsState newState, systime_t delay)
 Update FSM state. More...
 
void dnsSdResponderChangeInstanceName (DnsSdResponderService *service)
 Programmatically change the service instance name. More...
 
error_t dnsSdResponderSendProbe (DnsSdResponderService *service)
 Send probe packet. More...
 
error_t dnsSdResponderSendAnnouncement (DnsSdResponderService *service)
 Send announcement packet. More...
 
error_t dnsSdResponderSendGoodbye (DnsSdResponderService *service)
 Send goodbye packet. More...
 
error_t dnsSdResponderParseQuestion (NetInterface *interface, const MdnsMessage *query, size_t offset, const DnsQuestion *question, MdnsMessage *response)
 Parse a question. More...
 
void dnsSdResponderParseNsRecords (NetInterface *interface, const MdnsMessage *query, size_t offset)
 Parse the Authority Section. More...
 
void dnsSdResponderParseAnRecord (NetInterface *interface, const MdnsMessage *response, size_t offset, const DnsResourceRecord *record)
 Parse a resource record from the Answer Section. More...
 
void dnsSdResponderGenerateAdditionalRecords (NetInterface *interface, MdnsMessage *response, bool_t legacyUnicast)
 Additional record generation. More...
 
error_t dnsSdResponderFormatServiceEnumPtrRecord (NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, uint32_t ttl)
 Format PTR resource record (in response to a meta-query) More...
 
error_t dnsSdResponderFormatPtrRecord (NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, uint32_t ttl)
 Format PTR resource record. More...
 
error_t dnsSdResponderFormatSrvRecord (NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, bool_t cacheFlush, uint32_t ttl)
 Format SRV resource record. More...
 
error_t dnsSdResponderFormatTxtRecord (NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, bool_t cacheFlush, uint32_t ttl)
 Format TXT resource record. More...
 
error_t dnsSdResponderFormatNsecRecord (NetInterface *interface, MdnsMessage *message, const DnsSdResponderService *service, bool_t cacheFlush, uint32_t ttl)
 Format NSEC resource record. More...
 
DnsResourceRecorddnsSdResponderGetNextTiebreakerRecord (DnsSdResponderService *service, const MdnsMessage *query, size_t offset, DnsResourceRecord *record)
 Sort the tiebreaker records in lexicographical order. More...
 
int_t dnsSdResponderCompareSrvRecord (NetInterface *interface, DnsSdResponderService *service, const MdnsMessage *message, const DnsResourceRecord *record)
 Compare SRV resource records. More...
 
int_t dnsSdResponderCompareTxtRecord (DnsSdResponderService *service, const MdnsMessage *message, const DnsResourceRecord *record)
 Compare TXT resource records. More...
 

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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
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]servicePointer 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]servicePointer to a DNS-SD service
[in]newStateNew state to switch to
[in]delayInitial 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]interfaceUnderlying network interface
[in]servicePointer to a DNS-SD service
[in]messagePointer to mDNS message
[in]recordPointer 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]servicePointer to a DNS-SD service
[in]messagePointer to mDNS message
[in]recordPointer 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]interfaceUnderlying network interface
[in,out]messagePointer to the mDNS message
[in]servicePointer to a DNS-SD service
[in]cacheFlushCache-flush bit
[in]ttlResource 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]interfaceUnderlying network interface
[in,out]messagePointer to the mDNS message
[in]servicePointer to a DNS-SD service
[in]ttlResource 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]interfaceUnderlying network interface
[in,out]messagePointer to the mDNS message
[in]servicePointer to a DNS-SD service
[in]ttlResource 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]interfaceUnderlying network interface
[in,out]messagePointer to the mDNS message
[in]servicePointer to a DNS-SD service
[in]cacheFlushCache-flush bit
[in]ttlResource 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]interfaceUnderlying network interface
[in,out]messagePointer to the mDNS message
[in]servicePointer to a DNS-SD service
[in]cacheFlushCache-flush bit
[in]ttlResource 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]interfaceUnderlying network interface
[in,out]responsemDNS response message
[in]legacyUnicastThis 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]servicePointer to a DNS-SD service
[in]queryIncoming mDNS query message
[in]offsetOffset to first byte of the Authority Section
[in]recordPointer 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]interfaceUnderlying network interface
[in]responseIncoming mDNS response message
[in]offsetOffset to first byte of the resource record to be checked
[in]recordPointer 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]interfaceUnderlying network interface
[in]queryIncoming mDNS query message
[in]offsetOffset 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]interfaceUnderlying network interface
[in]queryIncoming mDNS query message
[in]offsetOffset to first byte of the question
[in]questionPointer to the question
[in,out]responsemDNS 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]servicePointer 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]servicePointer 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]servicePointer to a DNS-SD service
Returns
Error code

Definition at line 162 of file dns_sd_responder_misc.c.