RDK Documentation (Open Sourced RDK Components)
CurlStore Class Reference

Singleton curlstore to save/reuse curl handles. More...

#include <AampCurlStore.h>

Collaboration diagram for CurlStore:
Collaboration graph

Public Member Functions

AampCurlStoreErrorCode GetFromCurlStore (const std::string &hostname, AampCurlInstance CurlIndex, CURL **curl)
 
AampCurlStoreErrorCode GetFromCurlStoreBulk (const std::string &hostname, AampCurlInstance CurlIndex, int count, void *priv, bool HostCurlFd)
 
void KeepInCurlStore (const std::string &hostname, AampCurlInstance CurlIndex, CURL *curl)
 
void KeepInCurlStoreBulk (const std::string &hostname, AampCurlInstance CurlIndex, int count, void *priv, bool HostCurlFd)
 
void RemoveCurlSock (void)
 
void ShowCurlStoreData (bool trace=true)
 
void CurlInit (void *privContext, AampCurlInstance startIdx, unsigned int instanceCount, std::string proxyName, const std::string &remotehost=std::string(""))
 
void CurlTerm (void *privContext, AampCurlInstance startIdx, unsigned int instanceCount, const std::string &remotehost=std::string(""))
 
CURL * GetCurlHandle (void *pAamp, std::string url, AampCurlInstance startIdx)
 
void SaveCurlHandle (void *pAamp, std::string url, AampCurlInstance startIdx, CURL *curl)
 
CurlSocketStoreStructCreateCurlStore (const std::string &hostname)
 
CURL * CurlEasyInitWithOpt (void *privContext, const std::string &proxyName, int instId)
 
CURL * GetCurlHandleFromFreeQ (CurlSocketStoreStruct *CurlSock, int instId)
 
 CurlStore (const CurlStore &)=delete
 
CurlStoreoperator= (const CurlStore &)=delete
 

Static Public Member Functions

static CurlStoreGetCurlStoreInstance (void *pContext)
 

Private Types

typedef std::unordered_map< std::string, CurlSocketStoreStruct * > CurlSockData
 
typedef std::unordered_map< std::string, CurlSocketStoreStruct * >::iterator CurlSockDataIter
 

Private Attributes

CurlSockData umCurlSockDataStore
 

Static Private Attributes

static CurlStoreCurlInstance = NULL
 
static pthread_mutex_t mCurlInstLock = PTHREAD_MUTEX_INITIALIZER
 
static int MaxCurlSockStore = 10
 

yes

Singleton curlstore to save/reuse curl handles.

Definition at line 100 of file AampCurlStore.h.

Member Function Documentation

◆ GetFromCurlStore()

AampCurlStoreErrorCode CurlStore::GetFromCurlStore ( const std::string &  hostname,
AampCurlInstance  CurlIndex,
CURL **  curl 
)
Parameters
[in]hostname- hostname part from url
[in]CurlIndex- Index of Curl instance
[out]curl- curl easy handle from curl store.
Returns
AampCurlStoreErrorCode enum type

Definition at line 669 of file AampCurlStore.cpp.

◆ GetFromCurlStoreBulk()

AampCurlStoreErrorCode CurlStore::GetFromCurlStoreBulk ( const std::string &  hostname,
AampCurlInstance  CurlIndex,
int  count,
void *  priv,
bool  HostCurlFd 
)
Parameters
[in]hostname- hostname part from url
[in]CurlIndex- Index of Curl instance
[in]count- No of curl handles
[out]priv- curl easy handle from curl store will get stored in priv instance
Returns
AampCurlStoreErrorCode enum type

Definition at line 590 of file AampCurlStore.cpp.

◆ KeepInCurlStore()

void CurlStore::KeepInCurlStore ( const std::string &  hostname,
AampCurlInstance  CurlIndex,
CURL *  curl 
)
Parameters
[in]hostname- hostname part from url
[in]CurlIndex- Index of Curl instance
[in]curl- curl easy handle to save in curl store.
Returns
void

Definition at line 782 of file AampCurlStore.cpp.

◆ KeepInCurlStoreBulk()

