src/services/route/src/routeSrvMgr.cpp
/**
 * @brief This function will check whether a Host name is valid by validating all the associated IP addresses.
 *
 * @param[in] hostname Host name represented as a string.
 *
 * @return Returns TRUE if host name is valid else returns FALSE.
 * @ingroup
 */
@brief This function will check whether a Host name is valid by validating all the associated IP addresses.
@param[in] hostname Host name represented as a string.

@return Returns TRUE if host name is valid else returns FALSE.
@ingroup
@brief This function will check whether a Host name is valid by validating all the associated IP addresses . @param [ in ] hostname Host name represented as a string . @return Returns TRUE if host name is valid else returns FALSE . @ingroup
gboolean checkvalidhostname( char* hostname)
{
    RDK_LOG( RDK_LOG_TRACE1, LOG_NMGR, "[%s:%s:%d] Enter\n", MODULE_NAME,__FUNCTION__, __LINE__ );
    if (g_strrstr(g_strstrip(hostname),"null") || ! *hostname )
    {
        RDK_LOG( RDK_LOG_ERROR, LOG_NMGR, "[%s:%s:%d] hostname  values are empty %s \n", MODULE_NAME,__FUNCTION__, __LINE__ ,hostname);
        return TRUE;
    }
    gchar **tokens = g_strsplit_set(hostname," ;\n\0", -1);
    guint toklength = g_strv_length(tokens);
    guint loopvar=0;
    for (loopvar=0; loopvar<toklength; loopvar++)
    {
        if (checkvalidip(tokens[loopvar]))
        {
            return TRUE;
        }
    }
    RDK_LOG( RDK_LOG_ERROR, LOG_NMGR, "[%s:%s:%d] no valid ip so rejecting the dns values %s \n", MODULE_NAME,__FUNCTION__, __LINE__ ,hostname);
    if(tokens)
        g_strfreev(tokens); 
    return FALSE;
}
gboolean checkvalidhostname ( char * hostname ) { RDK_LOG ( RDK_LOG_TRACE1 , LOG_NMGR , " \n " , MODULE_NAME , __FUNCTION__ , __LINE__ ) ; if ( g_strrstr ( g_strstrip ( hostname ) , " " ) || ! * hostname ) { RDK_LOG ( RDK_LOG_ERROR , LOG_NMGR , " \n " , MODULE_NAME , __FUNCTION__ , __LINE__ , hostname ) ; return TRUE ; } gchar * * tokens = g_strsplit_set ( hostname , " \n \0 " , -1 ) ; guint toklength = g_strv_length ( tokens ) ; guint loopvar = 0 ; for ( loopvar = 0 ; loopvar < toklength ; loopvar ++ ) { if ( checkvalidip ( tokens [ loopvar ] ) ) { return TRUE ; } } RDK_LOG ( RDK_LOG_ERROR , LOG_NMGR , " \n " , MODULE_NAME , __FUNCTION__ , __LINE__ , hostname ) ; if ( tokens ) g_strfreev ( tokens ) ; return FALSE ; }
@brief This function will check whether a Host name is valid by validating all the associated IP addresses.
@brief This function will check whether a Host name is valid by validating all the associated IP addresses .
/*CID-24000*/