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;
/**
- * search codestream number (csn) by cid
+ * search a cache by cid
*
* @param[in] cid channel identifer
* @param[in] cachelist cache list pointer
*/
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
*
target[0] = 0;
cid[0] = 0;
+ tid[0] = 0;
if((linelen = receive_line( connected_socket, buf)) == 0)
return NULL;
if((linelen = receive_line( connected_socket, buf)) == 0)
return NULL;
- strcpy( tid, buf);
+ if( strcmp( buf, "0") != 0)
+ strcpy( tid, buf);
if((linelen = receive_line( connected_socket, buf)) == 0)
return NULL;
- strcpy( cid, buf);
+ if( strcmp( buf, "0") != 0)
+ strcpy( cid, buf);
if((linelen = receive_line( connected_socket, buf)) == 0)
return NULL;
*\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
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);
- update_cachetid( tid, 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);
receive_line( connected_socket, cid);
if(!(cache = search_cacheBycid( cid, cachelist)))
- return;
+ if(!(cache = search_cacheBytid( cid, cachelist)))
+ return;
receive_line( connected_socket, tmp);
fw = atoi( tmp);