X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fatalk%2Fdsi.h;h=fc1af468ac3156934f4ce1771bb19e7ed18591b4;hb=22ad101eb72bf10fe5144526209798c677b2d1d8;hp=f520c209b400effd11975f8ee0be723c3a9799af;hpb=a2ddc8384c1881c66db1fbba6698bfd09da84b64;p=netatalk.git diff --git a/include/atalk/dsi.h b/include/atalk/dsi.h index f520c209..fc1af468 100644 --- a/include/atalk/dsi.h +++ b/include/atalk/dsi.h @@ -45,19 +45,24 @@ struct dsi_block { 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 */ + }; 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 * differently. */ typedef struct DSI { - DSI *next; /* multiple listening addresses */ + struct DSI *next; /* multiple listening addresses */ AFPObj *AFPobj; + int statuslen; + char status[1400]; + char *signature; struct dsi_block header; struct sockaddr_storage server, client; struct itimerval timer; @@ -69,9 +74,8 @@ typedef struct DSI { uint32_t attn_quantum, datasize, server_quantum; uint16_t serverID, clientID; - char *status; - uint8_t commands[DSI_CMDSIZ], data[DSI_DATASIZ]; - size_t statuslen; + 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 */ @@ -134,7 +138,7 @@ typedef struct DSI { #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 @@ -150,20 +154,15 @@ typedef struct DSI { #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 (const dsi_proto /*protocol*/, - const char * /*program*/, - const char * /*host*/, const char * /*address*/, - const char * /*port*/, const int /*proxy*/, - const uint32_t /* server quantum */); +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); @@ -176,6 +175,8 @@ extern void dsi_getstatus (DSI *); 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); @@ -184,7 +185,7 @@ extern int dsi_stream_receive (DSI *); 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 */