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
48 struct 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
59 typedef struct DSI {
60 struct dsi_block header;
61 struct sockaddr_in server, client;
62 sigset_t sigblockset;
63 struct itimerval timer, savetimer;
64 uint32_t attn_quantum, datasize, server_quantum;
65 uint16_t serverID, clientID;
66 uint8_t *status, commands[DSI_CMDSIZ], data[DSI_DATASIZ];
67 int statuslen;
68 size_t datalen, cmdlen;
69 size_t read_count, write_count;
70 int asleep;
71 /* inited = initialized?, child = a child?, noreply = send reply? */
72 char child, inited, noreply;
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 *);
79} 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 */
123 extern size_t dsi_stream_read(DSI *, void *, const size_t);
124 extern int dsi_stream_receive(DSI *, void *, const size_t, size_t *);
125 extern size_t dsi_stream_write(DSI *, void *, const size_t);
126 extern 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 */
header
static void header(void)
Print test header with timestamp.
Definition speedtest.c:742
DSI
Definition include/atalk/dsi.h:58
DSI::serverID
uint16_t serverID
Definition include/atalk/dsi.h:74
DSI::noreply
char noreply
Definition test/testsuite/dsi.h:72
DSI::datalen
size_t datalen
Definition include/atalk/dsi.h:77
DSI::client
struct sockaddr_storage server client
Definition include/atalk/dsi.h:65
DSI::cmdlen
size_t cmdlen
Definition include/atalk/dsi.h:77
DSI::savetimer
struct itimerval timer savetimer
Definition test/testsuite/dsi.h:63
DSI::sigblockset
sigset_t sigblockset
Definition test/testsuite/dsi.h:62
DSI::read_count
off_t read_count
Definition include/atalk/dsi.h:78
DSI::proto_open
pid_t(* proto_open)(struct DSI *)
Definition include/atalk/dsi.h:96
DSI::datasize
uint32_t datasize
Definition include/atalk/dsi.h:73
DSI::write_count
off_t write_count
Definition include/atalk/dsi.h:78
DSI::serversock
int serversock
Definition include/atalk/dsi.h:81
DSI::server_quantum
uint32_t server_quantum
Definition include/atalk/dsi.h:73
DSI::clientID
uint16_t clientID
Definition include/atalk/dsi.h:74
DSI::proto_close
void(* proto_close)(struct DSI *)
Definition include/atalk/dsi.h:97
DSI::data
uint8_t data[DSI_DATASIZ]
Definition include/atalk/dsi.h:76
DSI::socket
int socket
Definition include/atalk/dsi.h:80
DSI::status
char status[1400]
Definition include/atalk/dsi.h:62
DSI::attn_quantum
uint32_t attn_quantum
Definition include/atalk/dsi.h:73
DSI::child
char child
Definition test/testsuite/dsi.h:72
DSI::inited
char inited
Definition test/testsuite/dsi.h:72
DSI::timer
struct itimerval timer
Definition include/atalk/dsi.h:66
DSI::program
const char * program
Definition test/testsuite/dsi.h:73
DSI::statuslen
int statuslen
Definition include/atalk/dsi.h:61
DSI::commands
uint8_t * commands
Definition include/atalk/dsi.h:75
DSI::asleep
int asleep
Definition test/testsuite/dsi.h:70
dsi_block
Definition include/atalk/dsi.h:42
dsi_block::dsi_command
uint8_t dsi_command
Definition include/atalk/dsi.h:44
dsi_block::dsi_code
uint32_t dsi_code
Definition include/atalk/dsi.h:47
dsi_block::dsi_len
uint32_t dsi_len
Definition include/atalk/dsi.h:50
dsi_block::dsi_requestID
uint16_t dsi_requestID
Definition include/atalk/dsi.h:45
dsi_block::dsi_reserved
uint32_t dsi_reserved
Definition include/atalk/dsi.h:51
dsi_block::dsi_flags
uint8_t dsi_flags
Definition include/atalk/dsi.h:43
server
Definition cnid_metad.c:111
dsi_stream_read
size_t dsi_stream_read(DSI *, void *, const size_t)
Read data from DSI buffer.
Definition dsi_stream.c:534
dsi_stream_send
int dsi_stream_send(DSI *, void *, size_t)
write data.
Definition dsi_stream.c:581
DSI_CMDSIZ
#define DSI_CMDSIZ
Definition test/testsuite/dsi.h:57
dsi_stream_receive
int dsi_stream_receive(DSI *, void *, const size_t, size_t *)
Definition afpclient.c:132
DSI_DATASIZ
#define DSI_DATASIZ
Definition test/testsuite/dsi.h:58
dsi_stream_write
size_t dsi_stream_write(DSI *, void *, const size_t)
Definition afpclient.c:152