📄 repll.h
字号:
successful, TRUE is returned and the input parameter piContentID is
set accordingly. Otherwise FALSE is returned. It is the caller's
responsibility to delete the memory after the function has returned.
If the function returns TRUE, the size of the stored channel (in
BYTES, NOT including the resources) is stored in the piSize attribute.
The amount is also decucted from the reserved memory.
Input: void* (MUST be pREPCONTEXT), Channel data, and pointer to
ContentID
Output: BOOL
==========================================================================*/
BOOL REP_StoreChannel (void* pContext, pREPCONTENTSTRUCT pChannel,
UINT32* piContentID, UINT32* piSize);
/*========================================================================
REP_DeleteChannel
==========================================================================
The function removes the channel with the specified ID from the
repository. If the operation was successful, TRUE is returned,
otherwise FALSE is returned.
The function decreases the ref counter of all associated resources
with one if the channel state is *active*. If the state is
*installing*, the installing counter is decreased. The state of the
resource is changed if necessary (e.g. if ref counter and install
counter both are 0, the resource is removed).
If any resources are removed the function creates a tMODIFYRESOURCE-
element for each change needed in the root block. In that case, the
resource's ContentID, along with its hash value, is also removed from
the context.
Input: void* (MUST be pREPCONTEXT), ChannelID
Output: BOOL
==========================================================================*/
BOOL REP_DeleteChannel (void* pContext, UINT32 iChannelID);
/*========================================================================
REP_ActivateChannel
==========================================================================
The function activates a channel in the repository with the specified
ID. If the operation was successful, TRUE is returned, otherwise FALSE
is returned. The function increases the ref counter of all associated
resources with one, decreases the installing counter with one, and
changes the state of the resources accordingly.
The function creates a tMODIFYRESOURCE-element for the channel.
Input: void* (MUST be pREPCONTEXT), ChannelID
Output: BOOL
==========================================================================*/
BOOL REP_ActivateChannel (void* pContext, UINT32 iChannelID);
/*========================================================================
REP_GetRootBlock
==========================================================================
The function reads the Root Block from the repository and creates the
temporary ChannelList in the Context.
If the function returns TRUE, the function REP_GetAllChannels should
be called to create a list of all channels. If the function returns
FALSE, the function REP_ScanRepository should be called to create the
list.
Input: void* (MUST be pREPCONTEXT)
Output: TRUE if the Root Block exists and if it is OK, FALSE otherwise
==========================================================================*/
BOOL REP_GetRootBlock (void* pContext);
/*========================================================================
REP_ScanRepository
==========================================================================
NOTE! The current implementation does NOT return channels that are
*installing*. These channels are instead removed along with their
resources. This migth be subject to change.
The function scans the memory for content and creates a list of all
channels in the repository with status *active* and *installing*.
(Channels that have expired are removed from the repository). The
list is of the type LISTHEADER and the elements in the list are of
the type REPCHSTRUCT. It is the caller's responsibility to deallocate
the memory. The function should be called repeatedly until it returns
FALSE.
During the scan of the memory, the temporary ChannelList in the
Context is updated. Also, the resources in the repository are updated
according to the *active* and *installing* channels. Before the
function returns the last time, the Root Block in the persistent
memory is updated. (The function also deletes the temporary
ChannelList before returning.)
NOTE! When the function is called the first time, ppContentList
should be NULL.
Input: void* (MUST be pREPCONTEXT), void** (MUST be LISTHEADER**),
and current time
Output: TRUE if the function should be called again, FALSE otherwise
==========================================================================*/
BOOL REP_ScanRepository (void* pContext, void** ppContentList, UINT32 iTime);
/*========================================================================
REP_GetAllChannels
==========================================================================
NOTE! The current implementation does NOT return channels that are
*installing*. These channels are instead removed along with their
resources. This migth be subject to change.
The function reads from the repository and creates a list of all
channels in the repository with status *active* or *installing*.
(based on the temporary ChannelList in the Context). Channels that
have expired are removed from the repository. The created list is of
the type LISTHEADER and the elements in the list are of the type
tREPCHSTRUCT. It is the caller's responsibility to deallocate the
memory. The function should be called repeatedly until it returns
FALSE. Before the function returns the last time, the temporary
ChannelList in the Context is deleted.
NOTE! When the function is called the first time, ppContentList
should be NULL.
Input: void* (MUST be pREPCONTEXT), void** (MUST be LISTHEADER**),
and current time
Output: TRUE if the function should be called again, FALSE otherwise
==========================================================================*/
BOOL REP_GetAllChannels (void* pContext, void** ppContentList, UINT32 iTime);
/*========================================================================
REP_GetSizeOfContent
==========================================================================
Returns the size of the specified content.
Input: void* (MUST be pREPCONTEXT), ContentID
Output: UINT32, 0 if error
==========================================================================*/
UINT32 REP_GetSizeOfContent (void* pContext, UINT32 iContentID);
/*========================================================================
REP_AllocateMemory
==========================================================================
The function reserves the indicated amount of memory in the
repository. If there are enough memory left, TRUE is returned,
otherwise FALSE is returned.
The memory is freed with calls to the REP_FreeMemory function or when
the repository session is terminated.
Input: void* (MUST be pREPCONTEXT) and Size
Output: TRUE if the memory could be reserved, FALSE otherwise
==========================================================================*/
BOOL REP_AllocateMemory (void* pContext, UINT32 iSize);
/*========================================================================
REP_FreeMemory
==========================================================================
The function unreserves the indicated amount of memory from the
repository.
Input: void* (MUST be pREPCONTEXT) and Size
Output: -
==========================================================================*/
void REP_FreeMemory (void* pContext, UINT32 iSize);
/*========================================================================
REP_CompactRepository
==========================================================================
This function organizes the memory with no (minimal) fragmentation.
The function is called when a compactation of the repository is
needed. The function is called, for example, when content is to be
stored and the available memory in the repository is sufficient, but
fragmented in a way so that the largest free block is smaller than
the content. To allow scheduling, the compact process is not neces-
sarily completed with one function call. As long as the function
returns TRUE it is possible to compact the repository more.
Input: void* (MUST be pREPCONTEXT)
Output: TRUE if possible to compact more, FALSE otherwise
==========================================================================*/
BOOL REP_CompactRepository (void* pContext);
/*========================================================================
REP_ResetRepMem
==========================================================================
The function removes all content in the repository.
Input: void* (MUST be pREPCONTEXT)
Output: -
==========================================================================*/
void REP_ResetRepMem (void* pContext);
/*========================================================================
REP_InitRepMem
==========================================================================
The function creates a REPCONTEXT struct and initiates the fields in
the struct. NULL is returned if error.
Input: Size of repository.
Output: void* (type is pREPCONTEXT), NULL if error
==========================================================================*/
void* REP_InitRepMem (UINT32 iRepSize);
/*========================================================================
REP_TerminateRepMem
==========================================================================
The function removes the REPCONTEXT struct.
Input: void* (MUST be pREPCONTEXT)
Output: -
==========================================================================*/
void REP_TerminateRepMem (void* pContext);
/*========================================================================
REP_GetNextChToRemove
==========================================================================
The function returns the id of the channel that is about to be removed
next (with lowest value of expiry date). If there is no channel with
the expiry date attribute set, 0 is returned.
If a channel is found, the pliExpiryDate parameter is set with the
expiry date.
Input: void* (MUST be pREPCONTEXT), set pliExpiryDate to zero if no
channel to remove.
Output: LLIdToRemove, set to zero if no ch to remove.
==========================================================================*/
UINT32 REP_GetNextChToRemove (void* pContext, unsigned long int* pliExpiryDate );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -