RDK Firmware Upgrade is the module which is handling the PCI/PDRI image upgrades across various RDK profiles.

  • The modules updates the Xconf endpoint with current image configurations and capabilities on bootup. 
  • Parse the device configuration informations from XCONF server
  • Download the new release versions from CDL/CDN 


The module mainly includes following components

All Library present in common_utilities repo mention below url

rdkcentral/common_utilities

  1. RDK Core Download Daemon: This daemon includes the core APIs to do the core curl download functionalities. This API internally supports chunks download, throttling etc
  2. RDK HTTP retry LibraryThis includes wrapper APIs required to retry curl communication upon failures within a periodic interval. The maximum retry count here is 3 for direct download and 1 for codebig download.
  3. RFC Interface Library: This generic library includes the APIs that can be used to communicate with the RDK RFC Core module to get the RFC setting values to setup the runtime workflow.
  4. IARM Interface Library:  This library includes APIs that cane be used to communicate with the IARM Dbus modules for the IPC communications. Especially for the event updates and managements.
  5. CEDM Interface Library: This library includes the security APIs to get the encrypted URL endpoints, to decrypt the encrypted security information. Especially for the security support required for Firmware download and uupgrade
  6. Device Capability Library: This includes different APIs to get the device capability during the runtime to take business logic during Firmware Upgrade.
  7. Generic Utility Library: Includes different utility APIs for the internal workflow logic.
    1. To execute a system command from the process context and get the results. Will get replaced with system calls in future
    2. To verify a file inside the system
    3. To verify the file size
    4. create directory
  8. HTTP Fallback APIs:
  9. JSON APIs: Interface to functions for reading JSON values.
  10. Device Data APIs: Interface to functions for reading device data.

RDK core download APIs

Function

size_t urlHelperDownloadFile(CURL *curl, const char *file, char *dnl_start_pos, int chunk_dwnl_retry_time,
                                                    int *httpCode_ret_status, CURLcode *curl_ret_status);

Description

This routine will helps in downloading the files from specific endpoints in the arguments list. This routines internally supports chunk download and throttling if configured and passed as an arguments. This API will download the images.

Arguments: 

curl
        Pointer to curl object.
file
file name with path to download.
chunk_dwnl_retry_time
This option is use for retry logic in case of chunk download request.
dnl_start_pos
Set the download file start position, if the value is NULL the download will consider as a full download. 
If a valid pointer exists, then it is considered as the starting byte pointer and the download will start from the particular bytes onwards.
httpCode_ret_status
Holds the HTTP return status from the curl communication.
curl_ret_status
Holds the pointer to the curl structure having curl SUCCESS/FAILURE status with error codes.

Return Value
Return type size_t : Function will return the number of bytes downloaded.

Data Structures 

Data structure used for Firmware File Operations

typedef struct filedwnl {
        char url[MAX_BUFF_SIZE];
        char pathname[MAX_BUFF_SIZE1];
        bool sslverify;
        int chunk_dwnl_retry_time;
}FileDwnl_t;
pathname: Download image name with path details to store file.  Example: /tmp/CDL/PLTL11AEI_VBN_2203_sprint_20220412092103sdy-signed.bin 

sslverify: Use for get certificate status from curl request.

chunk_dwnl_retry_time : Used for add delay at the time of retry if chunk download fail. 
Data structure used for MTLS security operations
struct credential {
        char cert_name[64];  
        char cert_type[16];
        char key_pas[32];
}MtlsAuth_t;

struct credential is use for store and pass certificate and key/password to the urlHelperDownloadFile() API. If we pass this parameter as NULL in this case API will proceed without any authentication option set.

cert_name : Use for pass certificate file name.

cert_type: Use for pass certificate type. For Now P12 and PEM type support is present. 

key_pas: Use for pass key file or password.

NOTE:

  • If the cert_type is P12 in this case key_pas should be a password. And if the cert_type is PEM in this case key_pas should be key file name with path.
  • url: SSR server url. 