void CurlStore::KeepInCurlStoreBulk ( const std::string &  hostname,
AampCurlInstance  CurlIndex,
int  count,
void *  priv,
bool  HostCurlFd 
)
Parameters
[in]hostname- hostname part from url
[in]CurlIndex- Index of Curl instance
[in]count- No of curl handles
[out]priv- curl easy handles in priv instance, saved in curl store
Returns
void

Definition at line 729 of file AampCurlStore.cpp.

◆ RemoveCurlSock()

void CurlStore::RemoveCurlSock ( void  )
Parameters
void
Returns
void

Definition at line 812 of file AampCurlStore.cpp.

◆ ShowCurlStoreData()

void CurlStore::ShowCurlStoreData ( bool  trace = true)
Parameters
trace- true to print curl store data, otherwise false.
Returns
void

Definition at line 873 of file AampCurlStore.cpp.

◆ CurlInit()

void CurlStore::CurlInit ( void *  privContext,
AampCurlInstance  startIdx,
unsigned int  instanceCount,
std::string  proxyName,
const std::string &  remotehost = std::string("") 
)
Parameters
[out]privContext- priv aamp instance in which created curl handles will be assigned
[in]startIdx- Index of Curl instance
[in]instanceCount- No of curl handles
[in]proxyName- proxy name
Returns
void

Definition at line 393 of file AampCurlStore.cpp.

◆ CurlTerm()

void CurlStore::CurlTerm ( void *  privContext,
AampCurlInstance  startIdx,
unsigned int  instanceCount,
const std::string &  remotehost = std::string("") 
)
Parameters
[out]privContext- priv aamp instance from which curl handles will be terminated or stored
[in]startIdx- Index of Curl instance
[in]instanceCount- No of curl handles
Returns
void

Definition at line 468 of file AampCurlStore.cpp.

◆ GetCurlHandle()

CURL * CurlStore::GetCurlHandle ( void *  pAamp,
std::string  url,
AampCurlInstance  startIdx 
)
Parameters
[in]pAamp- Private aamp instance
[in]url- request url
[in]startIdx- Index of curl instance.
Returns
- curl easy handle

Definition at line 276 of file AampCurlStore.cpp.

◆ SaveCurlHandle()

void CurlStore::SaveCurlHandle ( void *  pAamp,
std::string  url,
AampCurlInstance  startIdx,
CURL *  curl 
)
Parameters
[in]pAamp- Private aamp instance
[in]url- request url
[in]startIdx- Index of curl instance.
[in]curl- curl handle to be saved
Returns
void

Definition at line 301 of file AampCurlStore.cpp.

◆ CreateCurlStore()

CurlSocketStoreStruct * CurlStore::CreateCurlStore ( const std::string &  hostname)
Parameters
[in]hostname- Host name to create a curl store
Returns
- Curl store struct pointer

Definition at line 238 of file AampCurlStore.cpp.

◆ CurlEasyInitWithOpt()

CURL * CurlStore::CurlEasyInitWithOpt ( void *  privContext,
const std::string &  proxyName,
int  instId 
)
Parameters
[in]privContext- Aamp context
[in]proxyName- Network proxy Name
[in]instId- Curl instance id
Returns
- Curl easy handle

Definition at line 323 of file AampCurlStore.cpp.

◆ GetCurlHandleFromFreeQ()

CURL * CurlStore::GetCurlHandleFromFreeQ ( CurlSocketStoreStruct CurlSock,
int  instId 
)
Parameters
[in]CurlSock- Curl socket struct
[in]instId- Curl instance id
Returns
- Curl easy handle

Definition at line 545 of file AampCurlStore.cpp.

◆ GetCurlStoreInstance()

CurlStore * CurlStore::GetCurlStoreInstance ( void *  pContext)
static
Parameters
[in]pContext- Private aamp instance
Returns
CurlStore - Singleton instance object

Definition at line 514 of file AampCurlStore.cpp.

Field Documentation

◆ MaxCurlSockStore

int CurlStore::MaxCurlSockStore = 10
staticprivate

Maximum no of host to be maintained in curl store

Definition at line 105 of file AampCurlStore.h.


The documentation for this class was generated from the following files: