#include <sys/types.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <signal.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <atalk/afp.h>
#include <atalk/globals.h>
#include <atalk/server_child.h>
Go to the source code of this file.
Data Structures | |
struct | dsi_block |
struct | DSI |
Macros | |
#define | DSI_BLOCKSIZ 16 |
#define | DSI_DATASIZ 65536 |
#define | DSIFL_REQUEST 0x00 |
#define | DSIFL_REPLY 0x01 |
#define | DSIFL_MAX 0x01 |
#define | DSIOPT_SERVQUANT 0x00 /* server request quantum */ |
#define | DSIOPT_ATTNQUANT 0x01 /* attention quantum */ |
#define | DSIOPT_REPLCSIZE 0x02 /* AFP replaycache size supported by the server (that's us) */ |
#define | DSIFUNC_CLOSE 1 /* DSICloseSession */ |
#define | DSIFUNC_CMD 2 /* DSICommand */ |
#define | DSIFUNC_STAT 3 /* DSIGetStatus */ |
#define | DSIFUNC_OPEN 4 /* DSIOpenSession */ |
#define | DSIFUNC_TICKLE 5 /* DSITickle */ |
#define | DSIFUNC_WRITE 6 /* DSIWrite */ |
#define | DSIFUNC_ATTN 8 /* DSIAttention */ |
#define | DSIFUNC_MAX 8 /* largest command */ |
#define | DSIERR_OK 0x0000 |
#define | DSIERR_BADVERS 0xfbd6 |
#define | DSIERR_BUFSMALL 0xfbd5 |
#define | DSIERR_NOSESS 0xfbd4 |
#define | DSIERR_NOSERV 0xfbd3 |
#define | DSIERR_PARM 0xfbd2 |
#define | DSIERR_SERVBUSY 0xfbd1 |
#define | DSIERR_SESSCLOS 0xfbd0 |
#define | DSIERR_SIZERR 0xfbcf |
#define | DSIERR_TOOMANY 0xfbce |
#define | DSIERR_NOACK 0xfbcd |
#define | DSI_DEFQUANT 2 /* default attention quantum size */ |
#define | DSI_SERVQUANT_MAX 0xffffffff /* server quantum */ |
#define | DSI_SERVQUANT_MIN 32000 /* minimum server quantum */ |
#define | DSI_SERVQUANT_DEF 0x100000L /* default server quantum (1 MB) */ |
#define | DSI_AFPOVERTCP_PORT 548 |
#define | DSI_DATA (1 << 0) /* we have received a DSI command */ |
#define | DSI_RUNNING (1 << 1) /* we have received a AFP command */ |
#define | DSI_SLEEPING (1 << 2) /* we're sleeping after FPZzz */ |
#define | DSI_EXTSLEEP (1 << 3) /* we're sleeping after FPZzz */ |
#define | DSI_DISCONNECTED (1 << 4) /* we're in diconnected state after a socket error */ |
#define | DSI_DIE (1 << 5) /* SIGUSR1, going down in 5 minutes */ |
#define | DSI_NOREPLY (1 << 6) /* in dsi_write we generate our own replies */ |
#define | DSI_RECONSOCKET (1 << 7) /* we have a new socket from primary reconnect */ |
#define | DSI_RECONINPROG (1 << 8) /* used in the new session in reconnect */ |
#define | DSI_AFP_LOGGED_OUT (1 << 9) /* client called afp_logout, quit on next EOF from socket */ |
#define | DSI_NOWAIT 1 |
#define | DSI_MSG_MORE 2 |
#define | dsi_wrtreply(a, b) |
#define | dsi_serverID(x) |
#define | dsi_send(x) |
Typedefs | |
typedef struct DSI | DSI |
Functions | |
DSI * | dsi_init (AFPObj *obj, const char *hostname, const char *address, const char *port) |
void | dsi_setstatus (DSI *, char *, const size_t) |
int | dsi_tcp_init (DSI *dsi, const char *hostname, const char *address, const char *port) |
void | dsi_free (DSI *dsi) |
int | dsi_getsession (DSI *, server_child_t *, const int, afp_child_t **) |
void | dsi_kill (int) |
void | dsi_opensession (DSI *) |
int | dsi_attention (DSI *, AFPUserBytes) |
int | dsi_cmdreply (DSI *, const int) |
int | dsi_tickle (DSI *) |
void | dsi_getstatus (DSI *) |
void | dsi_close (DSI *) |
ssize_t | dsi_stream_write (DSI *, void *, const size_t, const int mode) |
size_t | dsi_stream_read (DSI *, void *, const size_t) |
int | dsi_stream_send (DSI *, void *, size_t) |
int | dsi_stream_receive (DSI *) |
int | dsi_disconnect (DSI *dsi) |
size_t | dsi_writeinit (DSI *, void *, const size_t) |
size_t | dsi_write (DSI *, void *, const size_t) |
void | dsi_writeflush (DSI *) |
ssize_t | dsi_readinit (DSI *, void *, const size_t, const size_t, const int) |
ssize_t | dsi_read (DSI *, void *, const size_t) |
void | dsi_readdone (DSI *) |
#define DSI_AFP_LOGGED_OUT (1 << 9) /* client called afp_logout, quit on next EOF from socket */ |
#define DSI_AFPOVERTCP_PORT 548 |
#define DSI_BLOCKSIZ 16 |
#define DSI_DATA (1 << 0) /* we have received a DSI command */ |
#define DSI_DATASIZ 65536 |
#define DSI_DEFQUANT 2 /* default attention quantum size */ |
#define DSI_DIE (1 << 5) /* SIGUSR1, going down in 5 minutes */ |
#define DSI_DISCONNECTED (1 << 4) /* we're in diconnected state after a socket error */ |
#define DSI_EXTSLEEP (1 << 3) /* we're sleeping after FPZzz */ |
#define DSI_MSG_MORE 2 |
#define DSI_NOREPLY (1 << 6) /* in dsi_write we generate our own replies */ |
#define DSI_NOWAIT 1 |
#define DSI_RECONINPROG (1 << 8) /* used in the new session in reconnect */ |
#define DSI_RECONSOCKET (1 << 7) /* we have a new socket from primary reconnect */ |
#define DSI_RUNNING (1 << 1) /* we have received a AFP command */ |
#define dsi_send | ( | x | ) |
#define dsi_serverID | ( | x | ) |
#define DSI_SLEEPING (1 << 2) /* we're sleeping after FPZzz */ |
#define dsi_wrtreply | ( | a, | |
b ) |
#define DSIERR_BADVERS 0xfbd6 |
#define DSIERR_BUFSMALL 0xfbd5 |
#define DSIERR_NOACK 0xfbcd |
#define DSIERR_NOSERV 0xfbd3 |
#define DSIERR_NOSESS 0xfbd4 |
#define DSIERR_OK 0x0000 |
#define DSIERR_PARM 0xfbd2 |
#define DSIERR_SERVBUSY 0xfbd1 |
#define DSIERR_SESSCLOS 0xfbd0 |
#define DSIERR_SIZERR 0xfbcf |
#define DSIERR_TOOMANY 0xfbce |
#define DSIFL_MAX 0x01 |
#define DSIFL_REPLY 0x01 |
#define DSIFL_REQUEST 0x00 |
#define DSIFUNC_ATTN 8 /* DSIAttention */ |
#define DSIFUNC_CLOSE 1 /* DSICloseSession */ |
#define DSIFUNC_CMD 2 /* DSICommand */ |
#define DSIFUNC_MAX 8 /* largest command */ |
#define DSIFUNC_OPEN 4 /* DSIOpenSession */ |
#define DSIFUNC_STAT 3 /* DSIGetStatus */ |
#define DSIFUNC_TICKLE 5 /* DSITickle */ |
#define DSIFUNC_WRITE 6 /* DSIWrite */ |
#define DSIOPT_ATTNQUANT 0x01 /* attention quantum */ |
#define DSIOPT_REPLCSIZE 0x02 /* AFP replaycache size supported by the server (that's us) */ |
typedef struct DSI DSI |
|
extern |
|
extern |
|
extern |
|
extern |
Communication error with the client, enter disconnected state
|
extern |
Free any allocated resources of the master afpd DSI objects and close server socket
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Initialize DSI over TCP
dsi | (rw) DSI handle |
hostname | (r) pointer to hostname string |
inaddress | (r) Optional IPv4 or IPv6 address with an optional port, may be NULL |
inport | (r) pointer to port string |
Creates listening AFP/DSI socket. If the parameter inaddress is NULL, then we listen on the wildcard address, i,e, on all interfaces. That should mean listening on the IPv6 address "::" on IPv4/IPv6 dual stack kernels, accepting both v4 and v6 requests.
If the parameter inaddress is not NULL, then we only listen on the given address. The parameter may contain a port number using the URL format for address and port:
IPv4, IPv4:port, IPv6, [IPv6], [IPv6]:port
Parameter inport must be a valid pointer to a port string and is used if the inaddress parameter doesn't contain a port.
|
extern |
|
extern |
|
extern |
|
extern |