OpenJPEG: target_manager.c File Reference

OpenJPEG 2.5.0

Macros | Functions
target_manager.c File Reference
`#include <stdlib.h>`
`#include <string.h>`
`#include <stdio.h>`
`#include <assert.h>`
`#include <sys/types.h>`
`#include <unistd.h>`
`#include <sys/stat.h>`
`#include <fcntl.h>`
`#include <time.h>`
`#include "target_manager.h"`

## Macros
#define | FCGI_stdout stdout
#define | FCGI_stderr stderr
#define | logstream stderr

## Functions
targetlist_param_t * | gene_targetlist (void)
| generate a target list
int | open_jp2file (const char filepath[], char tmpfname[])
| open jp2 format image file
target_param_t * | gene_target (targetlist_param_t *targetlist, char *targetpath)
| generate a target
void | refer_target (target_param_t *reftarget, target_param_t **ptr)
| refer a target, used to make a new cache model
void | unrefer_target (target_param_t *target)
| refer a target, used to make a new cache model
void | delete_target (target_param_t **target)
| delete a target
void | delete_target_in_list (target_param_t **target, targetlist_param_t *targetlist)
| delete a target in list
void | delete_targetlist (targetlist_param_t **targetlist)
| delete target list
void | print_target (target_param_t *target)
| print target parameters
void | print_alltarget (targetlist_param_t *targetlist)
| print all target parameters
target_param_t * | search_target (const char targetname[], targetlist_param_t *targetlist)
| search a target by target name
target_param_t * | search_targetBytid (const char tid[], targetlist_param_t *targetlist)
| search a target by tid
int | open_remotefile (const char filepath[], char tmpfname[])

## Macro Definition Documentation

## ◆ FCGI_stderr

#define FCGI_stderr stderr

## ◆ FCGI_stdout

#define FCGI_stdout stdout

## ◆ logstream

#define logstream stderr

## Function Documentation

## ◆ delete_target()

void delete_target | ( | target_param_t ** | target | ) |

delete a target

Parameters

  [in,out] | target | address of the deleting target pointer

References delete_index(), FCGI_stderr, logstream, and opj_free().

Referenced by delete_target_in_list(), and delete_targetlist().

## ◆ delete_target_in_list()

void delete_target_in_list | ( | target_param_t ** | target,
|  | targetlist_param_t * | targetlist
| ) |  |

delete a target in list

Parameters

  [in,out] | target | address of the deleting target pointer
  [in] | targetlist | target list pointer

References delete_target(), targetlist_param::first, targetlist_param::last, and target_param::next.

## ◆ delete_targetlist()

void delete_targetlist | ( | targetlist_param_t ** | targetlist | ) |

delete target list

Parameters

  [in,out] | targetlist | address of the target list pointer

References delete_target(), target_param::next, and opj_free().

## ◆ gene_target()

target_param_t * gene_target | ( | targetlist_param_t * | targetlist,
|  | char * | targetpath
| ) |  |

generate a target

Parameters

  [in] | targetlist | target list to insert the generated target
  [in] | targetpath | file path or URL of the target

Returns
  pointer to the generated target

References target_param::codeidx, target_param::csn, FCGI_stderr, FCGI_stdout, target_param::fd, targetlist_param::first, isJPTfeasible(), target_param::jppstream, target_param::jptstream, targetlist_param::last, logstream, MAX_LENOFTID, target_param::next, target_param::num_of_use, open_jp2file(), opj_malloc(), OPJ_TRUE, parse_jp2file(), target_param::targetname, and target_param::tid.

Referenced by identify_target().

## ◆ gene_targetlist()

targetlist_param_t * gene_targetlist | ( | void |  | ) |

generate a target list

Returns
  pointer to the generated target list

References targetlist_param::first, targetlist_param::last, and opj_malloc().

## ◆ open_jp2file()

int open_jp2file | ( | const char | filepath[],
|  | char | tmpfname[]
| ) |  |

open jp2 format image file

Parameters

  [in] | filepath | file name (.jp2)
  [out] | tmpfname | new file name if filepath is a URL

Returns
  file descriptor

References FCGI_stdout, open_remotefile(), opj_free(), and opj_malloc().

Referenced by gene_target().

## ◆ open_remotefile()

int open_remotefile | ( | const char | filepath[],
|  | char | tmpfname[]
| ) |  |

References FCGI_stderr, FCGI_stdout, and MAX_LENOFTID.

Referenced by open_jp2file().

## ◆ print_alltarget()

void print_alltarget | ( | targetlist_param_t * | targetlist | ) |

print all target parameters

Parameters

  [in] | targetlist | target list pointer

References targetlist_param::first, target_param::next, and print_target().

## ◆ print_target()

void print_target | ( | target_param_t * | target | ) |

print target parameters

Parameters

  [in] | target | target pointer

References target_param::csn, logstream, target_param::targetname, and target_param::tid.

Referenced by print_allsession(), and print_alltarget().

## ◆ refer_target()

void refer_target | ( | target_param_t * | reftarget,
|  | target_param_t ** | ptr
| ) |  |

refer a target, used to make a new cache model

Parameters

  [in] | reftarget | reference target pointer
  [out] | ptr | address of feeding target pointer

References target_param::num_of_use.

Referenced by gene_cachemodel().

## ◆ search_target()

target_param_t * search_target | ( | const char | targetname[],
|  | targetlist_param_t * | targetlist
| ) |  |

search a target by target name

Parameters

  [in] | targetname | target name
  [in] | targetlist | target list pointer

Returns
  found target pointer

References targetlist_param::first, target_param::next, and target_param::targetname.

Referenced by identify_target().

## ◆ search_targetBytid()

target_param_t * search_targetBytid | ( | const char | tid[],
|  | targetlist_param_t * | targetlist
| ) |  |

search a target by tid

Parameters

  [in] | tid | target identifier
  [in] | targetlist | target list pointer

Returns
  found target pointer

References targetlist_param::first, target_param::next, and target_param::tid.

Referenced by identify_target().

## ◆ unrefer_target()

void unrefer_target | ( | target_param_t * | target | ) |

refer a target, used to make a new cache model

Parameters

  [in] | target | reference pointer to the target

References target_param::num_of_use.

Referenced by delete_cachemodel().