Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

mdns_common.h File Reference

mdns_common.h File Reference

Functions common to mDNS client and mDNS responder. More...

Go to the source code of this file.

Data Structures

struct  MdnsMessage
 mDNS message More...

Functions

error_t mdnsInit (NetInterface *interface)
 mDNS related initialization
void mdnsProcessMessage (NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, void *params)
 Process incoming mDNS message.
void mdnsProcessResponse (NetInterface *interface, MdnsMessage *response)
 Process mDNS response message.
bool_t mdnsCheckSourceAddr (NetInterface *interface, const IpPseudoHeader *pseudoHeader)
 Source address check.
error_t mdnsCreateMessage (MdnsMessage *message, bool_t queryResponse)
 Create an empty mDNS message.
void mdnsDeleteMessage (MdnsMessage *message)
 release a mDNS message
error_t mdnsSendMessage (NetInterface *interface, const MdnsMessage *message, const IpAddr *destIpAddr, uint_t destPort)
 Send mDNS message.
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.
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.
int_t mdnsCompareRecord (const MdnsMessage *message1, size_t offset1, const DnsResourceRecord *record1, const MdnsMessage *message2, size_t offset2, const DnsResourceRecord *record2)
 Compare resource records.
bool_t mdnsCheckDuplicateRecord (const MdnsMessage *message, const char_t *instance, const char_t *service, const char_t *domain, uint16_t rtype)
 Check for duplicate resource records.

Detailed Description

Functions common to mDNS client and mDNS responder.

License

Copyright (C) 2010-2017 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:
1.7.6

Definition in file mdns_common.h.


Function Documentation

bool_t mdnsCheckDuplicateRecord ( const MdnsMessage message,
const char_t *  instance,
const char_t *  service,
const char_t *  domain,
uint16_t  rtype 
)

Check for duplicate resource records.

Parameters:
[in]messagePointer to the mDNS message
[in]instanceInstance name
[in]serviceService name
[in]domainDomain name
[in]rtypeResource record type
Returns:
The function returns TRUE is the specified resource record is a duplicate. Otherwise FALSE is returned

Definition at line 887 of file mdns_common.c.

bool_t mdnsCheckSourceAddr ( NetInterface *  interface,
const IpPseudoHeader pseudoHeader 
)

Source address check.

Parameters:
[in]interfaceUnderlying network interface
[in]pseudoHeaderUDP pseudo header
Returns:
TRUE if the source address is valid, else FALSE

Definition at line 270 of file mdns_common.c.

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]messagePointer to the DNS message
[in]lengthLength of the DNS message
[in]posOffset of the encoded name
[in]instanceInstance name
[in]serviceService name
[in]domainDomain name
[in]levelCurrent 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 628 of file mdns_common.c.

int_t mdnsCompareRecord ( const MdnsMessage message1,
size_t  offset1,
const DnsResourceRecord *  record1,
const MdnsMessage message2,
size_t  offset2,
const DnsResourceRecord *  record2 
)

Compare resource records.

Parameters:
[in]message1Pointer to the first mDNS message
[in]offset1Offset of the first but of the resource record
[in]record1Pointer the first resource record
[in]message2Pointer to the second mDNS message
[in]offset2Offset of the first but of the resource record
[in]record2Pointer 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 781 of file mdns_common.c.

error_t mdnsCreateMessage ( MdnsMessage message,
bool_t  queryResponse 
)

Create an empty mDNS message.

Parameters:
[in,out]messageNewly created mDNS message
[in]queryResponseThis flag specifies whether the message is a query or a response
Returns:
Error code

Definition at line 352 of file mdns_common.c.

void mdnsDeleteMessage ( MdnsMessage message )

release a mDNS message

Parameters:
[in]messagemDNS message to be released

Definition at line 428 of file mdns_common.c.

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]instanceInstance name
[in]serviceService name
[in]domainDomain name
[out]destPointer to the encoded name (optional parameter)
Returns:
Length of the encoded domain name

Definition at line 538 of file mdns_common.c.

error_t mdnsInit ( NetInterface *  interface )

mDNS related initialization

Parameters:
[in]interfaceUnderlying network interface
Returns:
Error code

Definition at line 70 of file mdns_common.c.

void mdnsProcessMessage ( NetInterface *  interface,
const IpPseudoHeader pseudoHeader,
const UdpHeader *  udpHeader,
const NetBuffer buffer,
size_t  offset,
void *  params 
)

Process incoming mDNS message.

Parameters:
[in]interfaceUnderlying network interface
[in]pseudoHeaderUDP pseudo header
[in]udpHeaderUDP header
[in]bufferMulti-part buffer containing the incoming mDNS message
[in]offsetOffset to the first byte of the mDNS message
[in]paramsCallback function parameter (not used)

Definition at line 111 of file mdns_common.c.

void mdnsProcessResponse ( NetInterface *  interface,
MdnsMessage response 
)

Process mDNS response message.

Parameters:
[in]interfaceUnderlying network interface
[in]responseIncoming mDNS response message

Definition at line 176 of file mdns_common.c.

error_t mdnsSendMessage ( NetInterface *  interface,
const MdnsMessage message,
const IpAddr destIpAddr,
uint_t  destPort 
)

Send mDNS message.

Parameters:
[in]interfaceUnderlying network interface
[in]messagemDNS message to be sent
[in]destIpAddrDestination IP address (optional parameter)
[in]destPortDestination port
Returns:
Error code

Definition at line 452 of file mdns_common.c.