Function

void *doCurlInit(void)

Description

This is use for initializing curl and return pointer.

Function

void doStopDownload(void *curl)

Description

This is use for free all the curl recourse. The curl instance should pass as a input parameter.

Function

int doInteruptDwnl(void *in_curl, unsigned int max_dwnl_speed)

Description

This is use for interrupt download means pause and un pause for throttle feature.

Arguments

in_curl: This pointer to curl instance return from curl easy init.

max_dwnl_speed: use for the speed to set. if 0 means full speed no limit. This is based on curl lib implementation.
return type: int: 0 for success and other than 0 is fail

Function

int doHttpFileDownload(void *in_curl, FileDwnl_t file_dwnl, MtlsAuth_t *auth, curl_off_t max_dwnl_speed, char *dnl_start_pos, int* out_httpCode ); 

Description

This api is use for to do the file download and store inside file. This function will call "urlHelperDownloadFile()" internally for download file. which is described on above section 1.1.1

Arguments

in_curl: This pointer to curl instance return from curl easy init.

file_dwnl: This is the structure contains url, file download path, sslverify enable and chunk download retry. Structure details mention on section 1.1.1.2

auth: This is the structure contains authentication details like certificate and key to communicate with server.If the auth is NULL in this case download
will be try without certificate and key.

max_dwnl_speed : Argument to set the throttling functionality, if this variable value is 0 in this case there is no speed limit set.
In case of non zero the speed limit will set.

dnl_start_pos : This is use for chunk download feature. If the value is NULL in this case curl request is consider as full download.
If the value is not null in this case the curl request is consider as chunk download.

out_httpCode: send back http code.

Return type : int This function returns the curl code.

Function

int doAuthHttpFileDownload(void *in_curl, FileDwnl_t file_dwnl, char *headerData, int* out_httpCode ); 

Description

This api is use for to do the file download via codebig. This function will call "urlHelperDownloadFile()" internally for download file. which is described on above section 1.1.1.

Arguments

in_curl: This pointer to curl instance returns from curl init.

file_dwnl: This is the structure contains url, file download path, sslverify enable and chunk download retry. Structure details mention on section 1.1.1.2

headerData : Pass http header to this parameter.

out_httpCode: send back http code.

Return type : int This function returns the curl code.

Function

Download Header Information:

int urlHelperGetHeaderInfo(const char* url, MtlsAuth_t *sec, const char* pathname, long* httpCode_ret_status,  int *curl_ret_status);

Description

This api is use for fetch header information for the request file to download. This is use for get content length of the image in case of chunk download.

Arguments

url: Request server url.

sec: struct credential is use for store and pass certificate and key/password to the urlHelperGetHeaderInfo() API. If we pass this parameter as NULL in this case API will proceed without any authentication option set.

pathname: Save header file inside path.

httpCode_ret_status : Use for http code return status to caller.

curl_ret_status : Use For Curl code return status to caller.


Function

CURL *urlHelperCreateCurl(void);

Description

This api is use for initialize curl. This api is use inside doCurlInit function to get curl instances for further curl operation.

Arguments

parameter is void.

Return : Pointer to curl object.

Function

CURLcode setCommonCurlOpt(CURL *curl, const char *url, bool sslverify);

Description

This api is use for set all common curl options like url, sslverify, keep alive etc. This api is use inside doMtlsHttpFileDownload() function to set curl options.

Arguments

curl: Pointer to curl object.

url: Server url

sslverify: This value is true in this case sslverify option set as TRUE.

Return : Returns curl code.

Function

CURLcode setMtlsHeaders(CURL *curl, MtlsAuth_t *sec);

Description

This api is use for set mtls option in curl like certificate, key, password etc.

Arguments

curl: Pointer to curl object.

sec : Pointer to mtls structure.

Data structure used for MTLS security operations
struct credential {
        char cert_name[64];  
        char cert_type[16];
        char key_pas[32];
};

