jpip_parser.c File Reference
`#include <stdio.h>`
`#include <string.h>`
`#include <math.h>`
`#include "jpip_parser.h"`
`#include "channel_manager.h"`
`#include "imgreg_manager.h"`

## Macros

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

## Functions

OPJ_BOOL | identify_target (query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target)
| REQUEST: target identification by target or tid request.
OPJ_BOOL | associate_channel (query_param_t query_param, sessionlist_param_t *sessionlist, session_param_t **cursession, channel_param_t **curchannel)
| REQUEST: channel association this must be processed before any process.
OPJ_BOOL | open_channel (query_param_t query_param, sessionlist_param_t *sessionlist, auxtrans_param_t auxtrans, target_param_t *target, session_param_t **cursession, channel_param_t **curchannel)
| REQUEST: new channel (cnew) assignment.
OPJ_BOOL | close_channel (query_param_t query_param, sessionlist_param_t *sessionlist, session_param_t **cursession, channel_param_t **curchannel)
| REQUEST: channel close (cclose)
void | enqueue_imagedata (query_param_t query_param, msgqueue_param_t *msgqueue)
| enqueue tiles or precincts into the message queue
OPJ_BOOL | enqueue_metabins (query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
| enqueue metadata bins into the message queue
OPJ_BOOL | gene_JPIPstream (query_param_t query_param, target_param_t *target, session_param_t *cursession, channel_param_t *curchannel, msgqueue_param_t **msgqueue)
| REQUEST: view-window (fsiz)
void | enqueue_precincts (int xmin, int xmax, int ymin, int ymax, int tile_id, int level, int lastcomp, OPJ_BOOL *comps, int layers, msgqueue_param_t *msgqueue)
| enqueue precinct data-bins into the queue
void | enqueue_allprecincts (int tile_id, int level, int lastcomp, OPJ_BOOL *comps, int layers, msgqueue_param_t *msgqueue)
| enqueue all precincts inside a tile into the queue

## Macro Definition Documentation

## FCGI_stderr

#define FCGI_stderr stderr

## FCGI_stdout

#define FCGI_stdout stdout

## logstream

#define logstream stderr

## Function Documentation

## associate_channel()

OPJ_BOOL associate_channel | ( | query_param_t | query_param,
|  | sessionlist_param_t * | sessionlist,
|  | session_param_t ** | cursession,
|  | channel_param_t ** | curchannel
| ) |  |

REQUEST: channel association this must be processed before any process.

Parameters

  [in] | query_param | structured query
  [in] | sessionlist | session list pointer
  [out] | cursession | address of the associated session pointer
  [out] | curchannel | address of the associated channel pointer

Returns
  if succeeded (true) or failed (false)

References query_param::cid, query_param::cnew, FCGI_stderr, OPJ_FALSE, OPJ_TRUE, search_session_and_channel(), and set_channel_variable_param().

## close_channel()

OPJ_BOOL close_channel | ( | query_param_t | query_param,
|  | sessionlist_param_t * | sessionlist,
|  | session_param_t ** | cursession,
|  | channel_param_t ** | curchannel
| ) |  |

REQUEST: channel close (cclose)

Parameters

  [in] | query_param | structured query
  [in] | sessionlist | session list pointer
  [in,out] | cursession | address of the session pointer of deleting channel
  [in,out] | curchannel | address of the deleting channel pointer

Returns
  if succeeded (true) or failed (false)

References query_param::cclose, delete_channel(), delete_session(), FCGI_stdout, logstream, query_param::numOfcclose, OPJ_FALSE, OPJ_TRUE, search_channel(), and search_session_and_channel().

## enqueue_allprecincts()

void enqueue_allprecincts | ( | int | tile_id,
|  | int | level,
|  | int | lastcomp,
|  | OPJ_BOOL * | comps,
|  | int | layers,
|  | msgqueue_param_t * | msgqueue
| ) |  |

enqueue all precincts inside a tile into the queue

Parameters

  [in] | tile_id | tile index
  [in] | level | decomposition level
  [in] | lastcomp | last component number
  [in] | comps | pointer to the array that stores the requested components
  [in] | layers | number of quality layers
  [in] | msgqueue | message queue

Returns

References msgqueue_param::cachemodel, index_param::COD, target_param::codeidx, SIZmarker_param::Csiz, enqueue_precinct(), get_tile_XSiz(), get_tile_YSiz(), CODmarker_param::numOfdecomp, CODmarker_param::Scod, index_param::SIZ, cachemodel_param::target, CODmarker_param::XPsiz, and CODmarker_param::YPsiz.

Referenced by enqueue_imagedata().

## enqueue_imagedata()

void enqueue_imagedata | ( | query_param_t | query_param,
|  | msgqueue_param_t * | msgqueue
| ) |  |

enqueue tiles or precincts into the message queue

Parameters

  [in] | query_param | structured query
  [in] | msgqueue | message queue pointer

References msgqueue_param::cachemodel, index_param::COD, target_param::codeidx, query_param::comps, enqueue_allprecincts(), enqueue_precincts(), enqueue_tile(), enqueue_tileheader(), query_param::fx, query_param::fy, get_nmax(), get_tile_Xrange(), get_tile_Yrange(), cachemodel_param::jppstream, query_param::lastcomp, query_param::layers, query_param::len, imgreg_param::level, map_viewin2imgreg(), range_param::maxvalue, range_param::minvalue, CODmarker_param::numOfdecomp, imgreg_param::ox, imgreg_param::oy, query_param::rh, query_param::rw, query_param::rx, query_param::ry, index_param::SIZ, imgreg_param::sx, imgreg_param::sy, cachemodel_param::target, index_param::tilepart, imgreg_param::xosiz, SIZmarker_param::XOsiz, SIZmarker_param::Xsiz, SIZmarker_param::XTnum, imgreg_param::yosiz, SIZmarker_param::YOsiz, SIZmarker_param::Ysiz, and SIZmarker_param::YTnum.

Referenced by gene_JPIPstream().

## enqueue_metabins()

OPJ_BOOL enqueue_metabins | ( | query_param_t | query_param,
|  | metadatalist_param_t * | metadatalist,
|  | msgqueue_param_t * | msgqueue
| ) |  |

enqueue metadata bins into the message queue

Parameters

  [in] | query_param | structured query
  [in] | metadatalist | pointer to metadata bin list
  [in,out] | msgqueue | message queue pointer

Returns
  if succeeded (true) or failed (false)

References query_param::box_type, enqueue_metadata(), FCGI_stdout, MAX_NUMOFBOX, OPJ_FALSE, OPJ_TRUE, and search_metadataidx().

Referenced by gene_JPIPstream().

## enqueue_precincts()

void enqueue_precincts | ( | int | xmin,
|  | int | xmax,
|  | int | ymin,
|  | int | ymax,
|  | int | tile_id,
|  | int | level,
|  | int | lastcomp,
|  | OPJ_BOOL * | comps,
|  | int | layers,
|  | msgqueue_param_t * | msgqueue
| ) |  |

enqueue precinct data-bins into the queue

Parameters

  [in] | xmin | min x coordinate in the tile at the decomposition level
  [in] | xmax | max x coordinate in the tile at the decomposition level
  [in] | ymin | min y coordinate in the tile at the decomposition level
  [in] | ymax | max y coordinate in the tile at the decomposition level
  [in] | tile_id | tile index
  [in] | level | decomposition level
  [in] | lastcomp | last component number
  [in] | comps | pointer to the array that stores the requested components
  [in] | layers | number of quality layers
  [in] | msgqueue | message queue

Returns

References msgqueue_param::cachemodel, index_param::COD, target_param::codeidx, SIZmarker_param::Csiz, enqueue_precinct(), get_tile_XSiz(), get_tile_YSiz(), CODmarker_param::numOfdecomp, CODmarker_param::Scod, index_param::SIZ, cachemodel_param::target, CODmarker_param::XPsiz, and CODmarker_param::YPsiz.

Referenced by enqueue_imagedata().

## gene_JPIPstream()

OPJ_BOOL gene_JPIPstream | ( | query_param_t | query_param,
|  | target_param_t * | target,
|  | session_param_t * | cursession,
|  | channel_param_t * | curchannel,
|  | msgqueue_param_t ** | msgqueue
| ) |  |

REQUEST: view-window (fsiz)

Parameters

  [in] | query_param | structured query
  [in] | target | requested target pointer
  [in,out] | cursession | associated session pointer
  [in,out] | curchannel | associated channel pointer
  [out] | msgqueue | address of the message queue pointer

Returns
  if succeeded (true) or failed (false)

References query_param::box_type, channel_param::cachemodel, index_param::COD, target_param::codeidx, enqueue_imagedata(), enqueue_mainheader(), enqueue_metabins(), FCGI_stdout, query_param::fx, query_param::fy, gene_cachemodel(), gene_msgqueue(), cachemodel_param::jppstream, JPPstream, query_param::layers, query_param::len, query_param::metadata_only, index_param::metadatalist, cachemodel_param::mhead_model, CODmarker_param::numOflayers, OPJ_FALSE, OPJ_TRUE, query_param::return_type, and cachemodel_param::target.

## identify_target()

OPJ_BOOL identify_target | ( | query_param_t | query_param,
|  | targetlist_param_t * | targetlist,
|  | target_param_t ** | target
| ) |  |

REQUEST: target identification by target or tid request.

Parameters

  [in] | query_param | structured query
  [in] | targetlist | target list pointer
  [out] | target | address of target pointer

Returns
  if succeeded (true) or failed (false)

References query_param::cid, FCGI_stdout, gene_target(), OPJ_FALSE, OPJ_TRUE, search_target(), search_targetBytid(), query_param::target, and query_param::tid.

## open_channel()

OPJ_BOOL open_channel | ( | query_param_t | query_param,
|  | sessionlist_param_t * | sessionlist,
|  | auxtrans_param_t | auxtrans,
|  | target_param_t * | target,
|  | session_param_t ** | cursession,
|  | channel_param_t ** | curchannel
| ) |  |

REQUEST: new channel (cnew) assignment.

Parameters

  [in] | query_param | structured query
  [in] | sessionlist | session list pointer
  [in] | auxtrans | auxiliary transport
  [in] | target | requested target pointer
  [in,out] | cursession | address of the associated/opened session pointer
  [in,out] | curchannel | address of the associated/opened channel pointer

Returns
  if succeeded (true) or failed (false)

References gene_cachemodel(), gene_channel(), gene_session(), JPPstream, OPJ_FALSE, OPJ_TRUE, query_param::return_type, and search_cachemodel().