OpenJPEG  2.2.0
Macros | Typedefs | Functions
sock_manager.h File Reference
#include "byte_manager.h"
#include "opj_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 More...
 
SOCKET accept_socket (SOCKET listening_socket)
 accept a new connection to the listenning socket More...
 
OPJ_SIZE_T receive_line (SOCKET connected_socket, char *buf)
 receive a string line (ending with '
') from client More...
 
char * receive_string (SOCKET connected_socket)
 receive a string line (ending with '
') from client, return malloc string More...
 
void * receive_stream (SOCKET connected_socket, OPJ_SIZE_T length)
 receive data stream to client More...
 
void send_stream (SOCKET connected_socket, const void *stream, OPJ_SIZE_T length)
 send data stream to client More...
 
int close_socket (SOCKET sock)
 close socket More...
 

Macro Definition Documentation

#define BUF_LEN   256

Typedef Documentation

typedef int SOCKET

Function Documentation

SOCKET accept_socket ( SOCKET  listening_socket)

accept a new connection to the listenning socket

Parameters
listening_socketlistenning socket
Returns
connected socket (-1 if error occurs)

Referenced by accept_connection(), and aux_streaming().

int close_socket ( SOCKET  sock)

close socket

Parameters
[in]sockclosing socket
Returns
0 if succeed, -1 if failed

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

SOCKET open_listeningsocket ( uint16_t  port)

open listening socket

Parameters
portopening port number
Returns
new socket

References close_socket(), and FCGI_stderr.

Referenced by init_aux_transport(), and init_dec_server().

OPJ_SIZE_T receive_line ( SOCKET  connected_socket,
char *  buf 
)

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

Parameters
[in]connected_socketfile descriptor of the connected socket
[out]bufstring to be stored
Returns
red size

References FCGI_stderr.

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

void* receive_stream ( SOCKET  connected_socket,
OPJ_SIZE_T  length 
)

receive data stream to client

Parameters
[in]connected_socketfile descriptor of the connected socket
[in]lengthlength 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().

char* receive_string ( SOCKET  connected_socket)

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

Parameters
[in]connected_socketfile 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().

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

send data stream to client

Parameters
[in]connected_socketfile descriptor of the connected socket
[in]streamdata stream
[in]lengthlength of data stream

References FCGI_stderr.

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