2011-04-14 20:37:47 +02:00
|
|
|
/*
|
2012-10-01 10:43:02 +02:00
|
|
|
* $Id$
|
2011-04-14 20:37:47 +02:00
|
|
|
*
|
2014-04-03 17:30:57 +02:00
|
|
|
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
|
|
|
* Copyright (c) 2002-2014, Professor Benoit Macq
|
2011-04-14 20:37:47 +02:00
|
|
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2017-05-15 12:21:30 +02:00
|
|
|
#ifndef TARGET_MANAGER_H_
|
|
|
|
# define TARGET_MANAGER_H_
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
#include "index_manager.h"
|
|
|
|
|
2012-03-02 12:09:16 +01:00
|
|
|
/** maximum length of target identifier*/
|
2011-08-24 19:07:28 +02:00
|
|
|
#define MAX_LENOFTID 30
|
|
|
|
|
2012-03-02 12:09:16 +01:00
|
|
|
/** target parameters*/
|
2017-05-15 12:21:30 +02:00
|
|
|
typedef struct target_param {
|
|
|
|
char tid[MAX_LENOFTID]; /**< target identifier*/
|
2017-07-26 21:06:38 +02:00
|
|
|
char *targetname; /**< local file path or URL ( URL is supported only with SERVER mode)*/
|
2017-05-15 12:21:30 +02:00
|
|
|
int fd; /**< file descriptor*/
|
2012-03-02 11:46:04 +01:00
|
|
|
#ifdef SERVER
|
2017-05-15 12:21:30 +02:00
|
|
|
char *tmpfname; /**< temporal file name to download a remote target file*/
|
2012-03-02 11:46:04 +01:00
|
|
|
#endif
|
2017-05-15 12:21:30 +02:00
|
|
|
int csn; /**< codestream number */
|
|
|
|
index_param_t
|
|
|
|
*codeidx; /**< index information of codestream */
|
|
|
|
int num_of_use; /**< numbers of sessions referring to this target */
|
|
|
|
OPJ_BOOL jppstream; /**< if this target can return JPP-stream */
|
|
|
|
OPJ_BOOL jptstream; /**< if this target can return JPP-stream */
|
|
|
|
struct target_param
|
|
|
|
*next; /**< pointer to the next target */
|
2011-04-14 20:37:47 +02:00
|
|
|
} target_param_t;
|
|
|
|
|
|
|
|
|
2012-03-02 12:09:16 +01:00
|
|
|
/** Target list parameters*/
|
2017-05-15 12:21:30 +02:00
|
|
|
typedef struct targetlist_param {
|
|
|
|
target_param_t *first; /**< first target pointer of the list*/
|
|
|
|
target_param_t *last; /**< last target pointer of the list*/
|
2011-04-14 20:37:47 +02:00
|
|
|
} targetlist_param_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* generate a target list
|
|
|
|
*
|
|
|
|
* @return pointer to the generated target list
|
|
|
|
*/
|
2012-03-02 12:09:16 +01:00
|
|
|
targetlist_param_t * gene_targetlist(void);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* generate a target
|
|
|
|
*
|
2011-08-24 13:00:15 +02:00
|
|
|
* @param[in] targetlist target list to insert the generated target
|
2011-11-03 18:20:00 +01:00
|
|
|
* @param[in] targetpath file path or URL of the target
|
2011-04-14 20:37:47 +02:00
|
|
|
* @return pointer to the generated target
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
target_param_t * gene_target(targetlist_param_t *targetlist, char *targetpath);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
|
2011-08-24 13:00:15 +02:00
|
|
|
/**
|
|
|
|
* refer a target, used to make a new cache model
|
|
|
|
*
|
|
|
|
* @param[in] reftarget reference target pointer
|
|
|
|
* @param[out] ptr address of feeding target pointer
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void refer_target(target_param_t *reftarget, target_param_t **ptr);
|
2011-08-24 13:00:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* refer a target, used to make a new cache model
|
|
|
|
*
|
|
|
|
* @param[in] target reference pointer to the target
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void unrefer_target(target_param_t *target);
|
2011-08-24 13:00:15 +02:00
|
|
|
|
2011-04-14 20:37:47 +02:00
|
|
|
/**
|
|
|
|
* delete a target
|
|
|
|
*
|
|
|
|
* @param[in,out] target address of the deleting target pointer
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void delete_target(target_param_t **target);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* delete a target in list
|
|
|
|
*
|
|
|
|
* @param[in,out] target address of the deleting target pointer
|
|
|
|
* @param[in] targetlist target list pointer
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void delete_target_in_list(target_param_t **target,
|
|
|
|
targetlist_param_t *targetlist);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* delete target list
|
|
|
|
*
|
|
|
|
* @param[in,out] targetlist address of the target list pointer
|
|
|
|
*/
|
|
|
|
void delete_targetlist(targetlist_param_t **targetlist);
|
|
|
|
|
2011-08-24 13:00:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* print target parameters
|
|
|
|
*
|
|
|
|
* @param[in] target target pointer
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void print_target(target_param_t *target);
|
2011-08-24 13:00:15 +02:00
|
|
|
|
2011-04-14 20:37:47 +02:00
|
|
|
/**
|
|
|
|
* print all target parameters
|
|
|
|
*
|
|
|
|
* @param[in] targetlist target list pointer
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void print_alltarget(targetlist_param_t *targetlist);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2012-03-02 11:58:43 +01:00
|
|
|
* search a target by target name
|
2011-04-14 20:37:47 +02:00
|
|
|
*
|
2012-03-02 11:58:43 +01:00
|
|
|
* @param[in] targetname target name
|
2011-04-14 20:37:47 +02:00
|
|
|
* @param[in] targetlist target list pointer
|
|
|
|
* @return found target pointer
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
target_param_t * search_target(const char targetname[],
|
|
|
|
targetlist_param_t *targetlist);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
2011-08-24 19:07:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* search a target by tid
|
|
|
|
*
|
|
|
|
* @param[in] tid target identifier
|
|
|
|
* @param[in] targetlist target list pointer
|
|
|
|
* @return found target pointer
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
target_param_t * search_targetBytid(const char tid[],
|
|
|
|
targetlist_param_t *targetlist);
|
2011-08-24 19:07:28 +02:00
|
|
|
|
2017-05-15 12:21:30 +02:00
|
|
|
#endif /* !TARGET_MANAGER_H_ */
|
2011-04-14 20:37:47 +02:00
|
|
|
|