netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
test/testsuite/dsi.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
3 * All rights reserved.
4 *
5 * modified for test-suite
6 */
7
8#ifndef _ATALK_DSI_H
9#define _ATALK_DSI_H
10
11#include <sys/types.h>
12#include <sys/time.h>
13#include <signal.h>
14
15#include <netinet/in.h>
16
46
47#define DSI_BLOCKSIZ 16
48struct dsi_block {
49 uint8_t dsi_flags;
50 uint8_t dsi_command;
51 uint16_t dsi_requestID;
52 uint32_t dsi_code;
53 uint32_t dsi_len;
54 uint32_t dsi_reserved;
55};
56
57#define DSI_CMDSIZ 800
58#define DSI_DATASIZ 8192
59typedef struct DSI {
60 struct dsi_block header;
61 struct sockaddr_in server, client;
62 sigset_t sigblockset;
63 struct itimerval timer, savetimer;
65 uint16_t serverID, clientID;
67 int statuslen;
68 size_t datalen, cmdlen;
70 int asleep;
71 /* inited = initialized?, child = a child?, noreply = send reply? */
73 const char *program;
74 int socket, serversock;
75
76 /* protocol specific open/close */
77 pid_t (*proto_open)(struct DSI *);
78 void (*proto_close)(struct DSI *);
80
81/* DSI flags */
82#define DSIFL_REQUEST 0x00
83#define DSIFL_REPLY 0x01
84#define DSIFL_MAX 0x01
85
86/* DSI session options */
87#define DSIOPT_SERVQUANT 0x00
88#define DSIOPT_ATTNQUANT 0x01
89
90/* DSI Commands */
91#define DSIFUNC_CLOSE 1
92#define DSIFUNC_CMD 2
93#define DSIFUNC_STAT 3
94#define DSIFUNC_OPEN 4
95#define DSIFUNC_TICKLE 5
96#define DSIFUNC_WRITE 6
97#define DSIFUNC_ATTN 8
98#define DSIFUNC_MAX 8
99
100/* DSI Error codes: most of these aren't used. */
101#define DSIERR_OK 0x0000
102#define DSIERR_BADVERS 0xfbd6
103#define DSIERR_BUFSMALL 0xfbd5
104#define DSIERR_NOSESS 0xfbd4
105#define DSIERR_NOSERV 0xfbd3
106#define DSIERR_PARM 0xfbd2
107#define DSIERR_SERVBUSY 0xfbd1
108#define DSIERR_SESSCLOS 0xfbd0
109#define DSIERR_SIZERR 0xfbcf
110#define DSIERR_TOOMANY 0xfbce
111#define DSIERR_NOACK 0xfbcd
112
113/* server and client quanta */
114#define DSI_DEFQUANT 2
115#define DSI_SERVQUANT_MAX 0xffffffffL
116#define DSI_SERVQUANT_MIN 0x0004A2E0L
117#define DSI_SERVQUANT_DEF DSI_SERVQUANT_MIN
118
120#define DSI_AFPOVERTCP_PORT 548
121
122/* low-level stream commands -- implemented in afpclient.c */
123extern size_t dsi_stream_read(DSI *, void *, const size_t);
124extern int dsi_stream_receive(DSI *, void *, const size_t, size_t *);
125extern size_t dsi_stream_write(DSI *, void *, const size_t);
126extern int dsi_stream_send(DSI *, void *, size_t);
127
128/* some useful macros */
129#define dsi_clientID(x) ((x)->clientID++)
130#define dsi_serverID(x) ((x)->serverID++)
131#define dsi_send(x) do { \
132 (x)->header.dsi_len = htonl((x)->cmdlen); \
133 dsi_stream_send((x), (x)->commands, (x)->cmdlen); \
134} while (0)
135
136#endif /* atalk/dsi.h */
static void header(void)
Print test header with timestamp.
Definition speedtest.c:742
Definition include/atalk/dsi.h:58
uint16_t serverID
Definition include/atalk/dsi.h:74
char noreply
Definition test/testsuite/dsi.h:72
size_t datalen
Definition include/atalk/dsi.h:77
struct sockaddr_storage server client
Definition include/atalk/dsi.h:65
size_t cmdlen
Definition include/atalk/dsi.h:77
struct itimerval timer savetimer
Definition test/testsuite/dsi.h:63
sigset_t sigblockset
Definition test/testsuite/dsi.h:62
off_t read_count
Definition include/atalk/dsi.h:78
pid_t(* proto_open)(struct DSI *)
Definition include/atalk/dsi.h:96
uint32_t datasize
Definition include/atalk/dsi.h:73
off_t write_count
Definition include/atalk/dsi.h:78
int serversock
Definition include/atalk/dsi.h:81
uint32_t server_quantum
Definition include/atalk/dsi.h:73
uint16_t clientID
Definition include/atalk/dsi.h:74
void(* proto_close)(struct DSI *)
Definition include/atalk/dsi.h:97
uint8_t data[DSI_DATASIZ]
Definition include/atalk/dsi.h:76
int socket
Definition include/atalk/dsi.h:80
char status[1400]
Definition include/atalk/dsi.h:62
uint32_t attn_quantum
Definition include/atalk/dsi.h:73
char child
Definition test/testsuite/dsi.h:72
char inited
Definition test/testsuite/dsi.h:72
struct itimerval timer
Definition include/atalk/dsi.h:66
const char * program
Definition test/testsuite/dsi.h:73
int statuslen
Definition include/atalk/dsi.h:61
uint8_t * commands
Definition include/atalk/dsi.h:75
int asleep
Definition test/testsuite/dsi.h:70
Definition include/atalk/dsi.h:42
uint8_t dsi_command
Definition include/atalk/dsi.h:44
uint32_t dsi_code
Definition include/atalk/dsi.h:47
uint32_t dsi_len
Definition include/atalk/dsi.h:50
uint16_t dsi_requestID
Definition include/atalk/dsi.h:45
uint32_t dsi_reserved
Definition include/atalk/dsi.h:51
uint8_t dsi_flags
Definition include/atalk/dsi.h:43
Definition cnid_metad.c:111
size_t dsi_stream_read(DSI *, void *, const size_t)
Read data from DSI buffer.
Definition dsi_stream.c:534
int dsi_stream_send(DSI *, void *, size_t)
write data.
Definition dsi_stream.c:581
#define DSI_CMDSIZ
Definition test/testsuite/dsi.h:57
int dsi_stream_receive(DSI *, void *, const size_t, size_t *)
Definition afpclient.c:132
#define DSI_DATASIZ
Definition test/testsuite/dsi.h:58
size_t dsi_stream_write(DSI *, void *, const size_t)
Definition afpclient.c:152