xine-lib: xine-lib-1.2.12/src/xine-engine/io_helper.c File Reference

xine-lib 1.2.12

Macros | Functions
io_helper.c File Reference
`#include <stdio.h>`
`#include <unistd.h>`
`#include <fcntl.h>`
`#include <sys/time.h>`
`#include <sys/types.h>`
`#include <errno.h>`
`#include <string.h>`
`#include <xine/io_helper.h>`
`#include "xine_private.h"`

## Macros
#define | XIO_POLLING_INTERVAL 50000 /* usec */
#define | sock_strerror strerror
#define | sock_errno errno
#define | IF_EAGAIN (errno == EAGAIN)
#define | SOCK_EAGAIN EAGAIN
#define | SOCK_EINPROGRESS EINPROGRESS
#define | SOCK_ENOENT ENOENT
#define | SOCK_EACCES EACCES
#define | SOCK_ECONNREFUSED ECONNREFUSED

## Functions
static void | reportIP (xine_stream_t *stream, const char *text, const uint8_t *p, int port)
int | _x_io_tcp_connect (xine_stream_t *stream, const char *host, int port)
int | _x_io_tcp_handshake_connect (xine_stream_t *stream, const char *host, int port, xio_handshake_cb_t *handshake_cb, void *userdata)
int | _x_io_select (xine_stream_t *stream, int fd, int state, int timeout_msec)
int | _x_io_tcp_connect_finish (xine_stream_t *stream, int fd, int timeout_msec)
static off_t | xio_err (xine_stream_t *stream, int ret)
off_t | _x_io_tcp_read (xine_stream_t *stream, int s, void *buf_gen, off_t todo)
ssize_t | _x_io_tcp_part_read (xine_stream_t *stream, int s, void *buf_gen, size_t min, size_t max)
off_t | _x_io_tcp_write (xine_stream_t *stream, int s, const void *wbuf_gen, off_t todo)
off_t | _x_io_file_read (xine_stream_t *stream, int s, void *buf_gen, off_t todo)
off_t | _x_io_file_write (xine_stream_t *stream, int s, const void *wbuf_gen, off_t todo)
int | _x_io_tcp_read_line (xine_stream_t *stream, int sock, char *str, int size)
int | _x_io_tcp_close (xine_stream_t *stream, int fd)

## Macro Definition Documentation

## ◆ IF_EAGAIN

#define IF_EAGAIN (errno == EAGAIN)

## ◆ SOCK_EACCES

#define SOCK_EACCES EACCES

## ◆ SOCK_EAGAIN

#define SOCK_EAGAIN EAGAIN

## ◆ SOCK_ECONNREFUSED

#define SOCK_ECONNREFUSED ECONNREFUSED

## ◆ SOCK_EINPROGRESS

#define SOCK_EINPROGRESS EINPROGRESS

## ◆ SOCK_ENOENT

#define SOCK_ENOENT ENOENT

## ◆ sock_errno

#define sock_errno errno

## ◆ sock_strerror

#define sock_strerror strerror

## ◆ XIO_POLLING_INTERVAL

#define XIO_POLLING_INTERVAL 50000 /* usec */

## Function Documentation

## ◆ _x_io_file_read()

off_t _x_io_file_read | ( | xine_stream_t * | stream,
|  | int | s,
|  | void * | buf_gen,
|  | off_t | todo
| ) |  |

References _x_assert, _x_io_select(), IF_EAGAIN, xine_private_t::network_timeout, NULL, xine_stream_s::xine, xio_err(), XIO_READ_READY, and XIO_READY.

## ◆ _x_io_file_write()

off_t _x_io_file_write | ( | xine_stream_t * | stream,
|  | int | s,
|  | const void * | wbuf_gen,
|  | off_t | todo
| ) |  |

References _x_assert, _x_io_select(), IF_EAGAIN, xine_private_t::network_timeout, NULL, xine_stream_s::xine, xio_err(), XIO_READY, and XIO_WRITE_READY.

## ◆ _x_io_select()

int _x_io_select | ( | xine_stream_t * | stream,
|  | int | fd,
|  | int | state,
|  | int | timeout_msec
| ) |  |

References _, _x_action_pending(), NULL, xine_stream_s::xine, xine_log(), XINE_LOG_MSG, XIO_ABORTED, XIO_ERROR, XIO_POLLING_INTERVAL, XIO_READ_READY, XIO_READY, XIO_TIMEOUT, and XIO_WRITE_READY.

Referenced by _gnutls_handshake(), _gnutls_part_read(), _gnutls_read(), _gnutls_shutdown(), _gnutls_write(), _wait_socket(), _x_io_file_read(), _x_io_file_write(), _x_io_tcp_connect_finish(), _x_io_tcp_handshake_connect(), _x_io_tcp_part_read(), _x_io_tcp_read(), _x_io_tcp_write(), file_input_read(), hls_live_wait(), http_plugin_handshake(), mms_tcp_connect(), mmsh_tcp_connect(), mpd_set_frag_index(), and stdin_plugin_wait().

## ◆ _x_io_tcp_close()

int _x_io_tcp_close | ( | xine_stream_t * | stream,
|  | int | fd
| ) |  |

References sock_errno, sock_strerror, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _abor(), _cdda_cddb_socket_close(), _dispose(), _ftp_connect(), _ftp_dispose(), _x_io_tcp_handshake_connect(), _x_tls_close(), _x_tls_connect(), get_media_packet(), http_close(), http_restart(), mms_close(), mms_connect(), mmsh_close(), mmsh_connect(), mmsh_connect_int(), pnm_close(), and rtsp_close().

