metadata_manager.c File Reference
`#include "metadata_manager.h"`
`#include <inttypes.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <limits.h>`
`#include <assert.h>`

## Macros

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

## Functions

metadatalist_param_t * | gene_metadatalist (void)
| generate a metadata list
metadatalist_param_t * | const_metadatalist (int fd)
| construct metadata-bin list of JP2 file
void | delete_metadatalist (metadatalist_param_t **list)
| delete metadata list
metadata_param_t * | gene_metadata (Byte8_t idx, boxlist_param_t *boxlist, placeholderlist_param_t *phldlist, boxcontents_param_t *boxcontents)
| generate a metadata bin
void | delete_metadata (metadata_param_t **metadata)
| delete a metadata bin
void | insert_metadata_into_list (metadata_param_t *metabin, metadatalist_param_t *metadatalist)
| insert a metadata-bin into list
void | print_metadata (metadata_param_t *metadata)
| print metadata-bin parameters
void | print_allmetadata (metadatalist_param_t *list)
| print all metadata parameters
boxcontents_param_t * | gene_boxcontents (OPJ_OFF_T offset, OPJ_SIZE_T length)
| generate box contents
metadata_param_t * | search_metadata (Byte8_t idx, metadatalist_param_t *list)
| search a metadata bin by index
Byte8_t | search_metadataidx (char boxtype[4], metadatalist_param_t *list)
| search a metadata index by box-type

## Macro Definition Documentation

## FCGI_stderr

#define FCGI_stderr stderr

## FCGI_stdout

#define FCGI_stdout stdout

## logstream

#define logstream stderr

## Function Documentation

## const_metadatalist()

metadatalist_param_t * const_metadatalist | ( | int | fd | ) |

construct metadata-bin list of JP2 file

Parameters

  [in] | fd | file descriptor

Returns
  pointer to the generated metadata-bin list

References delete_box_in_list(), FCGI_stderr, box_param::fd, boxlist_param::first, gene_boxcontents(), gene_metadata(), gene_metadatalist(), gene_placeholder(), gene_placeholderlist(), get_boxstructure(), get_DBoxlen(), get_DBoxoff(), get_filesize(), insert_metadata_into_list(), insert_placeholder_into_list(), box_param::next, and box_param::type.

Referenced by parse_jp2file().

## delete_metadata()

void delete_metadata | ( | metadata_param_t ** | metadata | ) |

delete a metadata bin

Parameters

  [in,out] | metadata | address of the deleting metadata bin pointer

References delete_boxlist(), and delete_placeholderlist().

Referenced by delete_metadatalist().

## delete_metadatalist()

void delete_metadatalist | ( | metadatalist_param_t ** | list | ) |

delete metadata list

Parameters

  [in,out] | list | address of the metadata list pointer

References delete_metadata(), and metadata_param::next.

Referenced by delete_cache(), delete_index(), destroy_jpipdecoder(), and handle_JPIPstreamMSG().

## gene_boxcontents()

boxcontents_param_t * gene_boxcontents | ( | OPJ_OFF_T | offset,
|  | OPJ_SIZE_T | length
| ) |  |

generate box contents

Returns
  pointer to the box contents

References boxcontents_param::length, and boxcontents_param::offset.

Referenced by const_metadatalist(), and parse_metadata().

## gene_metadata()

metadata_param_t * gene_metadata | ( | Byte8_t | idx,
|  | boxlist_param_t * | boxlist,
|  | placeholderlist_param_t * | phldlist,
|  | boxcontents_param_t * | boxcontents
| ) |  |

generate a metadata bin

Parameters

  [in] | idx | metadata-bin index
  [in] | boxlist | box list pointer
  [in] | phldlist | placeholder list pointer
  [in] | boxcontents | boxcontents pointer

Returns
  pointer to the generated metadata bin

References metadata_param::boxcontents, metadata_param::boxlist, metadata_param::idx, metadata_param::next, and metadata_param::placeholderlist.

Referenced by const_metadatalist(), and parse_metamsg().

## gene_metadatalist()

metadatalist_param_t * gene_metadatalist | ( | void |  | ) |

generate a metadata list

Returns
  pointer to the generated metadata list

References metadatalist_param::first, and metadatalist_param::last.

Referenced by const_metadatalist(), gene_cache(), handle_JPIPstreamMSG(), and init_jpipdecoder().

## insert_metadata_into_list()

void insert_metadata_into_list | ( | metadata_param_t * | metabin,
|  | metadatalist_param_t * | metadatalist
| ) |  |

insert a metadata-bin into list

Parameters

  [in] | metabin | metadata-bin pointer
  [in] | metadatalist | metadata list pointer

References metadatalist_param::first, metadatalist_param::last, and metadata_param::next.

Referenced by const_metadatalist(), and parse_metamsg().

## print_allmetadata()

void print_allmetadata | ( | metadatalist_param_t * | list | ) |

print all metadata parameters

Parameters

  [in] | list | metadata list pointer

References metadatalist_param::first, logstream, metadata_param::next, and print_metadata().

Referenced by output_log(), and print_index().

## print_metadata()

void print_metadata | ( | metadata_param_t * | metadata | ) |

print metadata-bin parameters

Parameters

  [in] | metadata | metadata-bin pointer

References metadata_param::boxcontents, metadata_param::boxlist, metadata_param::idx, boxcontents_param::length, logstream, boxcontents_param::offset, metadata_param::placeholderlist, print_allbox(), and print_allplaceholder().

Referenced by print_allmetadata().

## search_metadata()

metadata_param_t * search_metadata | ( | Byte8_t | idx,
|  | metadatalist_param_t * | list
| ) |  |

search a metadata bin by index

Parameters

  [in] | idx | index
  [in] | list | metadata-bin list pointer

Returns
  found metadata-bin pointer

References metadatalist_param::first, metadata_param::idx, and metadata_param::next.

Referenced by enqueue_metadata().

## search_metadataidx()

Byte8_t search_metadataidx | ( | char | boxtype[4],
|  | metadatalist_param_t * | list
| ) |  |

search a metadata index by box-type

Parameters

  [in] | boxtype | box-type
  [in] | list | metadata-bin list pointer

Returns
  found metadata-bin index, if not found, -1

References metadata_param::boxlist, boxlist_param::first, metadatalist_param::first, placeholderlist_param::first, metadata_param::idx, box_param::next, metadata_param::next, placeholder_param::next, placeholder_param::OrigBH, placeholder_param::OrigID, metadata_param::placeholderlist, and box_param::type.

Referenced by enqueue_metabins().