opj_dec_server enabled stateless requests

This commit is contained in:
Kaori Hagihara 2011-09-16 14:20:00 +00:00
parent 8097b07661
commit 0a42a8bc46
5 changed files with 38 additions and 8 deletions

View File

@ -154,6 +154,20 @@ cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist)
return NULL;
}
cache_param_t * search_cacheBytid( char tid[], cachelist_param_t *cachelist)
{
cache_param_t *foundcache;
foundcache = cachelist->first;
while( foundcache != NULL){
if( strcmp( tid, foundcache->tid) == 0)
return foundcache;
foundcache = foundcache->next;
}
return NULL;
}
void add_cachecid( char *cid, cache_param_t *cache)
{
char **tmp;

View File

@ -121,7 +121,7 @@ cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist);
/**
* search codestream number (csn) by cid
* search a cache by cid
*
* @param[in] cid channel identifer
* @param[in] cachelist cache list pointer
@ -129,6 +129,16 @@ cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist);
*/
cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist);
/**
* search a cache by tid
*
* @param[in] tid target identifer
* @param[in] cachelist cache list pointer
* @return found cache pointer
*/
cache_param_t * search_cacheBytid( char tid[], cachelist_param_t *cachelist);
/**
* add cid into a cache
*

View File

@ -123,6 +123,7 @@ Byte_t * receive_JPIPstream( SOCKET connected_socket, char *target, char *tid, c
target[0] = 0;
cid[0] = 0;
tid[0] = 0;
if((linelen = receive_line( connected_socket, buf)) == 0)
return NULL;
@ -140,10 +141,12 @@ Byte_t * receive_JPIPstream( SOCKET connected_socket, char *target, char *tid, c
if((linelen = receive_line( connected_socket, buf)) == 0)
return NULL;
if( strcmp( buf, "0") != 0)
strcpy( tid, buf);
if((linelen = receive_line( connected_socket, buf)) == 0)
return NULL;
if( strcmp( buf, "0") != 0)
strcpy( cid, buf);
if((linelen = receive_line( connected_socket, buf)) == 0)

View File

@ -141,7 +141,7 @@ int receive_line(SOCKET connected_socket, char *buf);
*\section sec2 PNM request
* Get decoded PGM/PPM image
*
* client -> server: PNM request\\n cidstring\\n fw\\n fh\\n \n
* client -> server: PNM request\\n [cid/tid]string\\n fw\\n fh\\n \n
* server -> client: P6 or P5 (2Byte) width (2Byte Big endian) height (2Byte Big endian) maxval (1Byte) data
*
*\section sec3 XML request

View File

@ -247,10 +247,12 @@ void handle_JPIPstreamMSG( SOCKET connected_socket, cachelist_param_t *cachelist
parse_metamsg( msgqueue, *jpipstream, *streamlen, metadatalist);
// cid registration
if( target[0] != 0 && tid[0] != 0 && cid[0] != 0){
if( target[0] != 0){
if((cache = search_cache( target, cachelist))){
add_cachecid( cid, cache);
if( tid[0] != 0)
update_cachetid( tid, cache);
if( cid[0] != 0)
add_cachecid( cid, cache);
}
else{
cache = gene_cache( target, msgqueue->last->csn, tid, cid);
@ -277,6 +279,7 @@ void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_par
receive_line( connected_socket, cid);
if(!(cache = search_cacheBycid( cid, cachelist)))
if(!(cache = search_cacheBytid( cid, cachelist)))
return;
receive_line( connected_socket, tmp);