/*
 *            Copyright (c) 1998-2002 by NETsilicon Inc.  
 *
 *  This software is copyrighted by and is the sole property of
 *  NETsilicon.  All rights, title, ownership, or other interests
 *  in the software remain the property of NETsilicon.  This
 *  software may only be used in accordance with the corresponding
 *  license agreement.  Any unauthorized use, duplication, transmission,
 *  distribution, or disclosure of this software is expressly forbidden.
 *
 *  This Copyright notice may not be removed or modified without prior
 *  written consent of NETsilicon.
 *
 *  NETsilicon, reserves the right to modify this software
 *  without notice.
 *
 *  NETsilicon
 *  411 Waverley Oaks Road                  USA 781.647.1234
 *  Suite 227                               http://www.netsilicon.com
 *  Waltham, MA 02452                       AmericaSales@netsilicon.com
 *
 *************************************************************************
 *
 *     Module Name: appconf_api.c
 *         Version: 1.00
 *   Original Date: 08/15/02
 *	    	Author: Dale Lee
 *        Language: Ansi C
 * Compile Options:
 * Compile defines:
 *       Libraries:
 *    Link Options:
 *
 *    Entry Points:	
 *					NAGetAppErrorHandler ()
 *					NAGetAppRootStackSize
 *					NAGetAppRootPriority ()
 *					NAGetDefaultAPIPriorty ()
 *					NAGetAppFileSystemSize ()
 *					NAGetAppDialogPort ()
 *					NAGetAppDialogAppName ()
 *					NAGetAppAngelBootRom ()
 *					NAGetAppRootPassword ()
 *					NAGetAppAdministratorsAccount ()
 *					NAGetAppFixedGatewayKey ()
 *					NAGetAppUseNetworkTimeProtocol ()
 *					NAGetAppUseKerberos ()
 *					NAKrb5GetMaxPrincipals ()
 *					NAKrb5GetMaxApRequests ()
 *					NAGetAppPost ()
 *					NAGetAppBurnInTest ()
 *					NAGetAppStdioPort ()
 *					NAGetAppUseNvram ()
 *					NAGetAppNetHeapSize ()
 *					NAGetAppStartupMode ()
 *					NAGetAppEnablePPP1 ()
 *					NAGetAppPPP1Address ()
 *					NAGetAppPPP1PeerAddress ()
 *					NAGetAppEnablePPP2 ()
 *					NAGetAppPPP2Address ()
 *					NAGetAppPPP2PeerAddress ()
 *					NAGetAppIpAddress ()
 *					NAGetAppIpSubnetMask ()
 *					NAGetAppIpGateway ()
 *					NAGetAppSntpPrimary ()
 *					NAGetAppSntpSecondary ()
 *					NAGetAppKerberosKdc ()
 *					NAGetAppKerberosUsername ()
 *					NAGetAppKerberosPassword ()
 *					NAGetAppKerberosRealmName ()
 *					NAGetAppBspSerialNum ()
 *					NAGetAppBspDelay ()
 *					NAGetAppBspBaudRate ()
 *					NAGetAppUseStaticIP()
 *					NAGetEnableHdlc ()
 *					NAGetAppDisableRouterAds
 *			
 *
 * Description.
 * =======================================================================
 * This file contains the functions that wraps around the application 
 * configuration values in appconf.h. The application will no longer
 * need to directly link in any files which requires appconf.h
 *
 *
 * Edit Date/Ver   Edit Description
 * ==============  =======================================================
 * LZ   10/21/02   Removed checkAppUseNvram().
 * JZW  01/09/04   Added NAGetAppDisableRouterAds
 */

/**
 *
 * The Application Configuration API are the functions that wrap around the application
 * configuration values in appconf.h.
 *
 * Using the Application Configuration API requires the header file:
 * <list type = "unordered">
 *	<item> appconf_api.h </item>
 * </list> 
 *
 * 
 * @external
 * @overview Application Configuration
 * @category ApplicationConfiguration
 * @since 6.0
 */

#include <stdio.h>
#include <string.h>
#include <Npttypes.h>
#include <appconf.h>
#include <netoserr.h>
#include "bsp_api.h"
#include "boardParams.h"
#include <appconf_api.h>

/**
 * Returns the value of APP_ENABLE_AUTO_IP in appconf.h
 *
 * The value determines whether Auto-IP will be enabled on the "eth0:0"
 * network interface.
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_ENABLE_AUTO_IP
 *
 * @return TRUE             Auto-IP should be enabled
 * @return FALSE            Auto-IP should not be enabled
 */
