src/services/route/src/routeSrvMgr.cpp
/**
 * @brief This will check whether the input IP Address is a valid IPv4 or IPv6 address.
 *
 * @param[in] ipAddress IP Address in string format.
 *
 * @return Returns TRUE if IP address is valid else returns FALSE.
 * @ingroup
 */
@brief This will check whether the input IP Address is a valid IPv4 or IPv6 address.
@param[in] ipAddress IP Address in string format.

@return Returns TRUE if IP address is valid else returns FALSE.
@ingroup
@brief This will check whether the input IP Address is a valid IPv4 or IPv6 address . @param [ in ] ipAddress IP Address in string format . @return Returns TRUE if IP address is valid else returns FALSE . @ingroup
gboolean checkvalidip( char* ipAddress)
{
    struct in_addr addr4;
    struct in6_addr addr6;
    RDK_LOG( RDK_LOG_TRACE1, LOG_NMGR, "[%s:%s:%d] Enter\n", MODULE_NAME,__FUNCTION__, __LINE__ );
    int validip4 = inet_pton(AF_INET, ipAddress, &addr4);
    int validip6 = inet_pton(AF_INET6, ipAddress, &addr6);
    if (g_strrstr(g_strstrip(ipAddress),"null") || ! *ipAddress )
    {
        RDK_LOG( RDK_LOG_ERROR, LOG_NMGR, "[%s:%s:%d] ipaddress are empty %s \n", MODULE_NAME,__FUNCTION__, __LINE__ ,ipAddress);
        return TRUE;
    }
    if ((validip4 == 1 ) || (validip6 == 1 ))
    {
        return TRUE;
    }
    else
    {
        RDK_LOG( RDK_LOG_ERROR, LOG_NMGR, "[%s:%s:%d] Not a valid ip address %s \n", MODULE_NAME,__FUNCTION__, __LINE__ ,ipAddress);
        return FALSE;
    }
}
gboolean checkvalidip ( char * ipAddress ) { struct in_addr addr4 ; struct in6_addr addr6 ; RDK_LOG ( RDK_LOG_TRACE1 , LOG_NMGR , " \n " , MODULE_NAME , __FUNCTION__ , __LINE__ ) ; int validip4 = inet_pton ( AF_INET , ipAddress , & addr4 ) ; int validip6 = inet_pton ( AF_INET6 , ipAddress , & addr6 ) ; if ( g_strrstr ( g_strstrip ( ipAddress ) , " " ) || ! * ipAddress ) { RDK_LOG ( RDK_LOG_ERROR , LOG_NMGR , " \n " , MODULE_NAME , __FUNCTION__ , __LINE__ , ipAddress ) ; return TRUE ; } if ( ( validip4 == 1 ) || ( validip6 == 1 ) ) { return TRUE ; } else { RDK_LOG ( RDK_LOG_ERROR , LOG_NMGR , " \n " , MODULE_NAME , __FUNCTION__ , __LINE__ , ipAddress ) ; return FALSE ; } }
@brief This will check whether the input IP Address is a valid IPv4 or IPv6 address.
@brief This will check whether the input IP Address is a valid IPv4 or IPv6 address .