OpenJPEG  2.2.0
Macros | Typedefs | Enumerations | Functions
imgsock_manager.h File Reference
#include "byte_manager.h"
#include "sock_manager.h"
#include "opj_includes.h"

Go to the source code of this file.

Macros

#define NUM_OF_MSGTYPES   9
 

Typedefs

typedef enum eMSGTYPE msgtype_t
 

Enumerations

enum  eMSGTYPE {
  JPIPSTREAM, PNMREQ, XMLREQ, TIDREQ,
  CIDREQ, CIDDST, SIZREQ, JP2SAVE,
  QUIT, MSGERROR
}
 

Functions

msgtype_t identify_clientmsg (SOCKET connected_socket)
 indeitify client message type More...
 
Byte_treceive_JPIPstream (SOCKET connected_socket, char **target, char **tid, char **cid, OPJ_SIZE_T *streamlen)
 receive a JPT- JPP- stream from client More...
 
void send_PNMstream (SOCKET connected_socket, Byte_t *pnmstream, unsigned int width, unsigned int height, unsigned int numofcomp, Byte_t maxval)
 send PGM/PPM image stream to the client More...
 
void send_XMLstream (SOCKET connected_socket, Byte_t *xmlstream, OPJ_SIZE_T length)
 send XML data stream to the client More...
 
void send_TIDstream (SOCKET connected_socket, const char *tid, OPJ_SIZE_T tidlen)
 send TID data stream to the client More...
 
void send_CIDstream (SOCKET connected_socket, const char *cid, OPJ_SIZE_T cidlen)
 send CID data stream to the client More...
 
void send_SIZstream (SOCKET connected_socket, unsigned int width, unsigned int height)
 send SIZ data stream to the client More...
 
void response_signal (SOCKET connected_socket, OPJ_BOOL succeed)
 send response signal to the client More...
 

Detailed Description

PROTOCOL specification to communicate with opj_dec_server

JPIP-stream

Cache JPT- JPP- stream in server

client -> server: JPIP-stream\n version 1.1\n (optional for cid registration: targetnamestring\n tidstring\n cidstring\n) bytelengthvalue\n data
server -> client: 1 or 0 (of 1Byte response signal)

PNM request

Get decoded PGM/PPM image

client -> server: PNM request\n [cid/tid]string\n fw\n fh\n
server -> client: P6 or P5 (2Byte) width (2Byte Big endian) height (2Byte Big endian) maxval (1Byte) data

XML request

Get XML data

client -> server: XML request\n
server -> client: XML (3Byte) length (2Byte Big endian) data

TID request

Get target ID of target image

client -> server: TID request\n targetname\n
server -> client: TID (3Byte) length (1Byte) tiddata

CID request

Get Channel ID of identical target image

client -> server: CID request\n targetname\n
server -> client: CID (3Byte) length (1Byte) ciddata

CID destroy

Close Channel ID

client -> server: CID destroy\n ciddata
server -> client: 1 or 0 (of 1Byte response signal)

SIZ request

Get original size of image

client -> server: SIZ request\n tidstring\n cidstring\n
server -> client: SIZ (3Byte) width (3Byte Big endian) height (3Byte Big endian)

JP2 save

Save in JP2 file format

client -> server: JP2 save\n ciddata
server -> client: 1 or 0 (of 1Byte response signal)

QUIT

Quit the opj_dec_server program

client -> server: quit or QUIT

Macro Definition Documentation

#define NUM_OF_MSGTYPES   9

Referenced by identify_clientmsg().

Typedef Documentation

typedef enum eMSGTYPE msgtype_t

Enumeration Type Documentation

enum eMSGTYPE
Enumerator
JPIPSTREAM 
PNMREQ 
XMLREQ 
TIDREQ 
CIDREQ 
CIDDST 
SIZREQ 
JP2SAVE 
QUIT 
MSGERROR 

Function Documentation

msgtype_t identify_clientmsg ( SOCKET  connected_socket)

indeitify client message type

Parameters
[in]connected_socketfile descriptor of the connected socket
Returns
message type

References BUF_LEN, MSGERROR, NUM_OF_MSGTYPES, and receive_line().

Referenced by handle_clientreq().

Byte_t* receive_JPIPstream ( SOCKET  connected_socket,
char **  target,
char **  tid,
char **  cid,
OPJ_SIZE_T streamlen 
)

receive a JPT- JPP- stream from client

Parameters
[in]connected_socketfile descriptor of the connected socket
[out]targetaddress of received target file name string pointer ( malloced, if not received, NULL)
[out]tidaddress of received target identifier string pointer ( malloced, if not received, null string)
[out]cidaddress of received channel identifier string pointer ( malloced, if not received, null string)
[out]streamlenlength of the received codestream
Returns
JPT- JPP- codestream

References BUF_LEN, receive_line(), and receive_stream().

Referenced by handle_JPIPstreamMSG().

void response_signal ( SOCKET  connected_socket,
OPJ_BOOL  succeed 
)

send response signal to the client

Parameters
[in]connected_socketfile descriptor of the connected socket
[in]succeedwhether if the requested process succeeded

References send_stream().

Referenced by handle_dstCIDreqMSG(), and handle_JPIPstreamMSG().

void send_CIDstream ( SOCKET  connected_socket,
const char *  cid,
OPJ_SIZE_T  cidlen 
)

send CID data stream to the client

Parameters
[in]connected_socketfile descriptor of the connected socket
[in]cidcid string
[in]cidlenlegnth of the cid string

References send_IDstream().

Referenced by handle_CIDreqMSG().

void send_PNMstream ( SOCKET  connected_socket,
Byte_t pnmstream,
unsigned int  width,
unsigned int  height,
unsigned int  numofcomp,
Byte_t  maxval 
)

send PGM/PPM image stream to the client

Parameters
[in]connected_socketfile descriptor of the connected socket
[in]pnmstreamPGM/PPM image codestream
[in]widthwidth of the PGM/PPM image (different from the original image)
[in]heightheight of the PGM/PPM image
[in]numofcompnumber of components of the image
[in]maxvalmaximum value of the image (only 255 supported)

References send_stream().

Referenced by handle_PNMreqMSG().

void send_SIZstream ( SOCKET  connected_socket,
unsigned int  width,
unsigned int  height 
)

send SIZ data stream to the client

Parameters
[in]connected_socketfile descriptor of the connected socket
[in]widthoriginal width of the image
[in]heightoriginal height of the image

References send_stream().

Referenced by handle_SIZreqMSG().

void send_TIDstream ( SOCKET  connected_socket,
const char *  tid,
OPJ_SIZE_T  tidlen 
)

send TID data stream to the client

Parameters
[in]connected_socketfile descriptor of the connected socket
[in]tidtid string
[in]tidlenlegnth of the tid string

References send_IDstream().

Referenced by handle_TIDreqMSG().

void send_XMLstream ( SOCKET  connected_socket,
Byte_t xmlstream,
OPJ_SIZE_T  length 
)

send XML data stream to the client

Parameters
[in]connected_socketfile descriptor of the connected socket
[in]xmlstreamxml data stream
[in]lengthlegnth of the xml data stream

References send_stream().

Referenced by handle_XMLreqMSG().