## ◆ _x_io_tcp_connect()

int _x_io_tcp_connect | ( | xine_stream_t * | stream,
|  | const char * | host,
|  | int | port
| ) |  |

References _x_io_tcp_handshake_connect(), and NULL.

Referenced by _cdda_cddb_socket_open(), _connect(), _ssh_connect(), _x_tls_connect(), mms_tcp_connect(), mmsh_tcp_connect(), network_connect(), pnm_connect(), and rtsp_connect().

## ◆ _x_io_tcp_connect_finish()

int _x_io_tcp_connect_finish | ( | xine_stream_t * | stream,
|  | int | fd,
|  | int | timeout_msec
| ) |  |

References _, _x_io_select(), _x_message(), NULL, sock_errno, sock_strerror, xine_stream_s::xine, XINE_MSG_CONNECTION_REFUSED, XINE_VERBOSITY_DEBUG, XIO_ERROR, XIO_READY, XIO_WRITE_READY, and xprintf.

Referenced by _cdda_cddb_socket_open(), _connect(), and _ssh_connect().

## ◆ _x_io_tcp_handshake_connect()

int _x_io_tcp_handshake_connect | ( | xine_stream_t * | stream,
|  | const char * | host,
|  | int | port,
|  | xio_handshake_cb_t * | handshake_cb,
|  | void * | userdata
| ) |  |

References _x_io_select(), _x_io_tcp_close(), _x_message(), xine_private_t::ip_pref, xine_private_t::network_timeout, NULL, reportIP(), SOCK_EINPROGRESS, sock_errno, sock_strerror, xine_private_t::x, xine_stream_s::xine, XINE_MSG_CONNECTION_REFUSED, XINE_MSG_UNKNOWN_HOST, xine_socket_cloexec(), xine_uint32_2str(), XINE_VERBOSITY_DEBUG, XIO_ABORTED, XIO_HANDSHAKE_INTR, XIO_HANDSHAKE_OK, XIO_HANDSHAKE_TRY_NEXT, XIO_HANDSHAKE_TRY_SAME, XIO_READY, XIO_WRITE_READY, and xprintf.

Referenced by _x_io_tcp_connect(), and http_plugin_open().

## ◆ _x_io_tcp_part_read()

ssize_t _x_io_tcp_part_read | ( | xine_stream_t * | stream,
|  | int | s,
|  | void * | buf_gen,
|  | size_t | min,
|  | size_t | max
| ) |  |

References _x_assert, _x_io_select(), IF_EAGAIN, xine_private_t::network_timeout, NULL, xine_stream_s::xine, xio_err(), XIO_READ_READY, XIO_READY, and XIO_TIMEOUT.

Referenced by _x_tls_part_read(), and gnutls_tcp_pull().

## ◆ _x_io_tcp_read()

off_t _x_io_tcp_read | ( | xine_stream_t * | stream,
|  | int | s,
|  | void * | buf_gen,
|  | off_t | todo
| ) |  |

References _x_assert, _x_io_select(), IF_EAGAIN, xine_private_t::network_timeout, NULL, xine_stream_s::xine, xio_err(), XIO_READ_READY, and XIO_READY.

Referenced by _bio_read(), _ftp_read(), _x_io_tcp_read_line(), _x_tls_read(), get_answer(), get_asf_header(), get_chunk_header(), get_header(), get_media_packet(), get_packet_command(), get_packet_header(), gnutls_tcp_pull(), pnm_get_chunk(), pnm_get_headers(), pnm_get_stream_chunk(), rtsp_read_data(), vdr_main_read(), and XINE_FORMAT_PRINTF().

## ◆ _x_io_tcp_read_line()

int _x_io_tcp_read_line | ( | xine_stream_t * | stream,
|  | int | sock,
|  | char * | str,
|  | int | size
| ) |  |

References _x_io_tcp_read().

Referenced by _cdda_cddb_socket_read(), _get_files(), _x_tls_read_line(), rtsp_get(), and XINE_FORMAT_PRINTF().

## ◆ _x_io_tcp_write()

off_t _x_io_tcp_write | ( | xine_stream_t * | stream,
|  | int | s,
|  | const void * | wbuf_gen,
|  | off_t | todo
| ) |  |

References _x_assert, _x_io_select(), IF_EAGAIN, xine_private_t::network_timeout, NULL, xine_stream_s::xine, xio_err(), XIO_READY, and XIO_WRITE_READY.

Referenced by _bio_write(), _cdda_cddb_send_command(), _x_tls_write(), gnutls_tcp_push(), pnm_get_stream_chunk(), pnm_send_request(), pnm_send_response(), rtsp_put(), send_command(), and XINE_FORMAT_PRINTF().

## ◆ reportIP()

static void reportIP | ( | xine_stream_t * | stream,
|  | const char * | text,
|  | const uint8_t * | p,
|  | int | port
| ) |  |
| static

References xine_s::verbosity, xine_stream_s::xine, xine_uint32_2str(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_io_tcp_handshake_connect().

## ◆ xio_err()

static off_t xio_err | ( | xine_stream_t * | stream,
|  | int | ret
| ) |  |
| static

References _, _x_message(), NULL, SOCK_EACCES, SOCK_ECONNREFUSED, SOCK_ENOENT, sock_errno, sock_strerror, xine_stream_s::xine, xine_log(), XINE_LOG_MSG, XINE_MSG_CONNECTION_REFUSED, XINE_MSG_FILE_NOT_FOUND, XINE_MSG_PERMISSION_ERROR, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_io_file_read(), _x_io_file_write(), _x_io_tcp_part_read(), _x_io_tcp_read(), and _x_io_tcp_write().