Return: curl code.

Function

CURLcode setCurlDebugOpt(CURL *curl, DbgData_t *debug);

Description

This api is use for enable curl verbos mode for debugging purpose. The verbos data print inside /tmp/curl_verbos_data.txt .

This api work when we enable compilation flag CURL_DEBUG.

Arguments

curl: Pointer to curl object.

debug: pointer to struct debugdata.

Data structure used for debugdata operations
struct credential {
       char trace_ascii;  /* 1 or 0 */
       FILE *verboslog;
};

Return : curl code

Function

CURLcode setCurlProgress(CURL *curl, struct curlprogress *curl_progress);

Description

This api is use for set curl progress data.

Arguments

curl: Pointer to curl object.

curl_progress : Pointer to struct curlprogress.

Data structure used for curlprogress operations
struct curlprogress {
    FILE *prog_store;
    curl_off_t lastruntime; /* type depends on version, see above */
    CURL *curl;
};

Return : curl code

Function

struct curl_slist* SetRequestHeaders( CURL *curl, struct curl_slist *pslist, char *pHeader );

Description

This api is use for adding http header information inside silgle link list provided by curl lib.

Arguments

curl : Pointer to curl object.

pslist : curl silgle link list.

pHeader : header information.

Return : pointer to linklist.


Function

CURLcode setThrottleMode(CURL *curl, curl_off_t max_dwnl_speed);

Description

This api is use for to enable Throttle mode which is set the maximum download speed based on max_dwnl_speed parameter.

if max_dwnl_speed value is zero in this case Throttle mode is not set.

Arguments

curl :Pointer to curl object.

max_dwnl_speed : download speed limit value.

Return: CURLcode

Function

int getJsonRpcData(void *in_curl, FileDwnl_t *pfile_dwnl, char *jsonrpc_auth_token, int *out_httpCode )

Description

This api is use for getting json rpc value.

Arguments

in_curl :Pointer to curl object.

pfile_dwnl : file data

jsonrpc_auth_token: token for communicate with json rpc.

out_httpCode: out data http status

Return: int

Function

unsigned int doGetDwnlBytes(void *in_curl)

Description

This api is use for get how many bytes downloaded.

Arguments

in_curl :Pointer to curl object.

Return: unsigned int: bytes downloaded


Function

int urlHelperPutReuqest(CURL *curl, void *upData, int *httpCode_ret_status, CURLcode *curl_ret_status)

Description

This api is use for curl put request

Arguments

in_curl :Pointer to curl object.

upData: Data to upload.

httpCode_ret_status: pointer to http code status.

curl_ret_status: Pointer to curl status

Return: int: 0: Success and -1: Failure

Function

size_t urlHelperDownloadToMem( CURL *curl, DownloadData *pDlData, int *httpCode_ret_status, CURLcode *curl_ret_status )

Description

This api is use for download data to buffer. This is use for xconf download

Arguments

in_curl :Pointer to curl object.

pDlData: Structure to store data

httpCode_ret_status: pointer to http code status.

curl_ret_status: Pointer to curl status

Return: size_t: Success: Return no of bytes received and failure: 0


RDK HTTP retry APIs

Function

int retryDownload(int server_type, const char* artifactLocationUrl, const char* localDownloadLocation, int retry_cnt, int delay, int *httpCode )

Description

This api is use for retry download.

Arguments

server_type : Pass HTTP_SSR or HTTP_CODEBIG.

artifactLocationUrl : Download url.

localDownloadLocation: File download path inside device.

retry_cnt : No of times for retry.

delay : Delay between the retry

httpCode : Return back the http status code.

Return: curl code, and if any of the parameter is NULL return -1.

RFC APIs

Function

int read_RFCProperty(char* type, const char* key, char *out_value);

Description

This api use for reading rfc and providing rfc value inside buffer

Arguments

type: Any unique string constant.

key: full url  (Example: Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RDKFirmwareUpgrader.Enable)

