47 #define SERVER_AUTH_FILE "DSM://auth.servers" 48 #define ACCESS_FILE_TIMEOUT_MS (1000 * 60 * 60 * 4) 49 #define MAX_CALLBACKS 5 66 static U32BIT lastAccessUpdate = 0;
68 static U16BIT callbackCount = 0;
74 static void AuthFileRetrieved(
void *userData,
S_CONTENT *content );
75 static void AuthFileRetrievalFailed(
void *userData );
76 static int GetLineLength(
U8BIT *
string,
U8BIT **remaining,
int max);
77 static void NotifyServerAccessReady(
void);
82 static void MHEG5UpdateServerAccess(
void)
94 AuthFileRetrieved, AuthFileRetrievalFailed );
118 timeToUpdate =
FALSE;
126 else if ((currentTime > lastAccessUpdate) &&
131 else if (currentTime < lastAccessUpdate)
139 MHEG5UpdateServerAccess();
142 switch (accessFileState)
145 permission = CheckUrlPermitted(url);
179 fileBuffer = accessFile.
data;
183 remainingChars = accessFile.
len;
184 lineLength = GetLineLength(line, &nextLine, remainingChars);
185 while (lineLength >= 0)
205 else if (*line ==
'#')
210 else if (strlen((
char *)url) <= (
size_t)lineLength)
224 if (line[lineLength - 1] ==
'/' || url[lineLength] ==
'/')
226 permission = entryAuthRequired;
233 remainingChars -= (lineLength + 1);
234 lineLength = GetLineLength(line, &nextLine, remainingChars);
248 static void AuthFileRetrieved(
void *userData,
S_CONTENT *content )
261 if (accessFile.
data != NULL)
263 accessFile.
len = content->
size;
266 accessFile.
data[accessFile.
len] =
'\0';
279 NotifyServerAccessReady();
290 static void AuthFileRetrievalFailed(
void *userData )
309 accessFile.
data = NULL;
315 NotifyServerAccessReady();
331 accessFile.
data = NULL;
348 fileLoadedCallback[callbackCount] = LoadNotifyCallback;
360 static int GetLineLength(
U8BIT *
string,
U8BIT **remaining,
int max)
366 if (
string != NULL && max > 0)
369 for (i = 0; i < max; i++)
372 if (
string[i] ==
'\n')
375 *remaining =
string + i + 1;
378 else if (
string[i] ==
'\0')
393 static void NotifyServerAccessReady(
void)
397 for (i = 0; i < callbackCount; i++)
399 if (fileLoadedCallback[i] != NULL)
401 fileLoadedCallback[i]();
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
Interface functions to DSM-CC instance for MHEG5.
void * MHEG5FileOrmGet(MHEG5String name, U16BIT priority, void *userData, F_CB_Good cbGood, F_CB_Fail cbFail)
Get a file. The file will be loaded and one of the callback functions called when request is resolved...
#define FRP_CACHE_DEFAULT
MHEG5ServerAccess_t MHEG5CheckServerPermitted(U8BIT *url)
This file defines the profile for the MHEG engine.
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
#define ACCESS_FILE_TIMEOUT_MS
Functions relating to HTTPS Server Access.
#define MHEG5strncmp(a, b, n)
File interface functions to DSMCC component.
void MHEG5AddServerAccessCallback(void(*LoadNotifyCallback)(void))
Add callback function to be called when the server access permission file is loaded.
#define USE_UNWANTED_PARAM(param)
void MHEG5ResetServerAccess(void)
Reset the cachedserver access permission file.
Header file - Function prototypes for operating system.