1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
/*
* $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.
*/
/*SERVER*/
/*
*==========================================================
* JPIP server API
*==========================================================
*/
/** Server static records*/
typedef struct server_record server_record_t;
/** Query/response data for each client*/
typedef struct QR QR_t;
/**
* Initialize the JPIP server
*
* @param[in] tcp_auxport opening tcp auxiliary port ( 0 not to open, valid No. 49152-65535)
* @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 49152-65535)
* @return initialized server record pointer
*/
server_record_t * ;
/**
* Terminate the JPIP server
*
* @param[in] rec address of deleting server static record pointer
*/
void ;
/**
* 1st process per client request; parse query string
*
* @param[in] query_string request query string
* @return initialized query/response data pointer
*/
QR_t * ;
/**
* 2nd process; process JPIP request and construct message queue
*
* @param[in] rec server static record pointer
* @param[in] qr query/response data pointer
* @return true if succeed, otherwise false
*/
OPJ_BOOL ;
/**
* 3rd process; send response data JPT/JPP-stream
*
* @param[in] rec server static record pointer
* @param[in] qr query/response data pointer
*/
void ;
/**
* 4th (last) process;
*
* @param[in] rec server static record pinter
* @param[in] qr address of query/response data pointer
*/
void ;
/**
* Option for local tests; print out parameter values to logstream (stderr)
*
* @param[in] query true if query parameters are to be printed out
* @param[in] messages true if queue of messages is to be printed out
* @param[in] sessions true if session list is to be printed out
* @param[in] targets true if target list is to be printed out
* @param[in] qr query/response data pointer
* @param[in] rec server static record pinter
*/
void ;
/*SERVER*/
/*
*==========================================================
* JPIP decoding server API
*==========================================================
*/
/** Decoding server static records*/
typedef struct dec_server_record dec_server_record_t;
/** Client socket identifier*/
typedef SOCKET client_t;
/**
* Initialize the image decoding server
*
* @param[in] port opening tcp port (valid No. 49152-65535)
* @return initialized decoding server record pointer
*/
OPJ_API dec_server_record_t * OPJ_CALLCONV ;
/**
* Terminate the image decoding server
*
* @param[in] rec address of deleting decoding server static record pointer
*/
OPJ_API void OPJ_CALLCONV ;
/**
* Accept client connection
*
* @param[in] rec decoding server static record pointer
* @return client socket ID, -1 if failed
*/
OPJ_API client_t OPJ_CALLCONV ;
/**
* Handle client request
*
* @param[in] client client socket ID
* @param[in] rec decoding server static record pointer
* @return true if succeed
*/
OPJ_API OPJ_BOOL OPJ_CALLCONV ;
/*SERVER*/
/*
*==========================================================
* JPIP tool API
*==========================================================
*/
/*
* jpip to JP2 or J2K
*/
/** JPIP decoding parameters*/
typedef struct jpip_dec_param jpip_dec_param_t;
/**
* Initialize jpip decoder
*
* @param[in] jp2 true in case of jp2 file encoding, else j2k file encoding
* @return JPIP decoding parameters pointer
*/
OPJ_API jpip_dec_param_t * OPJ_CALLCONV ;
/**
* Destroy jpip decoding parameters
*
* @param[in] dec address of JPIP decoding parameters pointer
*/
OPJ_API void OPJ_CALLCONV ;
/**
* Read jpip codestream from a file
*
* @param[in] fname file name
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
OPJ_API OPJ_BOOL OPJ_CALLCONV ;
/**
* Decode jpip codestream
*
* @param[in] dec JPIP decoding parameters pointer
*/
OPJ_API void OPJ_CALLCONV ;
/**
* Write J2K/JP2 codestream to a file
*
* @param[in] fname file name
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
OPJ_API OPJ_BOOL OPJ_CALLCONV ;
/**
* Option; print out parameter values to stderr
*
* @param[in] messages true if queue of messages is to be printed out
* @param[in] metadata true if metadata is to be printed out
* @param[in] ihdrbox true if image header data is to be printed out
* @param[in] dec JPIP decoding parameters pointer
*/
OPJ_API void OPJ_CALLCONV ;
/*
* test the format of index (cidx) box in JP2 file
*/
/** Redefinition of index parameters*/
typedef index_param_t index_t;
/**
* Parse JP2 file and get index information from cidx box inside
*
* @param[in] fd file descriptor of the JP2 file
* @return pointer to the generated structure of index parameters
*/
OPJ_API index_t * OPJ_CALLCONV ;
/**
* Destroy index parameters
*
* @param[in,out] idx addressof the index pointer
*/
OPJ_API void OPJ_CALLCONV ;
/**
* print index parameters
*
* @param[in] index index parameters
*/
OPJ_API void OPJ_CALLCONV ;
/*SERVER*/
/* !OPENJPIP_H_ */