out_value: sending back rfc value inside this buffer.

Return int, Success 1 and Fail -1

Function

int write_RFCProperty(char* type, const char* key, const char *value, RFCVALDATATYPE datatype);

Description

This api use for writting  rfc data

Arguments

type: Any unique string constant.

key: full url  (Example: Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RDKFirmwareUpgrader.Enable)

value: value to write in rfc.

datatype: value data type. For now only support is present for bool and string.

Return int, Success WRITE_RFC_SUCCESS  and Fail WRITE_RFC_FAILURE

IARM APIs

Function

void eventManager(const char *cur_event_name, const char *event_status);

Description

This api use for sending event to the event manager.

Arguments

cur_event_name : Present Event name.

event_status : Send the status of the event to the IARM.

Return void

CEDM APIs

Function

int getMtlscert(MtlsAuth_t *sec);

Description

This api use for getting mtls certificate and store inside struct credential.

Arguments

sec: This is a structure use for store certificate, key and key type

Return: Success 1 and Fail -1

typedef struct credential {
        char cert_name[64]; => Save certificate file name with path
        char cert_type[16];  => Certificate Type
        char key_pas[32];    => Save key file name with path or password
}MtlsAuth_t;

Function

int doCodeBigSigning(const char* imageHTTPURL_IN, char *signurl, char *outhheader )

Description

This api is use for create sign url for codebig request.

Arguments

imageHTTPURL_IN : Use for hold the actual server url.

signurl : Hold the sign url.

outhheader : http request header.

Return : Success RDK_API_SUCCESS

Device Capability APIs:

Device Status Helper Interface:

Function

int isStateRedSupported(void);

Description

This is use for to check either device is having state red support or not.

Arguments

Param: void

Return: 1 =>  State Red support is present

             0 => State Red support is not present

Function

int isInStateRed(void);

Description

This is use for to check either device is already is state red or not

Arguments

param: void

Return : 1 => In state red
0 => Not in state red

Function

void checkAndEnterStateRed(int curlret, const char *disableStatsUpdate);

Description

This is use for to check either state red support is present or not and if it is present enter to state red with some specific curl error code.

Arguments

curlret: pass curl return value

disableStatsUpdate: This is use for to check either status update is enable or disable. In case of PDRI upgrade status update is false.

Return : void

Function

Description

int checkVideoStatus(const char *device_name);

This is for to check either video is playing in media client device or not.

Arguments

device_name: Pass the device name. This info will get inside device.property file

Return : 1 => Success

            -1 => Failure

Function

int isThrotEnable(const char *device_name);

Description

This is use to check euther throttle is enable or not.

Arguments

device_name : hold the device name.

Return : 1 => Throttle is Enable.

             -1 => Throttle is disable

Function

int isOCSPEnable(void);

Description

This api is use for to check either OCSP support is enable or disable. If OCSP support is enable in this case cert-status option set in curl option.

Arguments

param: void

Return : 1 in case of enable and -1 in case of disable.

Function

unsigned int getFileLastModifyTime(char *file_name)

Description

This api is use for get "file_name" last modification time.

Arguments

file_name : file name to check last modification time.

Return : Success :Last modification time

              Fail: 0

Function

time_t getCurrentSysTimeSec(void)

Description

This api is use for to get currect system time in second.

Arguments

param: void

Return : current time is second.

Function

int isDwnlBlock(int type)

Description

This api is use for to check either direct or codebig request is blocked or not

Arguments

type: Direct or codebig

Return: Success 1 amd failure -1

Generic Utility APIs

Function

int cmdExec(const char *cmd, char *output, unsigned int size_buff);

Description

This api is use for execute linux command and return the output inside the buffer.

Arguments

cmd: Linux command

output: Buffer to add command output. This buffer support 4096byte max.

size_buff: output buffer size.

Return: Type is int, RDK_API_SUCCESS and RDK_API_FAILURE

Function

int filePresentCheck(const char *file_name);

