00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef OPENJPIP_H_
00032 # define OPENJPIP_H_
00033
00034 #include "session_manager.h"
00035 #include "target_manager.h"
00036 #include "query_parser.h"
00037 #include "msgqueue_manager.h"
00038 #include "sock_manager.h"
00039 #include "auxtrans_manager.h"
00040
00041 #ifdef SERVER
00042
00043 #include "fcgi_stdio.h"
00044 #define logstream FCGI_stdout
00045
00046 #else
00047
00048 #define FCGI_stdout stdout
00049 #define FCGI_stderr stderr
00050 #define logstream stderr
00051
00052 #include "cache_manager.h"
00053 #include "byte_manager.h"
00054 #include "imgsock_manager.h"
00055
00056 #include "metadata_manager.h"
00057 #include "ihdrbox_manager.h"
00058 #include "index_manager.h"
00059
00060 #endif
00061
00062
00063
00064
00065
00066
00067
00068 #ifdef SERVER
00069
00071 typedef struct server_record {
00072 sessionlist_param_t *sessionlist;
00073 targetlist_param_t *targetlist;
00074 auxtrans_param_t auxtrans;
00075 } server_record_t;
00076
00078 typedef struct QR {
00079 query_param_t *query;
00080 msgqueue_param_t *msgqueue;
00081 channel_param_t *channel;
00082 } QR_t;
00083
00091 server_record_t * init_JPIPserver(int tcp_auxport, int udp_auxport);
00092
00098 void terminate_JPIPserver(server_record_t **rec);
00099
00106 QR_t * parse_querystring(const char *query_string);
00107
00115 OPJ_BOOL process_JPIPrequest(server_record_t *rec, QR_t *qr);
00116
00123 void send_responsedata(server_record_t *rec, QR_t *qr);
00124
00131 void end_QRprocess(server_record_t *rec, QR_t **qr);
00132
00143 void local_log(OPJ_BOOL query, OPJ_BOOL messages, OPJ_BOOL sessions,
00144 OPJ_BOOL targets, QR_t *qr, server_record_t *rec);
00145
00146 #endif
00147
00148
00149
00150
00151
00152
00153
00154 #ifndef SERVER
00155
00157 typedef struct dec_server_record {
00158 cachelist_param_t *cachelist;
00159 Byte_t *jpipstream;
00160 OPJ_SIZE_T jpipstreamlen;
00161 msgqueue_param_t *msgqueue;
00162 SOCKET listening_socket;
00163 } dec_server_record_t;
00164
00165
00167 typedef SOCKET client_t;
00168
00175 OPJ_API dec_server_record_t * OPJ_CALLCONV init_dec_server(int port);
00176
00182 OPJ_API void OPJ_CALLCONV terminate_dec_server(dec_server_record_t **rec);
00183
00190 OPJ_API client_t OPJ_CALLCONV accept_connection(dec_server_record_t *rec);
00191
00199 OPJ_API OPJ_BOOL OPJ_CALLCONV handle_clientreq(client_t client,
00200 dec_server_record_t *rec);
00201
00202 #endif
00203
00204
00205
00206
00207
00208
00209
00210 #ifndef SERVER
00211
00212
00213
00214
00215
00217 typedef struct jpip_dec_param {
00218 Byte_t *jpipstream;
00219 Byte8_t jpiplen;
00220 msgqueue_param_t *msgqueue;
00221 metadatalist_param_t *metadatalist;
00222 ihdrbox_param_t *ihdrbox;
00223 Byte_t *jp2kstream;
00224 Byte8_t jp2klen;
00225 } jpip_dec_param_t;
00226
00233 OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder(OPJ_BOOL jp2);
00234
00240 OPJ_API void OPJ_CALLCONV destroy_jpipdecoder(jpip_dec_param_t **dec);
00241
00249 OPJ_API OPJ_BOOL OPJ_CALLCONV fread_jpip(const char fname[],
00250 jpip_dec_param_t *dec);
00251
00257 OPJ_API void OPJ_CALLCONV decode_jpip(jpip_dec_param_t *dec);
00258
00266 OPJ_API OPJ_BOOL OPJ_CALLCONV fwrite_jp2k(const char fname[],
00267 jpip_dec_param_t *dec);
00268
00277 OPJ_API void OPJ_CALLCONV output_log(OPJ_BOOL messages, OPJ_BOOL metadata,
00278 OPJ_BOOL ihdrbox, jpip_dec_param_t *dec);
00279
00280
00281
00282
00283
00285 typedef index_param_t index_t;
00286
00293 OPJ_API index_t * OPJ_CALLCONV get_index_from_JP2file(int fd);
00294
00300 OPJ_API void OPJ_CALLCONV destroy_index(index_t **idx);
00301
00302
00308 OPJ_API void OPJ_CALLCONV output_index(index_t *index);
00309
00310 #endif
00311
00312 #endif