30 #ifndef HOSTIF_UTILS_H_
31 #define HOSTIF_UTILS_H_
37 #include "hostIf_tr69ReqHandler.h"
39 #define REBOOT_SCR "sh /rebootNow.sh -s hostIf_utils"
40 #define SCR_PATH "/lib/rdk"
41 #define NTP_FILE_NAME "/opt/persistent/firstNtpTime"
42 #define FW_DWN_FILE_PATH "/opt/fwdnldstatus.txt"
43 #define TEMP_FW_DWN_FILE_PATH "/opt/fwdnldstatus_tmp.txt"
44 #define JSONRPC_URL "http://127.0.0.1:9998/jsonrpc"
47 #define BUFF_MIN_16 16
48 #define BUFF_LENGTH_16 16
49 #define BUFF_LENGTH_32 32
50 #define BUFF_LENGTH_64 64
51 #define BUFF_LENGTH_128 128
52 #define BUFF_LENGTH_256 256
53 #define BUFF_LENGTH_1024 1024
54 #define BUFF_LENGTH BUFF_LENGTH_1024
56 static const char* NOT_IMPLEMENTED =
"Not Implemented";
58 static const char* STATE_UP =
"Up";
59 static const char* STATE_DOWN =
"Down";
61 static const char* TIME_UNKNOWN =
"0001-01-01T00:00:00Z";
62 static const char* TIME_INFINITY =
"9999-12-31T23:59:59Z";
64 typedef enum __eSTBResetState
76 const char *enumString;
88 #define LOG_ENTRY_EXIT EntryExitLogger logger (__FUNCTION__, __FILE__)
90 static volatile eSTBResetState gResetState = NoReset;
92 void setResetState( eSTBResetState );
94 eSTBResetState getResetState(
void );
96 void triggerResetScript(
void);
102 bool matchComponent(
const char* pParam,
const char *pKey,
const char **pSetting,
int &instanceNo);
104 int get_int(
const char *ptr);
106 void put_int(
char *ptr,
int val);
108 uint get_uint(
char *ptr);
110 void put_uint(
char *ptr, uint val);
112 bool get_boolean(
const char *ptr);
116 int get_ulong(
const char* ptr);
118 void put_ulong(
char *ptr,
unsigned long val);
120 std::string int_to_string(
int d);
122 std::string uint_to_string(uint d);
124 std::string ulong_to_string(
unsigned long d);
126 int string_to_int(
const char *value);
128 uint string_to_uint(
const char *value);
130 unsigned long string_to_ulong(
const char *value);
132 bool string_to_bool(
const char *value);
141 void set_ACSStatus(
bool enabled);
146 bool get_ACSStatus();
148 bool set_GatewayConnStatus();
149 bool get_GatewayConnStatus();
158 int read_command_output (
char* cmd,
char* resultBuff,
int length);
164 #ifndef NEW_HTTP_SERVER_DISABLE
166 long timeValDiff(
struct timespec *starttime,
struct timespec *finishtime);
168 void setLegacyRFCEnabled(
bool value);
169 bool legacyRFCEnabled();
174 bool isNtpTimeFilePresent();
175 unsigned long get_system_manageble_ntp_time();
176 unsigned long get_device_manageble_time();