BOOLEAN NAGetEnableAutoIp(void)
{
    BOOLEAN result = FALSE;
    
    #ifdef APP_ENABLE_AUTO_IP
        NA_ASSERT((APP_ENABLE_AUTO_IP == TRUE) || (APP_ENABLE_AUTO_IP == FALSE));
        
        result = APP_ENABLE_AUTO_IP;
    #endif
    
    return result;
}

         

/**
 * Returns the value of APP_DEFAULT_ETHERNET_DUPLEX in appconf.h
 *
 * The value determines what Ethernet duplex setting should be used if the 
 * Ethernet hub or switch we are connected to does not support autonegotiation.
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_DEFAULT_ETHERNET_DUPLEX
 *
 * @return bpFullDuplex     Default is full duplex Ethernet
 * @return bpHalfDuplex     Default is half duplex Ethernet
 * @return bpDefaultDuplex  Use PHY's default setting
 */
bpDuplexLevelType NAGetDefaultEthernetDuplex(void)
{
    bpDuplexLevelType result = bpDefaultDuplex;
    
#ifdef APP_DEFAULT_ETHERNET_DUPLEX
    result = APP_DEFAULT_ETHERNET_DUPLEX;
#endif
    return result;
}


/**
 * Returns the setting of the APP_ERROR_HANDLER value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_ERROR_HANDLER
 *
 * @return NULL             no user error handler is defined
 * @return otherwise        pointer to user defined error handler
 */
userErrorHandlerType NAGetAppErrorHandler(void)
{
	#ifdef APP_ERROR_HANDLER
		return (APP_ERROR_HANDLER);
	#else
		return (NULL);
	#endif
}



/**
 * Returns the setting of the APP_ROOT_STACK_SIZE value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_ROOT_STACK_SIZE
 *
 * @return stack-size       Stack size for root thread.
 */
int NAGetAppRootStackSize(void)
{
	#if APP_ROOT_STACK_SIZE 
		return (APP_ROOT_STACK_SIZE);
	#else
		Error: Must be defined with a value
	#endif
}

/**
 * Returns the setting of the APP_ROOT_PRIORITY value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_ROOT_PRIORITY
 *
 * @return priority-level    Priority level root thread will run at.
 */
int NAGetAppRootPriority(void)
{
	#if APP_ROOT_PRIORITY
		return (APP_ROOT_PRIORITY);
	#else
		Error: Must be defined with a value
	#endif
}

/**
 * Returns the setting of the APP_DEFAULT_API_PRIORITY value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_DEFAULT_API_PRIORITY
 *
 * @return priority-level     Suggested default priority level for application threads.
 */
int NAGetAppDefaultAPIPriority(void)
{
	#ifdef APP_DEFAULT_API_PRIORITY
		return (APP_DEFAULT_API_PRIORITY);
	#else
		Error: Must be defined with a value
	#endif
}


/**
 * Returns the setting of the APP_FILE_SYSTEM_SIZE value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_FILE_SYSTEM_SIZE  
 *
 * @return positive-value     Number of files AWS will support.
 * @return 0                  AWS file interface is disabled.
 */
int NAGetAppFileSystemSize(void)
{
	#ifdef APP_FILE_SYSTEM_SIZE
		return (APP_FILE_SYSTEM_SIZE);
	#else
		return (0);
	#endif
}

/**
 * Returns the setting of the APP_DIALOG_PORT value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_DIALOG_PORT   
 *
 * @return dialog-port     Port to use for configuration dialog.
 */
char * NAGetAppDialogPort(void)
{
	#ifdef APP_DIALOG_PORT
		return (APP_DIALOG_PORT);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_DIALOG_APP_NAME value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_DIALOG_APP_NAME
 *
 * @return name  Application name to display in dialog.
 */
char * NAGetAppDialogAppName(void)
{
	#ifdef APP_DIALOG_APP_NAME
		return (APP_DIALOG_APP_NAME);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_ROOT_PASSWORD value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_ROOT_PASSWORD     
 *
 * @return password     Default password for 'root' user.
 */
char * NAGetAppRootPassword(void)
{
	#ifdef APP_ROOT_PASSWORD
		return (APP_ROOT_PASSWORD);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_ADMINISTRATORS_ACCOUNT value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_ADMINISTRATORS_ACCOUNT
 *
 * @return username   Username for secure gateway account.
 * @return NULL       No user name has been set.
 */
char * NAGetAppAdministratorsAccount(void)
{
	#ifdef APP_ADMINISTRATORS_ACCOUNT
		return (APP_ADMINISTRATORS_ACCOUNT);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_FIXED_GATEWAY_KEY value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_FIXED_GATEWAY_KEY     Fixed key for secure gateway.
 *
 * @return NULL     No key has been setup for gateway.
 * @return key      Pointer to key for gateway.
 */
char * NAGetAppFixedGatewayKey(void)
{
	#ifdef APP_FIXED_GATEWAY_KEY
		return (APP_FIXED_GATEWAY_KEY);
	#else
		return (NULL);
	#endif
}


/**
 * Returns the setting of the APP_USE_NETWORK_TIME_PROTOCOL value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_USE_NETWORK_TIME_PROTOCOL
 *
 * @return TRUE     BSP will setup SNTP client.
 * @return FALSE    BSP will not setup SNTP client.
 */
int NAGetAppUseNetworkTimeProtocol(void)
{
	#ifdef APP_USE_NETWORK_TIME_PROTOCOL
		return (TRUE);
	#else
		return (FALSE);
	#endif
}


/**
 * Returns the value of APP_USE_KERBEROS as set in appconf.h.
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_USE_KERBEROS
 *
 * @return TRUE     Access to kerberos parameters is enabled.
 * @return FALSE    Access to kerberos parameters is disabled.
 */
int NAGetAppUseKerberos(void)
{
	#ifdef APP_USE_KERBEROS
		return (TRUE);
	#else
		return (FALSE);
	#endif
}

/*
 * Returns the setting of the NAKRB5_MAX_PRINCIPALS value defined in APPCONF.h
 *
 * *external
 * *category ApplicationConfiguration
 * *since 6.0
 * *see @link NAKRB5_MAX_PRINCIPALS
 *
 * *return NAKRB5_MAX_PRINCIPALS
 */
int NAKrb5GetMaxPrincipals(void)
{
	#ifdef NAKRB5_MAX_PRINCIPALS
		return (NAKRB5_MAX_PRINCIPALS);
	#else
		return (0);
	#endif
}


/*
 * Returns the setting of the NAKRB5_MAX_AP_REQUESTS value defined in APPCONF.h
 *
 * *external
 * *category ApplicationConfiguration
 * *since 6.0
 * *see @link NAKRB5_MAX_AP_REQUESTS
 *
 * *return max-requests     Maximum number of client requests all application servers can receive in CLOCK_SKEW time.
 */
int NAKrb5GetMaxApRequests(void)
{
	#ifdef NAKRB5_MAX_AP_REQUESTS
		return (NAKRB5_MAX_AP_REQUESTS);
	#else
		return (0);
	#endif
}


/**
 * Returns the setting of the APP_POST value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_POST
 *
 * @return TRUE     POST will be run at start up.
 * @return FALSE    POST will not be run at start up.
 */
int NAGetAppPost(void)
{
	#if APP_POST
		return (TRUE);
	#else
		return (FALSE);
	#endif
}


/**
 * Returns the setting of the APP_STDIO_PORT value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_STDIO_PORT
 *
 * @return pointer  Nul terminated string with name of port to direct stdio to.
 * @return NULL     Writes to stdio will be discarded.
 */
char * NAGetAppStdioPort(void)
{
	#ifdef APP_STDIO_PORT
		return (APP_STDIO_PORT);
	#else
		return (NULL);
	#endif
}


/**
 * Returns the setting of the APP_USE_NVRAM value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_USE_NVRAM
 *
 * @return TRUE     Read and write configuration values to NVRAM.
 * @return FALSE    Use hard coded default configuration values.
 */
int NAGetAppUseNvram(void)
{

	#if APP_USE_NVRAM
		return (TRUE);
	#else
		return (FALSE);
	#endif
}


/**
 * Returns the setting of the APP_NET_HEAP_SIZE value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_NET_HEAP_SIZE
 *
 * @return heap-size    Size of TCP/IP buffer pool.
 */
int NAGetAppNetHeapSize(void)
{
	#if  APP_NET_HEAP_SIZE
		return (APP_NET_HEAP_SIZE);
	#else
		Error: Must be defined with a value
	#endif
}

/**
 * Returns the setting of the APP_ENABLE_PPP1 value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 *
 * @return TRUE     PPP is enabled on /com/0.
 * @return FALSE    PPP is disabled on /com/0.
 */
int NAGetAppEnablePPP1(void)
{
	#if APP_ENABLE_PPP1
		return (TRUE);
	#else
		return (FALSE);
	#endif
}

/**
 * Returns the setting of the APP_PPP1_ADDRESS value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 *
 * @return address      IP address for PPP interface one.
 * @return NULL         PPP interface 1 is not configured.
 */
char * NAGetAppPPP1Address(void)
{
	#ifdef APP_PPP1_ADDRESS
		return (APP_PPP1_ADDRESS);
	#else
		return (NULL);
	#endif
}


/**
 * Returns the setting of the APP_PPP1_PEER_ADDRESS value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 *
 * @return address  IP address to assign to remote client.
 * @return NULL     PPP interface 1 is not configured.
 */
char * NAGetAppPPP1PeerAddress(void)
{
	#ifdef APP_PPP1_PEER_ADDRESS
    return (APP_PPP1_PEER_ADDRESS);
	#else
		return (NULL);
	#endif
}


/**
 * Returns the setting of the APP_ENABLE_PPP2 value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 *
 * @return TRUE     PPP interface 2 is enabled on /com/1.
 * @return FALSE    PPP interface 2 is disabled.
 */
int NAGetAppEnablePPP2(void)
{
	#if APP_ENABLE_PPP2
		return (TRUE);
	#else
		return (FALSE);
	#endif
}


/**
 * Returns the setting of the APP_PPP2_ADDRESS value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 *
 * @return address      IP address for PPP interface 2.
 * @return NULL         PPP interface 2 is not configured.
 */
char * NAGetAppPPP2Address(void)
{
	#ifdef APP_PPP2_ADDRESS
		return (APP_PPP2_ADDRESS);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_PPP2_PEER_ADDRESS value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 *
 * @return address      Adddress PPP interface 2 will assign to remote client.
 * @return NULL         PPP interface 2 is not configured.
 */
char * NAGetAppPPP2PeerAddress(void)
{
	#ifdef APP_PPP2_PEER_ADDRESS
		return (APP_PPP2_PEER_ADDRESS);
	#else
		return (NULL);
	#endif
}


/**
 * Returns the setting of the APP_IP_ADDRESS value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_IP_ADDRESS
 *
 * @return IP-Address   Default IP address.
 */
char * NAGetAppIpAddress(void)
{
	#ifdef APP_IP_ADDRESS
		return (APP_IP_ADDRESS);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_IP_SUBNET_MASK value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_IP_SUBNET_MASK
 *
 * @return subnet-mask  Default IP subnet mask.
 */
char * NAGetAppIpSubnetMask(void)
{
	#ifdef APP_IP_SUBNET_MASK
		return (APP_IP_SUBNET_MASK);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_IP_GATEWAY value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_IP_GATEWAY
 *
 * @return gateway-address      Default gateway address.
 */
char * NAGetAppIpGateway(void)
{
	#ifdef APP_IP_GATEWAY
		return (APP_IP_GATEWAY);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_SNTP_PRIMARY value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_SNTP_PRIMARY
 *
 * @return IP-Address       IP Address of primary SNTP server.
 */
char * NAGetAppSntpPrimary(void)
{
	#ifdef APP_SNTP_PRIMARY
		return (APP_SNTP_PRIMARY);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_SNTP_SECONDARY value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_SNTP_SECONDARY
 *
 * @return IP-Address       IP Address of secondary SNTP server.
 */
char * NAGetAppSntpSecondary(void)
{
	#ifdef APP_SNTP_SECONDARY
		return (APP_SNTP_SECONDARY);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_KERBEROS_KDC value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_KERBEROS_KDC
 *
 * @return IP-Address   Default Kerberos KDC IP Address
 */
char * NAGetAppKerberosKdc(void)
{
	#ifdef APP_KERBEROS_KDC
		return (APP_KERBEROS_KDC);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_KERBEROS_USERNAME value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_KERBEROS_USERNAME
 *
 * @return username     Username used at this KDC.
 */
char * NAGetAppKerberosUsername(void)
{
	#ifdef APP_KERBEROS_USERNAME
		return (APP_KERBEROS_USERNAME);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_KERBEROS_PASSWORD value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_KERBEROS_PASSWORD
 *
 * @return password     Password used at this KDC.
 */
char * NAGetAppKerberosPassword(void)
{
	#ifdef APP_KERBEROS_PASSWORD
		return (APP_KERBEROS_PASSWORD);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_KERBEROS_REALMNAME value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_KERBEROS_REALMNAME
 *
 * @return realm-name   Realm in which this account is used.
 */
char * NAGetAppKerberosRealmName(void)
{
	#ifdef APP_KERBEROS_REALMNAME
		return (APP_KERBEROS_REALMNAME);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the setting of the APP_BSP_SERIAL_NUM value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_BSP_SERIAL_NUM
 *
 * @return serial-number    Default serial number to use if NVRAM is not initialized.
 */
char * NAGetAppBspSerialNum(void)
{
	#ifdef APP_BSP_SERIAL_NUM
		return (APP_BSP_SERIAL_NUM);
	#else
		return (NULL);
	#endif
}

/**
 * Returns the MAC Address set in APP_BSP_MAC_ADDRESS.
 *
 * @external
 * @category ApplicationConfiguration  
 * @since 6.0
 * @see @link APP_DEFAULT_ETHERNET_DUPLEX
 *
 * @see @link APP_BSP_MAC_ADDRESS
 *
 * @return APP_BSP_MAC_ADDRESS  default Ethernet MAC address set in appconf.h
 */

char * NAGetAppBspMacAddress(void)
{
	#ifdef APP_BSP_MAC_ADDRESS
		return (APP_BSP_MAC_ADDRESS);
	#else
		return (NULL);
	#endif
}


/**
 * Returns the setting of the APP_BSP_DELAY value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_BSP_DELAY
 *
 * @return APP_BSP_DELAY        Default delay for configuration dialog.
 */
int NAGetAppBspDelay(void)
{
	#ifdef APP_BSP_DELAY
		return (APP_BSP_DELAY);
	#else
		Error: Must be defined with a value
	#endif
}

/**
 * Returns the setting of the APP_BSP_BAUD_RATE value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_BSP_BAUD_RATE
 *
 * @return APP_BSP_BAUD_RATE    Baud rate for configuration dialog.
 */
int NAGetAppBspBaudRate(void)
{
	#ifdef APP_BSP_BAUD_RATE
		return (APP_BSP_BAUD_RATE);
	#else
		Error: Must be defined with a value
	#endif
}

/**
 * Returns the setting of the APP_USE_STATIC_IP value defined in APPCONF.h
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_USE_STATIC_IP
 *
 * @return TRUE     Use a static IP address.
 * @return FALSE    Get an IP address from the network with ACE.
 */
int NAGetAppUseStaticIP(void)
{
    int result = FALSE;
    
    #ifdef APP_USE_STATIC_IP
    	#if APP_USE_STATIC_IP
    		result = TRUE;
    	#else
    		result = FALSE;
    	#endif
	#endif
	
	return result;
}


/*
 * Returns the setting of the APP_ENABLE_HDLC value defined in APPCONF.h
 *
 * *external
 * *category ApplicationConfiguration
 * *since 6.0
 * *see @link APP_ENABLE_HDLC
 *
 * *return APP_ENABLE_HDLC
 */
int NAGetEnableHdlc(void)
{
	#if APP_ENABLE_HDLC
		return (TRUE);
	#else
		return (FALSE);
	#endif
}

/**
 * Returns the setting of the APP_CPP value defined in APPCONF.h
 *
 * The routine calls _main() under Green Hills, if APP_CPP is defined to 
 * non-zero value     
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 * @see @link APP_CPP
 *
 * @return TRUE     BSP will Initialize the C++ runtime environment.
 * @return FALSE    BSP will not initialize the C++ runtime environment.
 */
int NAGetAppCpp(void)
{
#ifndef APP_CPP
#define APP_CPP     0
#endif

#if APP_CPP
#ifndef NETOS_GNU_TOOLS
	_main();                                    /* Call C++ static constructors */
#else
	/* Some arm/elf targets use the .init and .fini sections
	   to create constructors and destructors, and for these
	   targets we need to call the _init function and arrange
	   for _fini to be called at program exit.  */
	/* ThIS IS ESSENTIAL for NETOS CPP APPLICATION'S IOSTREAM*/
	extern void _fini();
	atexit(_fini);
	_init();
#endif
#endif

    return APP_CPP;
}

/**
 * Returns the setting of the APP_DISABLE_ROUTER_ADS value defined in APPCONF.h
 *
 *
 * @external
 * @category ApplicationConfiguration
 * @since 6.0
 *
 * @return Current definition of APP_DISABLE_ROUTER_ADS if defined
 * @return 1 (router ads disabled) if undefined
 */
int NAGetAppDisableRouterAds(void)
{
#ifdef APP_DISABLE_ROUTER_ADS
    return (APP_DISABLE_ROUTER_ADS);
#else
      return (1);    /* default is disabled */
#endif
}