Description

This api used for checking either file is present or not.

Arguments

file_name: File name with path

Return int , RDK_API_SUCCESS  and RDK_API_FAILURE

Function

int getFileSize(const char *file_name);

Description

This api is use for getting the file size.

Arguments

file_name: Pass the file name with path.

Return: Success returns file name and failure returns -1

Function

int sysCmdExec(const char *cmd);

Description

This api is use for running linux command using system call.

Arguments

cmd: command to execute.

Return: Failure RDK_API_FAILURE 

RDK HTTP fall back APIs

Function

int fallBack(int server_type, const char* artifactLocationUrl, const char* localDownloadLocation, int *httpCode)

Description

This api is use for fall back. If direct download fail try for codebig and if codebig download fail try for direct.

Arguments

server_type : Pass HTTP_SSR or HTTP_CODEBIG.

artifactLocationUrl : Download url.

localDownloadLocation: File download path inside device.

httpCode : Return back the http status code.

Return: curl code, and if any of the parameter is NULL return -1.


1.9 JSON APIs

1.9.1 JSON struct definition

#include <cjson/cJSON.h>
typedef cJSON   JSON;

Please reference cJSON structure definition at https://github.com/DaveGamble/cJSON/blob/master/cJSON.h

1.9.2 Functions

/* function SetJsonVars - reads a json file and optionally writes individual pairs to
   an output file in the format name=value and/or set environment variables using name and value. 
   th the Usage: int SetJsonVars <Input JSON file> <Outfile file> <optional Set Environment Variables>
            Input JSON file - filename containing the JSON to parse.

            Output file - where to write the output name=value pairs. If NULL
            then no output file is created.

            Set Environment Variables - zero to skip setting of environment variables, 
            non-zero to set them. Defaults to 1 if argument is not present.

            RETURN - integer value of 0 on success, 1 otherwise.
*/
int SetJsonVars(char *fileIn, char *fileOut, int setenvvars);

/* function ParseJsonStr - returns a pointer to a JSON object.
   Usage: JSON *ParseJsonStr <Input JSON String>
 
            Input JSON String - a pointer to a string containing the JSON to parse. Typically, this input is
            the return from the GetJson() function call.

            RETURN - a pointer to a JSON object if parse was successful, NULL otherwise.
 
            Function Notes - The JSON pointer return must be freed by the caller when no longer needed
                       otherwise a memory leak will occur. Free the Json pointer by calling
                       FreeJson().
*/
JSON *ParseJsonStr(char *pJsonStr);

/* function FreeJson - deletes a JSON object created by ParseJsonStr
   Usage: int FreeJson <Input JSON *pJson> 
            Input JSON *pJson - a pointer to a JSON object to free, This would have been
                       created by a previous call to ParseJsonStr(). 

            RETURN - 0 if successful, non-zero otherwise.
*/
int FreeJson(JSON *pJson);

/* function GetJsonItem - returns a pointer to the requested JSON object.
 
   Usage: JSON* GetJsonItem <Input JSON pointer> <Search String>
 
            Input JSON pointer - a pointer to a JSON object. This would be the return from ParseJsonStr()
            or another JSON object within a larger JSON object.

            Search String - a pointer to a JSON object name to be searched for.

            RETURN - a JSON pointer to the item requested if it is found, NULL otherwise.
 
            Function Notes - the function returns a JSON object within a larger JSON. It does not
            return a pointer to a "name : value" pair.
 
*/
JSON* GetJsonItem(JSON *pJson, char *pValToGet);

