OpenJPEG: cache_manager.c File Reference

OpenJPEG 2.1.2

Functions
cache_manager.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include "cache_manager.h"`

## Functions
cachelist_param_t * | gene_cachelist (void)
| generate a cache list More...
void | delete_cachelist (cachelist_param_t **cachelist)
| delete cache list More...
cache_param_t * | gene_cache (const char *targetname, int csn, char *tid, char *cid)
| generate a cache More...
void | delete_cache (cache_param_t **cache)
| delete a cache More...
void | insert_cache_into_list (cache_param_t *cache, cachelist_param_t *cachelist)
| insert a cache into list More...
cache_param_t * | search_cache (const char targetname[], cachelist_param_t *cachelist)
| search a cache by target name More...
cache_param_t * | search_cacheBycsn (int csn, cachelist_param_t *cachelist)
| search a cache by csn More...
cache_param_t * | search_cacheBycid (const char cid[], cachelist_param_t *cachelist)
| search a cache by cid More...
cache_param_t * | search_cacheBytid (const char tid[], cachelist_param_t *cachelist)
| search a cache by tid More...
void | add_cachecid (const char *cid, cache_param_t *cache)
| add cid into a cache More...
void | update_cachetid (const char *tid, cache_param_t *cache)
| update tid of a cache More...
void | remove_cidInCache (const char *cid, cache_param_t *cache)
void | remove_cachecid (const char *cid, cachelist_param_t *cachelist)
| remove cid in cache More...
void | print_cache (cache_param_t *cache)
| print cache parameters More...
void | print_allcache (cachelist_param_t *cachelist)
| print all cache parameters More...

## Function Documentation

## § add_cachecid()

void add_cachecid | ( | const char * | cid,
|  | cache_param_t * | cache
| ) |  |

add cid into a cache

Parameters

  [in] | cid | channel identifier
  [in] | cache | cache pointer

References cache_param::cid, and cache_param::numOfcid.

Referenced by handle_JPIPstreamMSG().

## § delete_cache()

void delete_cache | ( | cache_param_t ** | cache | ) |

delete a cache

Parameters

  [in] | cache | address of the cache pointer

References delete_metadatalist().

Referenced by delete_cachelist().

## § delete_cachelist()

void delete_cachelist | ( | cachelist_param_t ** | cachelist | ) |

delete cache list

Parameters

  [in,out] | cachelist | address of the cache list pointer

References delete_cache(), and cache_param::next.

Referenced by terminate_dec_server().

## § gene_cache()

cache_param_t* gene_cache | ( | const char * | targetname,
|  | int | csn,
|  | char * | tid,
|  | char * | cid
| ) |  |

generate a cache

Parameters

  [in] | targetname | target file name
  [in] | csn | codestream number
  [in] | tid | target identifier
  [in] | cid | channel identifier

Returns
  pointer to the generated cache

References cache_param::cid, cache_param::csn, cache_param::filename, gene_metadatalist(), cache_param::ihdrbox, cache_param::metadatalist, cache_param::next, cache_param::numOfcid, and cache_param::tid.

Referenced by handle_JPIPstreamMSG().

## § gene_cachelist()

cachelist_param_t* gene_cachelist | ( | void |  | ) |

generate a cache list

Returns
  pointer to the generated cache list

References cachelist_param::first, and cachelist_param::last.

Referenced by init_dec_server().

## § insert_cache_into_list()

void insert_cache_into_list | ( | cache_param_t * | cache,
|  | cachelist_param_t * | cachelist
| ) |  |

insert a cache into list

Parameters

  [in] | cache | cache pointer
  [in] | cachelist | cache list pointer

References cachelist_param::first, cachelist_param::last, and cache_param::next.

Referenced by handle_JPIPstreamMSG().

## § print_allcache()

void print_allcache | ( | cachelist_param_t * | cachelist | ) |

print all cache parameters

Parameters

  [in] | cachelist | cache list pointer

References cachelist_param::first, cache_param::next, and print_cache().

## § print_cache()

void print_cache | ( | cache_param_t * | cache | ) |

print cache parameters

Parameters

  [in] | cache | cache pointer

References cache_param::cid, cache_param::csn, cache_param::filename, cache_param::numOfcid, and cache_param::tid.

Referenced by print_allcache().

## § remove_cachecid()

void remove_cachecid | ( | const char * | cid,
|  | cachelist_param_t * | cachelist
| ) |  |

remove cid in cache

Parameters

  [in] | cid | channel identifier
  [in] | cachelist | cachelist pointer

References remove_cidInCache(), and search_cacheBycid().

Referenced by handle_dstCIDreqMSG().

## § remove_cidInCache()

void remove_cidInCache | ( | const char * | cid,
|  | cache_param_t * | cache
| ) |  |

References cache_param::cid, and cache_param::numOfcid.

Referenced by remove_cachecid(), and update_cachetid().

## § search_cache()

cache_param_t* search_cache | ( | const char | targetname[],
|  | cachelist_param_t * | cachelist
| ) |  |

search a cache by target name

Parameters

  [in] | targetname | target filename
  [in] | cachelist | cache list pointer

Returns
  found cache pointer

References cache_param::filename, cachelist_param::first, and cache_param::next.

Referenced by handle_CIDreqMSG(), handle_JPIPstreamMSG(), and handle_TIDreqMSG().

## § search_cacheBycid()

cache_param_t* search_cacheBycid | ( | const char | cid[],
|  | cachelist_param_t * | cachelist
| ) |  |

search a cache by cid

Parameters

  [in] | cid | channel identifer
  [in] | cachelist | cache list pointer

Returns
  found cache pointer

References cache_param::cid, cachelist_param::first, cache_param::next, and cache_param::numOfcid.

Referenced by handle_JP2saveMSG(), handle_PNMreqMSG(), handle_SIZreqMSG(), handle_XMLreqMSG(), and remove_cachecid().

## § search_cacheBycsn()

cache_param_t* search_cacheBycsn | ( | int | csn,
|  | cachelist_param_t * | cachelist
| ) |  |

search a cache by csn

Parameters

  [in] | csn | codestream number
  [in] | cachelist | cache list pointer

Returns
  found cache pointer

References cache_param::csn, cachelist_param::first, and cache_param::next.

Referenced by handle_JPIPstreamMSG().

## § search_cacheBytid()

cache_param_t* search_cacheBytid | ( | const char | tid[],
|  | cachelist_param_t * | cachelist
| ) |  |

search a cache by tid

Parameters

  [in] | tid | target identifer
  [in] | cachelist | cache list pointer

Returns
  found cache pointer

References cachelist_param::first, cache_param::next, and cache_param::tid.

Referenced by handle_PNMreqMSG(), and handle_SIZreqMSG().

## § update_cachetid()

void update_cachetid | ( | const char * | tid,
|  | cache_param_t * | cache
| ) |  |

update tid of a cache

Parameters

  [in] | tid | target identifier
  [in] | cache | cache pointer

References cache_param::filename, remove_cidInCache(), and cache_param::tid.

Referenced by handle_JPIPstreamMSG().