OpenJPEG 2.5.3
imgsock_manager.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "imgsock_manager.h"

Functions

msgtype_t identify_clientmsg (SOCKET connected_socket)
 indeitify client message type
Byte_treceive_JPIPstream (SOCKET connected_socket, char **target, char **tid, char **cid, OPJ_SIZE_T *streamlen)
 receive a JPT- JPP- stream from client
void send_XMLstream (SOCKET connected_socket, Byte_t *xmlstream, OPJ_SIZE_T length)
 send XML data stream to the client
void send_IDstream (SOCKET connected_socket, const char *id, OPJ_SIZE_T idlen, const char *label)
void send_CIDstream (SOCKET connected_socket, const char *cid, OPJ_SIZE_T cidlen)
 send CID data stream to the client
void send_TIDstream (SOCKET connected_socket, const char *tid, OPJ_SIZE_T tidlen)
 send TID data stream to the client
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
void send_SIZstream (SOCKET connected_socket, unsigned int width, unsigned int height)
 send SIZ data stream to the client
void response_signal (SOCKET connected_socket, OPJ_BOOL succeed)
 send response signal to the client

Function Documentation

◆ identify_clientmsg()

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().

◆ receive_JPIPstream()

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().

◆ response_signal()

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().

◆ send_CIDstream()

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]cidlenlength of the cid string

References send_IDstream().

Referenced by handle_CIDreqMSG().

◆ send_IDstream()

void send_IDstream ( SOCKET connected_socket,
const char * id,
OPJ_SIZE_T idlen,
const char * label )

References send_stream().

Referenced by send_CIDstream(), and send_TIDstream().

◆ send_PNMstream()

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().

◆ send_SIZstream()

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().

◆ send_TIDstream()

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]tidlenlength of the tid string

References send_IDstream().

Referenced by handle_TIDreqMSG().

◆ send_XMLstream()

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]lengthlength of the xml data stream

References send_stream().

Referenced by handle_XMLreqMSG().