openjpip.h
Go to the documentation of this file.
/*
* $Id$
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* 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.
*/
#ifndef OPENJPIP_H_
# define OPENJPIP_H_
#include "session_manager.h"
#include "target_manager.h"
#include "query_parser.h"
#include "msgqueue_manager.h"
#include "sock_manager.h"
#include "auxtrans_manager.h"
#ifdef SERVER
#include "fcgi_stdio.h"
#define logstream FCGI_stdout
#else
#define FCGI_stdout stdout
#define FCGI_stderr stderr
#define logstream stderr
#include "cache_manager.h"
#include "byte_manager.h"
#include "imgsock_manager.h"
#include "metadata_manager.h"
#include "ihdrbox_manager.h"
#include "index_manager.h"
#endif /*SERVER*/
/*
*==========================================================
* JPIP server API
*==========================================================
*/
#ifdef SERVER
typedef struct server_record {
sessionlist_param_t *sessionlist;
targetlist_param_t *targetlist;
auxtrans_param_t auxtrans;
} server_record_t;
typedef struct QR {
query_param_t *query;
msgqueue_param_t *msgqueue;
channel_param_t *channel;
} QR_t;
server_record_t * init_JPIPserver(int tcp_auxport, int udp_auxport);
void terminate_JPIPserver(server_record_t **rec);
QR_t * parse_querystring(const char *query_string);
OPJ_BOOL process_JPIPrequest(server_record_t *rec, QR_t *qr);
void send_responsedata(server_record_t *rec, QR_t *qr);
void end_QRprocess(server_record_t *rec, QR_t **qr);
void local_log(OPJ_BOOL query, OPJ_BOOL messages, OPJ_BOOL sessions,
OPJ_BOOL targets, QR_t *qr, server_record_t *rec);
#endif /*SERVER*/
/*
*==========================================================
* JPIP decoding server API
*==========================================================
*/
#ifndef SERVER
typedef struct dec_server_record {
cachelist_param_t *cachelist;
Byte_t *jpipstream;
OPJ_SIZE_T jpipstreamlen;
msgqueue_param_t *msgqueue;
SOCKET listening_socket;
} dec_server_record_t;
typedef SOCKET client_t;
OPJ_API dec_server_record_t * OPJ_CALLCONV init_dec_server(int port);
OPJ_API void OPJ_CALLCONV terminate_dec_server(dec_server_record_t **rec);
OPJ_API client_t OPJ_CALLCONV accept_connection(dec_server_record_t *rec);
OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq(client_t client,
dec_server_record_t *rec);
#endif /*SERVER*/
/*
*==========================================================
* JPIP tool API
*==========================================================
*/
#ifndef SERVER
/*
* jpip to JP2 or J2K
*/
typedef struct jpip_dec_param {
Byte_t *jpipstream;
Byte8_t jpiplen;
msgqueue_param_t *msgqueue;
metadatalist_param_t *metadatalist;
ihdrbox_param_t *ihdrbox;
Byte_t *jp2kstream;
Byte8_t jp2klen;
} jpip_dec_param_t;
OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder(OPJ_BOOL jp2);
OPJ_API void OPJ_CALLCONV destroy_jpipdecoder(jpip_dec_param_t **dec);
OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip(const char fname[],
jpip_dec_param_t *dec);
OPJ_API void OPJ_CALLCONV decode_jpip(jpip_dec_param_t *dec);
OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k(const char fname[],
jpip_dec_param_t *dec);
OPJ_API void OPJ_CALLCONV output_log(OPJ_BOOL messages, OPJ_BOOL metadata,
OPJ_BOOL ihdrbox, jpip_dec_param_t *dec);
/*
* test the format of index (cidx) box in JP2 file
*/
typedef index_param_t index_t;
OPJ_API index_t * OPJ_CALLCONV get_index_from_JP2file(int fd);
OPJ_API void OPJ_CALLCONV destroy_index(index_t **idx);
OPJ_API void OPJ_CALLCONV output_index(index_t *index);
#endif /*SERVER*/
#endif /* !OPENJPIP_H_ */
auxtrans_manager.h
auxtrans_param_t
struct auxtrans_param auxtrans_param_t
auxiliary transport setting parameters
byte_manager.h
Byte8_t
uint64_t Byte8_t
Definition byte_manager.h:40
Byte_t
uint8_t Byte_t
Definition byte_manager.h:37
cache_manager.h
cachelist_param_t
struct cachelist_param cachelist_param_t
channel_param_t
struct channel_param channel_param_t
Channel parameters.
ihdrbox_manager.h
ihdrbox_param_t
struct ihdrbox_param ihdrbox_param_t
I.5.3.1 Image Header box.
imgsock_manager.h
index_manager.h
index_param_t
struct index_param index_param_t
index parameters
metadata_manager.h
metadatalist_param_t
struct metadatalist_param metadatalist_param_t
metadata-bin list parameters
msgqueue_manager.h
msgqueue_param_t
struct msgqueue_param msgqueue_param_t
message queue parameters
OPJ_API
#define OPJ_API
Definition openjpeg.h:95
OPJ_SIZE_T
size_t OPJ_SIZE_T
Definition openjpeg.h:139
OPJ_BOOL
int OPJ_BOOL
Definition openjpeg.h:116
OPJ_CALLCONV
#define OPJ_CALLCONV
Definition openjpeg.h:98
terminate_dec_server
OPJ_API void OPJ_CALLCONV terminate_dec_server(dec_server_record_t **rec)
Terminate the image decoding server.
Definition openjpip.c:244
get_index_from_JP2file
OPJ_API index_t *OPJ_CALLCONV get_index_from_JP2file(int fd)
Parse JP2 file and get index information from cidx box inside.
Definition openjpip.c:448
init_jpipdecoder
OPJ_API jpip_dec_param_t *OPJ_CALLCONV init_jpipdecoder(OPJ_BOOL jp2)
Initialize jpip decoder.
Definition openjpip.c:334
output_index
OPJ_API void OPJ_CALLCONV output_index(index_t *index)
print index parameters
Definition openjpip.c:481
output_log
OPJ_API void OPJ_CALLCONV output_log(OPJ_BOOL messages, OPJ_BOOL metadata, OPJ_BOOL ihdrbox, jpip_dec_param_t *dec)
Option; print out parameter values to stderr.
Definition openjpip.c:418
handle_clientreq
OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq(client_t client, dec_server_record_t *rec)
Handle client request.
Definition openjpip.c:272
jpip_dec_param_t
struct jpip_dec_param jpip_dec_param_t
JPIP decoding parameters.
fwrite_jp2k
OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k(const char fname[], jpip_dec_param_t *dec)
Write J2K/JP2 codestream to a file.
Definition openjpip.c:396
destroy_index
OPJ_API void OPJ_CALLCONV destroy_index(index_t **idx)
Destroy index parameters.
Definition openjpip.c:476
client_t
SOCKET client_t
Client socket identifier.
Definition openjpip.h:167
dec_server_record_t
struct dec_server_record dec_server_record_t
Decoding server static records.
destroy_jpipdecoder
OPJ_API void OPJ_CALLCONV destroy_jpipdecoder(jpip_dec_param_t **dec)
Destroy jpip decoding parameters.
Definition openjpip.c:435
index_t
index_param_t index_t
Redefinition of index parameters.
Definition openjpip.h:285
decode_jpip
OPJ_API void OPJ_CALLCONV decode_jpip(jpip_dec_param_t *dec)
Decode jpip codestream.
Definition openjpip.c:378
init_dec_server
OPJ_API dec_server_record_t *OPJ_CALLCONV init_dec_server(int port)
Initialize the image decoding server.
Definition openjpip.c:230
accept_connection
OPJ_API client_t OPJ_CALLCONV accept_connection(dec_server_record_t *rec)
Accept client connection.
Definition openjpip.c:260
fread_jpip
OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip(const char fname[], jpip_dec_param_t *dec)
Read jpip codestream from a file.
Definition openjpip.c:350
query_parser.h
query_param_t
struct query_param query_param_t
Query parameters.
session_manager.h
sessionlist_param_t
struct sessionlist_param sessionlist_param_t
Session list parameters.
sock_manager.h
SOCKET
int SOCKET
Definition sock_manager.h:40
dec_server_record
Decoding server static records.
Definition openjpip.h:157
dec_server_record::listening_socket
SOCKET listening_socket
listening socket
Definition openjpip.h:162
dec_server_record::msgqueue
msgqueue_param_t * msgqueue
parsed message queue of jpipstream
Definition openjpip.h:161
dec_server_record::jpipstreamlen
OPJ_SIZE_T jpipstreamlen
length of jpipstream
Definition openjpip.h:160
dec_server_record::jpipstream
Byte_t * jpipstream
JPT/JPP stream.
Definition openjpip.h:159
dec_server_record::cachelist
cachelist_param_t * cachelist
cache list
Definition openjpip.h:158
jpip_dec_param
JPIP decoding parameters.
Definition openjpip.h:217
jpip_dec_param::jpipstream
Byte_t * jpipstream
JPT/JPP-stream.
Definition openjpip.h:218
jpip_dec_param::metadatalist
metadatalist_param_t * metadatalist
metadata list going into JP2 file
Definition openjpip.h:221
jpip_dec_param::jp2kstream
Byte_t * jp2kstream
J2K codestream or JP2 file codestream.
Definition openjpip.h:223
jpip_dec_param::jp2klen
Byte8_t jp2klen
length of j2kstream or JP2 file
Definition openjpip.h:224
jpip_dec_param::ihdrbox
ihdrbox_param_t * ihdrbox
ihdr box going into JP2 file
Definition openjpip.h:222
jpip_dec_param::jpiplen
Byte8_t jpiplen
length of jpipstream
Definition openjpip.h:219
jpip_dec_param::msgqueue
msgqueue_param_t * msgqueue
message queue
Definition openjpip.h:220
target_manager.h
targetlist_param_t
struct targetlist_param targetlist_param_t
Target list parameters.