uint8_t dsi_flags; /* packet type: request or reply */
uint8_t dsi_command; /* command */
uint16_t dsi_requestID; /* request ID */
- uint32_t dsi_code; /* error code or data offset */
+ union {
+ uint32_t dsi_code; /* error code */
+ uint32_t dsi_doff; /* data offset */
+ } dsi_data;
uint32_t dsi_len; /* total data length */
uint32_t dsi_reserved; /* reserved field */
};
-#define DSI_CMDSIZ 8192
#define DSI_DATASIZ 8192
/* child and parent processes might interpret a couple of these
uint32_t attn_quantum, datasize, server_quantum;
uint16_t serverID, clientID;
- uint8_t commands[DSI_CMDSIZ], data[DSI_DATASIZ];
+ uint8_t *commands; /* DSI recieve buffer */
+ uint8_t data[DSI_DATASIZ]; /* DSI reply buffer */
size_t datalen, cmdlen;
off_t read_count, write_count;
uint32_t flags; /* DSI flags like DSI_SLEEPING, DSI_DISCONNECTED */
#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 0x0004A2E0L /* default server quantum */
+#define DSI_SERVQUANT_DEF 0x100000L /* default server quantum (1 MB) */
/* default port number */
#define DSI_AFPOVERTCP_PORT 548
#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 */
-#if 0
-#define DSI_GOT_ECONNRESET (1 << 10) /* got ECONNRESET from client => exit */
-#endif
/* basic initialization: dsi_init.c */
extern DSI *dsi_init(AFPObj *obj, const char *hostname, const char *address, const char *port);
extern void dsi_setstatus (DSI *, char *, const size_t);
extern int dsi_tcp_init(DSI *dsi, const char *hostname, const char *address, const char *port);
+extern void dsi_free(DSI *dsi);
/* in dsi_getsess.c */
-extern afp_child_t *dsi_getsession (DSI *, server_child *, const int);
+extern int dsi_getsession (DSI *, server_child_t *, const int, afp_child_t **);
extern void dsi_kill (int);
extern void dsi_close (DSI *);
#define DSI_NOWAIT 1
+#define DSI_MSG_MORE 2
+
/* low-level stream commands -- in dsi_stream.c */
extern ssize_t dsi_stream_write (DSI *, void *, const size_t, const int mode);
extern size_t dsi_stream_read (DSI *, void *, const size_t);
extern int dsi_disconnect(DSI *dsi);
#ifdef WITH_SENDFILE
-extern ssize_t dsi_stream_read_file(DSI *, int, off_t off, const size_t len);
+extern ssize_t dsi_stream_read_file(DSI *, int, off_t off, const size_t len, const int err);
#endif
/* client writes -- dsi_write.c */