/* function GetJsonValFromString - searches a JSON string for a name which matches the search string.
 
   Usage: size_t GetJsonValFromString <Input JSON String> <Search String> <Output Location> <Size of Output Location>
            Input JSON String - a pointer to a string containing the JSON to parse. Typically, this is
            the return from the GetJson() function call.

            Search String - a pointer to a string to be searched for. This is the "name" part of the
            "name : value" pair in the input string.

            Output Location - a character pointer to store the output value if found.

            Size of Output Location - The size of the Output Location storage. This value includes a
            NULL terminator. Size values of 1 or greater ensure a NULL terminated string.

            RETURN - an integer value equal to the number of characters copied to the Output Location.

            Function Notes - The function can return a length greater then the maxlen argument. If this occurs,
            it's indicative that data was truncated to prevent the output buffer from being overrun. A larger
            buffer is required to hold the complete output string.
*/
size_t GetJsonValFromString(char *pJsonStr, char *pValToGet, char *pOutputVal, size_t maxlen);

/* function GetJsonVal - searches a JSON string for a value.
 
   Usage: int GetJsonVal <Input JSON pointer> <Search String> <Output Location> <Size of Output Location>
 
            Input JSON pointer - a pointer to a JSON object. This would be the return from ParseJsonStr().

            Search String - a pointer to a string to be searched for. This is the "name" part of the 
            "name : value" pair in the input string.

            Output Location - a character pointer to store the output value if found.

            Size of Output Location - The size of the Output Location storage. This value includes a
            NULL terminator. Size values of 1 or greater ensure a NULL terminated string.

            RETURN - an integer value equal to the number of characters copied to the Output Location.
 
            Function Notes - The function can return a length greater then the maxlen argument. If this occurs,
            it's indicative that data was truncated to prevent the output buffer from being overrun. A larger
            buffer is required to hold the complete output string.
*/
size_t GetJsonVal(JSON *pJson, char *pValToGet, char *pOutputVal, size_t maxlen);

/* function GetJsonValContainingFromString - searches a JSON string for a name which conains all or part of the search string.
   This works similar to "grep."
 
   Usage: size_t GetJsonValContainingFromString <Input JSON String> <Search String> <Output Location> <Size of Output Location>
            Input JSON String - a pointer to a string containing the JSON to parse. Typically, this is
            the return from the GetJson() function call.

            Search String - a pointer to a string to be searched for. This is the "name" part of the
            "name : value" pair in the input string.

            Output Location - a character pointer to store the output value if found.

            Size of Output Location - The size of the Output Location storage. This value includes a
            NULL terminator. Size values of 1 or greater ensure a NULL terminated string.

            RETURN - an integer value equal to the number of characters copied to the Output Location.

            Function Notes - either pJsonStr or pJson is required but not both. If both arguments are supplied, pJson
            will be used. If using pCJson, be sure it is still valid (has not been deleted). The function can return a length
            greater then the maxlen argument. If this occurs, it's indicative that data was truncated to prevent the
            output buffer from being overrun. A larger buffer is required to hold the complete output string.
*/
size_t GetJsonValContainingFromString(char *pJsonStr, char *pValToGet, char *pOutputVal, size_t maxlen);

/* function GetJsonValContaining - searches a JSON string for a name which conains all or part of the search string.
   Usage: int GetJsonVal <Input JSON String> <Input void pointer> <Search String> <Output Location> <Size of Output Location>
            Input JSON String - a pointer to a string containing the JSON to parse. Typically, this is
            the return from the GetJson() function call. Either pass in a JSON string or a pointer to a cJson object.
            The cJson object pointer takes precedence if both are present.

            Input void pointer - a void pointer which will be cast to a cJson object. This would be the return from ParseJsonStr().
            Either pass in a JSON string or a void pointer. The void pointer takes precedence if
            both are present.

            Search String - a pointer to a string to be searched for. This is the "name" part of the
            "name : value" pair in the input string.

            Output Location - a character pointer to store the output value if found.

            Size of Output Location - The size of the Output Location storage. This value includes a
            NULL terminator. Size values of 1 or greater ensure a NULL terminated string.

            RETURN - an integer value equal to the number of characters copied to the Output Location.

            Function Notes - either pJsonStr or pJson is required but not both. If both arguments are supplied, pJson
            will be used. If using pCJson, be sure it is still valid (has not been deleted). The function can return a length
            greater then the maxlen argument. If this occurs, it's indicative that data was truncated to prevent the
            output buffer from being overrun. A larger buffer is required to hold the complete output string.
*/
size_t GetJsonValContaining(JSON *pJson, char *pValToGet, char *pOutputVal, size_t maxlen);

