OpenJPEG  2.0.0
openjpip.h
Go to the documentation of this file.
1 /*
2  * $Id: openjpip.h 2209 2012-11-15 14:43:50Z savmickael $
3  *
4  * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
5  * Copyright (c) 2002-2011, Professor Benoit Macq
6  * Copyright (c) 2010-2011, Kaori Hagihara
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef OPENJPIP_H_
32 # define OPENJPIP_H_
33 
34 #include "session_manager.h"
35 #include "target_manager.h"
36 #include "query_parser.h"
37 #include "msgqueue_manager.h"
38 #include "sock_manager.h"
39 #include "auxtrans_manager.h"
40 
41 #ifdef SERVER
42 
43 #include "fcgi_stdio.h"
44 #define logstream FCGI_stdout
45 
46 #else
47 
48 #define FCGI_stdout stdout
49 #define FCGI_stderr stderr
50 #define logstream stderr
51 
52 #include "cache_manager.h"
53 #include "byte_manager.h"
54 #include "imgsock_manager.h"
55 
56 #include "metadata_manager.h"
57 #include "ihdrbox_manager.h"
58 #include "index_manager.h"
59 
60 #endif /*SERVER*/
61 
62 /*
63  *==========================================================
64  * JPIP server API
65  *==========================================================
66  */
67 
68  #ifdef SERVER
69 
71 typedef struct server_record{
72  sessionlist_param_t *sessionlist;
73  targetlist_param_t *targetlist;
74  auxtrans_param_t auxtrans;
75 } server_record_t;
76 
78 typedef struct QR{
79  query_param_t *query;
80  msgqueue_param_t *msgqueue;
81  channel_param_t *channel;
82 } QR_t;
83 
91 server_record_t * init_JPIPserver( int tcp_auxport, int udp_auxport);
92 
98 void terminate_JPIPserver( server_record_t **rec);
99 
106 QR_t * parse_querystring( const char *query_string);
107 
115 OPJ_BOOL process_JPIPrequest( server_record_t *rec, QR_t *qr);
116 
123 void send_responsedata( server_record_t *rec, QR_t *qr);
124 
131 void end_QRprocess( server_record_t *rec, QR_t **qr);
132 
143 void local_log( OPJ_BOOL query, OPJ_BOOL messages, OPJ_BOOL sessions, OPJ_BOOL targets, QR_t *qr, server_record_t *rec);
144 
145 #endif /*SERVER*/
146 
147 /*
148  *==========================================================
149  * JPIP decoding server API
150  *==========================================================
151  */
152 
153 #ifndef SERVER
154 
156 typedef struct dec_server_record{
163 
164 
166 typedef SOCKET client_t;
167 
175 
182 
190 
199 
200 #endif /*SERVER*/
201 
202 /*
203  *==========================================================
204  * JPIP tool API
205  *==========================================================
206  */
207 
208 #ifndef SERVER
209 
210 /*
211  * jpip to JP2 or J2K
212  */
213 
215 typedef struct jpip_dec_param{
224 
232 
239 
247 OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec);
248 
255 
263 OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
264 
273 OPJ_API void OPJ_CALLCONV output_log( OPJ_BOOL messages, OPJ_BOOL metadata, OPJ_BOOL ihdrbox, jpip_dec_param_t *dec);
274 
275 /*
276  * test the format of index (cidx) box in JP2 file
277  */
278 
281 
289 
296 
297 
304 
305 #endif /*SERVER*/
306 
307 #endif /* !OPENJPIP_H_ */