mainDEVICE_NAME and mainHOST_NAME purpose

eduardo1966 wrote on Tuesday, April 30, 2019:

Hi

I would like to know what is the purpose of mainDEVICE_NAME and mainHOST_NAME that are used by the two Hook functions below:

BaseType_t xApplicationDNSQueryHook( const char *pcName )
{
BaseType_t 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_NAME. */
    if( strcmp( pcName, pcApplicationHostnameHook() ) == 0 )
    {
        xReturn = pdPASS;
    }
    else if( strcmp( pcName, mainDEVICE_NAME ) == 0 )
    {
        xReturn = pdPASS;
    }
    else
    {
        xReturn = pdFAIL;
    }

    return xReturn;
}


const char *pcApplicationHostnameHook( void )
{
    /* Assign the name "rtosdemo" to this network node.  This function will be
    called during the DHCP: the machine will be registered with an IP address
    plus this name. */
    return mainHOST_NAME;
}

thanks

rtel wrote on Tuesday, April 30, 2019:

They are human readable text names you can give the device. DNS being
'd’omain 'n’ame 's’ervice. So for example, if you set the name to
“MyDevice” and you have LLMNR (link local name resolution) then you can
ping MyDevice without needing to know the IP address of your device -
the name is resolved to the IP address.