/* function GetJson - reads a json file and returns a pointer to a dynamically allocated
   (malloc'd) character array containing the JSON file. It is the caller's
   responsibilty to release the allocated memory using free().
   Usage: GetJson <Input JSON file>

            Input JSON file - filename containing the JSON to read.

            Returns - character pointer to string containing the contents of the JSON
            file if successful, NULL otherwise.
*/
char* GetJson(char *filename_in);

/* function IsJsonArray - checks to see if a JSON object is an array.
 
   Usage: bool IsJsonArray <Input JSON Object pointer>
 
            Input JSON Object - a pointer to the JSON object to be tested

            RETURN - true if object is an array, false otherwise.

*/
bool IsJsonArray(JSON *pJson);

/* function GetJsonArraySize - returns the number of items in a JSON array.
 
   Usage: unsigned GetJsonArraySize <Input JSON Object pointer>
 
            Input JSON Object - a pointer to the JSON object

            RETURN - the number of items in the JSON array. 0 (zero) if object is not an array

*/
unsigned GetJsonArraySize(JSON *pJson);

/* function GetJsonArrayItem - gets a JSON item from a JSON array.
 
   Usage: unsigned GetJsonArraySize <Pointer to array of JSON Objects> <Index of the JSON array item to return>
 
            Input JSON Object - a pointer to the JSON array.
 
            Input index - the JSON array item index to get

            RETURN - a pointer to a JSON item

*/
JSON* GetJsonArrayItem(JSON *pJson, unsigned index);



1.10 Device Data APIs

