OpenJPEG: sock_manager.h File Reference

OpenJPEG 2.5.4

Macros | Typedefs | Functions
sock_manager.h File Reference
`#include "byte_manager.h"`
`#include <stdint.h>`

Go to the source code of this file.

## Macros
#define | BUF_LEN 256

## Typedefs
typedef int | SOCKET

## Functions
SOCKET | open_listeningsocket (uint16_t port)
| open listening socket
SOCKET | accept_socket (SOCKET listening_socket)
| accept a new connection to the listening socket
OPJ_SIZE_T | receive_line (SOCKET connected_socket, char *buf)
| receive a string line (ending with ' ') from client
char * | receive_string (SOCKET connected_socket)
| receive a string line (ending with ' ') from client, return malloc string
void * | receive_stream (SOCKET connected_socket, OPJ_SIZE_T length)
| receive data stream to client
void | send_stream (SOCKET connected_socket, const void *stream, OPJ_SIZE_T length)
| send data stream to client
int | close_socket (SOCKET sock)
| close socket

## Macro Definition Documentation

## ◆ BUF_LEN

#define BUF_LEN 256

Referenced by identify_clientmsg(), receive_JPIPstream(), and receive_string().

## Typedef Documentation

## ◆ SOCKET

typedef int SOCKET

## Function Documentation

## ◆ accept_socket()

SOCKET accept_socket | ( | SOCKET | listening_socket | ) |

accept a new connection to the listening socket

Parameters

  listening_socket | listening socket

Returns
  connected socket (-1 if error occurs)

Referenced by accept_connection(), and aux_streaming().

## ◆ close_socket()

int close_socket | ( | SOCKET | sock | ) |

close socket

Parameters

  [in] | sock | closing socket

Returns
  0 if succeed, -1 if failed

Referenced by aux_streaming(), close_aux_transport(), handle_clientreq(), open_listeningsocket(), and terminate_dec_server().

## ◆ open_listeningsocket()

SOCKET open_listeningsocket | ( | uint16_t | port | ) |

open listening socket

Parameters

  port | opening port number

Returns
  new socket

References close_socket(), and FCGI_stderr.

Referenced by init_aux_transport(), and init_dec_server().

## ◆ receive_line()

OPJ_SIZE_T receive_line | ( | SOCKET | connected_socket,
|  | char * | buf )

receive a string line (ending with '
') from client

Parameters

  [in] | connected_socket | file descriptor of the connected socket
  [out] | buf | string to be stored

Returns
  red size

References FCGI_stderr.

Referenced by handle_PNMreqMSG(), identify_clientmsg(), receive_JPIPstream(), and receive_string().

## ◆ receive_stream()

void * receive_stream | ( | SOCKET | connected_socket,
|  | OPJ_SIZE_T | length )

receive data stream to client

Parameters

  [in] | connected_socket | file descriptor of the connected socket
  [in] | length | length of the receiving stream

Returns
  pointer to the data stream (memory allocated), NULL if failed

References FCGI_stderr.

Referenced by receive_JPIPstream(), and recv_ack().

## ◆ receive_string()

char * receive_string | ( | SOCKET | connected_socket | ) |

receive a string line (ending with '
') from client, return malloc string

Parameters

  [in] | connected_socket | file descriptor of the connected socket

Returns
  pointer to the string (memory allocated)

References BUF_LEN, and receive_line().

Referenced by handle_CIDreqMSG(), handle_dstCIDreqMSG(), handle_JP2saveMSG(), handle_PNMreqMSG(), handle_SIZreqMSG(), handle_TIDreqMSG(), handle_XMLreqMSG(), and identify_cid().

## ◆ send_stream()

void send_stream | ( | SOCKET | connected_socket,
|  | const void * | stream,
|  | OPJ_SIZE_T | length )

send data stream to client

Parameters

  [in] | connected_socket | file descriptor of the connected socket
  [in] | stream | data stream
  [in] | length | length of data stream

References FCGI_stderr.

Referenced by aux_streaming(), response_signal(), send_IDstream(), send_PNMstream(), send_SIZstream(), and send_XMLstream().