Definitions common to mDNS client and mDNS responder. More...
Go to the source code of this file.
Data Structures | |
struct | MdnsMessage |
mDNS message More... | |
Macros | |
#define | MDNS_MESSAGE_MAX_SIZE 1232 |
#define | MDNS_DEFAULT_RR_TTL 120 |
#define | MDNS_PORT 5353 |
#define | MDNS_DEFAULT_IP_TTL 255 |
#define | MDNS_LEGACY_UNICAST_RR_TTL 10 |
#define | MDNS_QCLASS_QU 0x8000 |
#define | MDNS_RCLASS_CACHE_FLUSH 0x8000 |
#define | MDNS_IPV4_MULTICAST_ADDR IPV4_ADDR(224, 0, 0, 251) |
Functions | |
error_t | mdnsInit (NetInterface *interface) |
mDNS related initialization More... | |
void | mdnsProcessMessage (NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary, void *param) |
Process incoming mDNS message. More... | |
void | mdnsProcessResponse (NetInterface *interface, MdnsMessage *response) |
Process mDNS response message. More... | |
bool_t | mdnsCheckSourceAddr (NetInterface *interface, const IpPseudoHeader *pseudoHeader) |
Source address check. More... | |
error_t | mdnsCreateMessage (MdnsMessage *message, bool_t queryResponse) |
Create an empty mDNS message. More... | |
void | mdnsDeleteMessage (MdnsMessage *message) |
release a mDNS message More... | |
error_t | mdnsSendMessage (NetInterface *interface, const MdnsMessage *message, const IpAddr *destIpAddr, uint_t destPort) |
Send mDNS message. More... | |
size_t | mdnsEncodeName (const char_t *instance, const char_t *service, const char_t *domain, uint8_t *dest) |
Encode instance, service and domain names using the DNS name notation. More... | |
int_t | mdnsCompareName (const DnsHeader *message, size_t length, size_t pos, const char_t *instance, const char_t *service, const char_t *domain, uint_t level) |
Compare instance, service and domain names. More... | |
int_t | mdnsCompareRecord (const MdnsMessage *message1, const DnsResourceRecord *record1, const MdnsMessage *message2, const DnsResourceRecord *record2) |
Compare resource records. More... | |
bool_t | mdnsCheckDuplicateRecord (const MdnsMessage *message, const char_t *instance, const char_t *service, const char_t *domain, uint16_t rtype, const uint8_t *rdata, size_t rdlength) |
Check for duplicate resource records. More... | |
Variables | |
const Ipv6Addr | MDNS_IPV6_MULTICAST_ADDR |
Detailed Description
Definitions common to mDNS client and mDNS 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 mdns_common.h.
Macro Definition Documentation
◆ MDNS_DEFAULT_IP_TTL
#define MDNS_DEFAULT_IP_TTL 255 |
Definition at line 55 of file mdns_common.h.
◆ MDNS_DEFAULT_RR_TTL
#define MDNS_DEFAULT_RR_TTL 120 |
Definition at line 47 of file mdns_common.h.
◆ MDNS_IPV4_MULTICAST_ADDR
#define MDNS_IPV4_MULTICAST_ADDR IPV4_ADDR(224, 0, 0, 251) |
Definition at line 65 of file mdns_common.h.
◆ MDNS_LEGACY_UNICAST_RR_TTL
#define MDNS_LEGACY_UNICAST_RR_TTL 10 |
Definition at line 57 of file mdns_common.h.
◆ MDNS_MESSAGE_MAX_SIZE
#define MDNS_MESSAGE_MAX_SIZE 1232 |
Definition at line 40 of file mdns_common.h.
◆ MDNS_PORT
#define MDNS_PORT 5353 |
Definition at line 53 of file mdns_common.h.
◆ MDNS_QCLASS_QU
#define MDNS_QCLASS_QU 0x8000 |
Definition at line 60 of file mdns_common.h.
◆ MDNS_RCLASS_CACHE_FLUSH
#define MDNS_RCLASS_CACHE_FLUSH 0x8000 |
Definition at line 62 of file mdns_common.h.
Function Documentation
◆ mdnsCheckDuplicateRecord()
bool_t mdnsCheckDuplicateRecord | ( | const MdnsMessage * | message, |
const char_t * | instance, | ||
const char_t * | service, | ||
const char_t * | domain, | ||
uint16_t | rtype, | ||
const uint8_t * | rdata, | ||
size_t | rdlength | ||
) |
Check for duplicate resource records.
- Parameters
-
[in] message Pointer to the mDNS message [in] instance Instance name [in] service Service name [in] domain Domain name [in] rtype Resource record type [in] rdata Resource record data [in] rdlength Length of the resource record data, in bytes
- Returns
- The function returns TRUE is the specified resource record is a duplicate. Otherwise FALSE is returned
Definition at line 921 of file mdns_common.c.
◆ mdnsCheckSourceAddr()
bool_t mdnsCheckSourceAddr | ( | NetInterface * | interface, |
const IpPseudoHeader * | pseudoHeader | ||
) |
Source address check.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader UDP pseudo header
- Returns
- TRUE if the source address is valid, else FALSE
Definition at line 275 of file mdns_common.c.
◆ mdnsCompareName()
int_t mdnsCompareName | ( | const DnsHeader * | message, |
size_t | length, | ||
size_t | pos, | ||
const char_t * | instance, | ||
const char_t * | service, | ||
const char_t * | domain, | ||
uint_t | level | ||
) |
Compare instance, service and domain names.
- Parameters
-
[in] message Pointer to the DNS message [in] length Length of the DNS message [in] pos Offset of the encoded name [in] instance Instance name [in] service Service name [in] domain Domain name [in] level Current level of recursion
- Returns
- The function returns 0 if the domain names match, -1 if the first domain name lexicographically precedes the second name, or 1 if the second domain name lexicographically precedes the first name
Definition at line 648 of file mdns_common.c.
◆ mdnsCompareRecord()
int_t mdnsCompareRecord | ( | const MdnsMessage * | message1, |
const DnsResourceRecord * | record1, | ||
const MdnsMessage * | message2, | ||
const DnsResourceRecord * | record2 | ||
) |
Compare resource records.
- Parameters
-
[in] message1 Pointer to the first mDNS message [in] record1 Pointer the first resource record [in] message2 Pointer to the second mDNS message [in] record2 Pointer the second resource record
- Returns
- The function returns 0 if the resource records match, -1 if the first resource record lexicographically precedes the second one, or 1 if the second resource record lexicographically precedes the first one
Definition at line 799 of file mdns_common.c.
◆ mdnsCreateMessage()
error_t mdnsCreateMessage | ( | MdnsMessage * | message, |
bool_t | queryResponse | ||
) |
Create an empty mDNS message.
- Parameters
-
[in,out] message Newly created mDNS message [in] queryResponse This flag specifies whether the message is a query or a response
- Returns
- Error code
Definition at line 357 of file mdns_common.c.
◆ mdnsDeleteMessage()
void mdnsDeleteMessage | ( | MdnsMessage * | message | ) |
release a mDNS message
- Parameters
-
[in] message mDNS message to be released
Definition at line 434 of file mdns_common.c.
◆ mdnsEncodeName()
size_t mdnsEncodeName | ( | const char_t * | instance, |
const char_t * | service, | ||
const char_t * | domain, | ||
uint8_t * | dest | ||
) |
Encode instance, service and domain names using the DNS name notation.
- Parameters
-
[in] instance Instance name [in] service Service name [in] domain Domain name [out] dest Pointer to the encoded name (optional parameter)
- Returns
- Length of the encoded domain name
Definition at line 544 of file mdns_common.c.
◆ mdnsInit()
error_t mdnsInit | ( | NetInterface * | interface | ) |
mDNS related initialization
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 69 of file mdns_common.c.
◆ mdnsProcessMessage()
void mdnsProcessMessage | ( | NetInterface * | interface, |
const IpPseudoHeader * | pseudoHeader, | ||
const UdpHeader * | udpHeader, | ||
const NetBuffer * | buffer, | ||
size_t | offset, | ||
const NetRxAncillary * | ancillary, | ||
void * | param | ||
) |
Process incoming mDNS message.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader UDP pseudo header [in] udpHeader UDP header [in] buffer Multi-part buffer containing the incoming mDNS message [in] offset Offset to the first byte of the mDNS message [in] ancillary Additional options passed to the stack along with the packet [in] param Callback function parameter (not used)
Definition at line 112 of file mdns_common.c.
◆ mdnsProcessResponse()
void mdnsProcessResponse | ( | NetInterface * | interface, |
MdnsMessage * | response | ||
) |
Process mDNS response message.
- Parameters
-
[in] interface Underlying network interface [in] response Incoming mDNS response message
Definition at line 180 of file mdns_common.c.
◆ mdnsSendMessage()
error_t mdnsSendMessage | ( | NetInterface * | interface, |
const MdnsMessage * | message, | ||
const IpAddr * | destIpAddr, | ||
uint_t | destPort | ||
) |
Send mDNS message.
- Parameters
-
[in] interface Underlying network interface [in] message mDNS message to be sent [in] destIpAddr Destination IP address (optional parameter) [in] destPort Destination port
- Returns
- Error code
Definition at line 458 of file mdns_common.c.
Variable Documentation
◆ MDNS_IPV6_MULTICAST_ADDR
|
extern |
Definition at line 59 of file mdns_common.c.