#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <sys/types.h>#include <sys/uio.h>#include <unistd.h>#include <atalk/dsi.h>#include <atalk/logger.h>#include <atalk/util.h>Macros | |
| #define | MSG_MORE 0x8000 |
| #define | MSG_DONTWAIT 0x40 |
Functions | |
| static void | dsi_header_pack_reply (const DSI *dsi, char *buf) |
| static int | dsi_peek (DSI *dsi) |
| Check if we can write to the DSI socket. | |
| static size_t | from_buf (DSI *dsi, uint8_t *buf, size_t count) |
| static ssize_t | buf_read (DSI *dsi, uint8_t *buf, size_t count) |
| Get bytes from buffer dsi->buffer or read from socket. | |
| static size_t | dsi_buffered_stream_read (DSI *dsi, uint8_t *data, const size_t length) |
| Get "length" bytes from buffer and/or socket. | |
| static void | block_sig (DSI *dsi) |
| static void | unblock_sig (DSI *dsi) |
| int | dsi_disconnect (DSI *dsi) |
| Communication error with the client, enter disconnected state. | |
| ssize_t | dsi_stream_write (DSI *dsi, void *data, const size_t length, int mode) |
| write raw DSI data | |
| ssize_t | dsi_stream_read_file (DSI *dsi, const int fromfd, off_t offset, const size_t length, const int err) |
| size_t | dsi_stream_read (DSI *dsi, void *data, const size_t length) |
| Read data from DSI buffer. | |
| int | dsi_stream_send (DSI *dsi, void *buf, size_t length) |
| write data. | |
| int | dsi_stream_receive (DSI *dsi) |
| Read DSI command and data. | |
| #define MSG_DONTWAIT 0x40 |
| #define MSG_MORE 0x8000 |
|
static |
|
static |
Get bytes from buffer dsi->buffer or read from socket.
|
static |
Get "length" bytes from buffer and/or socket.
In order to avoid frequent small reads this tries to read larger chunks (8192 bytes) into a buffer.
| int dsi_disconnect | ( | DSI * | dsi | ) |
Communication error with the client, enter disconnected state.
|
static |
Check if we can write to the DSI socket.
afpd is sleeping too much while trying to send something. May be there's no reader or the reader is also sleeping in write, look if there's some data for us to read, hopefully it will wake up the reader so we can write again.
| size_t dsi_stream_read | ( | DSI * | dsi, |
| void * | data, | ||
| const size_t | length ) |
Read data from DSI buffer.
Essentially a loop around buf_read() to ensure "length" bytes are read from dsi->buffer and/or the socket.
| ssize_t dsi_stream_read_file | ( | DSI * | dsi, |
| const int | fromfd, | ||
| off_t | offset, | ||
| const size_t | length, | ||
| const int | err ) |
| int dsi_stream_receive | ( | DSI * | dsi | ) |
| int dsi_stream_send | ( | DSI * | dsi, |
| void * | buf, | ||
| size_t | length ) |
write data.
| ssize_t dsi_stream_write | ( | DSI * | dsi, |
| void * | data, | ||
| const size_t | length, | ||
| int | mode ) |
write raw DSI data
Checks against EINTR aren't necessary if all of the signals have SA_RESTART specified.
|
static |
Return all bytes up to count from dsi->buffer if there are any buffered there
|
static |