OpenJPEG: imgsock_manager.c File Reference

OpenJPEG 2.5.3

Functions
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_t * | receive_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_socket | file 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_socket | file descriptor of the connected socket
  [out] | target | address of received target file name string pointer ( malloced, if not received, NULL)
  [out] | tid | address of received target identifier string pointer ( malloced, if not received, null string)
  [out] | cid | address of received channel identifier string pointer ( malloced, if not received, null string)
  [out] | streamlen | length 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_socket | file descriptor of the connected socket
  [in] | succeed | whether 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_socket | file descriptor of the connected socket
  [in] | cid | cid string
  [in] | cidlen | length 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_socket | file descriptor of the connected socket
  [in] | pnmstream | PGM/PPM image codestream
  [in] | width | width of the PGM/PPM image (different from the original image)
  [in] | height | height of the PGM/PPM image
  [in] | numofcomp | number of components of the image
  [in] | maxval | maximum 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_socket | file descriptor of the connected socket
  [in] | width | original width of the image
  [in] | height | original 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_socket | file descriptor of the connected socket
  [in] | tid | tid string
  [in] | tidlen | length 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_socket | file descriptor of the connected socket
  [in] | xmlstream | xml data stream
  [in] | length | length of the xml data stream

References send_stream().

Referenced by handle_XMLreqMSG().