1.10.1 Functions
/* function GetServerUrlFile - scans a file for a URL. 
        Usage: size_t GetServerUrlFile <char *pServUrl> <size_t szBufSize> <char *pFileName>
 
            pServUrl - pointer to a char buffer to store the output string..

            szBufSize - the size of the character buffer in argument 1.

            pFileName - a character pointer to a filename to scan.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetServerUrlFile(char *pServUrl, size_t szBufSize, char *pFileName);


/* function GetTimezone - returns the timezone for the device. 
        Usage: size_t GetTimezone <char *pTimezone> <const char  *cpu> <size_t szBufSize>
 
            pTimezone - pointer to a char buffer to store the output string.

            cpuArch - poniter holds device cpu type

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetTimezone(char *pTimezone, const char *cpuArch, size_t szBufSize);

/* function GetAdditionalFwVerInfo - returns the PDRI filename plus Remote Info for the device. 
        Usage: size_t GetAdditionalFwVerInfo <char *pAdditionalFwVerInfo> <size_t szBufSize>
 
            pAdditionalFwVerInfo - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetAdditionalFwVerInfo(char *pAdditionalFwVerInfo, size_t szBufSize);

/* function GetPDRIFileName - returns the PDRI for the device. 
        Usage: size_t GetPDRIFileName <char *pPDRIFilename> <size_t szBufSize>
 
            pPDRIFilename - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetPDRIFileName(char *pPDRIFilename, size_t szBufSize);


/* function GetInstalledBundles - gets the bundles installed on a device. 
        Usage: size_t GetInstalledBundles <char *pBundles> <size_t szBufSize>
 
            pBundles - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetInstalledBundles(char *pBundles, size_t szBufSize);


/* function GetUTCTime - gets a formatted UTC device time. Example;
    Tue Jul 12 21:56:06 UTC 2022 
        Usage: size_t GetUTCTime <char *pUTCTime> <size_t szBufSize>
 
            pUTCTime - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetUTCTime(char *pUTCTime, size_t szBufSize);


/* function GetCapabilities - gets the device capabilities.
 
        Usage: size_t GetCapabilities <char *pCapabilities> <size_t szBufSize>
 
            pCapabilities - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetCapabilities(char *pCapabilities, size_t szBufSize);


/* function GetPartnerId - gets the partner ID of the device.
 
        Usage: size_t GetPartnerId <char *pPartnerId> <size_t szBufSize>
 
            pPartnerId - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetPartnerId(char *pPartnerId, size_t szBufSize);


/* function GetSerialNum - gets the serial number of the device.
 
        Usage: size_t GetSerialNum <char *pSerialNum> <size_t szBufSize>
 
            pSerialNum - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetSerialNum( char *pSerialNum, size_t szBufSize);


/* function GetExperience - gets the experience of the device.
 
        Usage: size_t GetExperience <char *pExperience> <size_t szBufSize>
 
            pExperience - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
// TODO: GetExperience must be implemented correctly
size_t GetExperience(char *pExperience, size_t szBufSize);


/* function GetAccountID - gets the account ID of the device.
 
        Usage: size_t GetAccountID <char *pAccountID> <size_t szBufSize>
 
            pAccountID - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetAccountID(char *pAccountID, size_t szBufSize);


/* function GetModelNum - gets the model number of the device.
 
        Usage: size_t GetModelNum <char *pModelNum> <size_t szBufSize>
 
            pModelNum - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetModelNum(char *pModelNum, size_t szBufSize);


/* function GetBuildType - gets the build type of the device in lowercase. Optionally, sets an enum
    indication the build type.
    Example: vbn or prod or qa or dev
 
        Usage: size_t GetBuildType <char *pBuildType> <size_t szBufSize> <BUILDTYPE *peBuildTypeOut>
 
            pBuildType - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.
 
            peBuildTypeOut - a pointer to a BUILDTYPE enum or NULL if not needed by the caller.
                Contains an enum indicating the buildtype if not NULL on function exit.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetBuildType(char *pBuildType, size_t szBufSize, BUILDTYPE *peBuildTypeOut);


/* function GetFirmwareVersion - gets the firmware version of the device.
 
        Usage: size_t GetFirmwareVersion <char *pFWVersion> <size_t szBufSize>
 
            pFWVersion - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetFirmwareVersion(char *pFWVersion, size_t szBufSize);


/* function GetEstbMac - gets the eSTB MAC address of the device.
 
        Usage: size_t GetEstbMac <char *pEstbMac> <size_t szBufSize>
 
            pEstbMac - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetEstbMac(char *pEstbMac, size_t szBufSize);


/* function GetRemoteInfo - gets the remote info of the device.
 
        Usage: size_t GetRemoteInfo <char *pRemoteInfo> <size_t szBufSize>
 
            pRemoteInfo - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetRemoteInfo(char *pRemoteInfo, size_t szBufSize);

/* function GetRdmManifestVersion - gets the remote info of the device.
 
        Usage: size_t GetRdmManifestVersion <char *pRdmManifestVersion> <size_t szBufSize>
 
            pRdmManifestVersion - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetRdmManifestVersion(char *pRdmManifestVersion, size_t szBufSize);


/* function GetTR181Url - gets a specific URL from tr181 associated with code downloads.
 
        Usage: size_t GetTR181Url <TR181URL eURL> <char *pRemoteInfo> <size_t szBufSize>
 
            eURL - the specific URL to query tr181 for.
 
            pUrlOut - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetTR181Url(TR181URL eURL, char *pUrlOut, size_t szBufSize);


/* function GetServURL - gets the correct XCONF URL based upon device configuration.
 
        Usage: size_t GetServURL <char *pServURL> <size_t szBufSize>
 
            pServURL - pointer to a char buffer to store the output string.

            szBufSize - the size of the character buffer in argument 1.

            RETURN - number of characters copied to the output buffer.
*/
size_t GetServURL(char *pServURL, size_t szBufSize);



 
  • No labels