Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

NBNS example request

Posted by jeronimo479 on June 19, 2018

I want 8 nodes on my private network to be able to call each other by name, yet I don't want any of them to have to be the DNS. LMNR uses TCP mulitcast and NBNS uses UDP broadcast, so I think I want NBNS.

Can anyone provide an example implementation including the required call-back.

thanks, Wayne


NBNS example request

Posted by heinbali01 on June 19, 2018

Hi Wayne,

I want 8 nodes on my private network to be able to call each other by name, yet I don't want any of them to have to be the DNS. LMNR uses TCP mulitcast and NBNS uses UDP broadcast, so I think I want NBNS.

Correction: LLMNR has no direct relation with TCP, and indeed it does use multicasting. When you use a local name in a browser, it is most likely to start a look-up with LLMNR first. Only after a time-out, it will try the same look-up using NBNS. For this reason I would prefer to use LLMNR. A second advantage of LLMNR is multi-casting. You can selectively enable multi-cast addresses, so that you only receive the type of messages that you are interested in. Broadcasting is not specific: either you enable all broadcasting ( and get disturbed very often ), or you disable it.

Can anyone provide an example implementation including the required call-back.

Just enable the proper define(s):

~~~ #define ipconfigUSELLMNR ( 1 ) #define ipconfigUSENBNS ( 1 ) ~~~

and define the application call-back, returning pdPASS if a match is found:

~~~ BaseTypet xApplicationDNSQueryHook( const char *pcName ) { BaseTypet xReturn;

/* Determine if a name lookup is for this node.  Two names are given
to this node: that returned by pcApplicationHostnameHook() and that set
by mainDEVICE_NICK_NAME. */
if( strcasecmp( pcName, "speaker_01_r" ) == 0 )
{
    xReturn = pdPASS;
}
else if( strcasecmp( pcName, "audio-output" ) == 0 )
{
    xReturn = pdPASS;
}
else
{
    xReturn = pdFAIL;
}

return xReturn;

} /-----------------------------------------------------------/ ~~~

In this example, the device can be found as follows:

~~~ ping speaker01r ~~~

Or as a URL:

~~~ http://speaker01r/index.html ~~~

Note that local names may not contain a dot. Addresses with a dot will be looked up with DNS.

The following +TCP look-up function is aware of this:

~~~ uint32t FreeRTOSgethostbyname( const char *pcHostName ); ~~~

It will either use DNS or LLMNR to find a node.


NBNS example request

Posted by jeronimo479 on July 17, 2018

Thanks for all the help. While I was looking into LLMNR, I saw that the implementation always sent it's query to a specific MAC address, and that's why I thought there had to be a central server, which is what I wanted to avoid.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Mediatek

Renesas

RISC-V

SiFIve RISC-V

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner