netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
dsi.h File Reference

DSI (Data Stream Interface) protocol definitions for the test-suite. More...

#include <sys/types.h>
#include <sys/time.h>
#include <signal.h>
#include <netinet/in.h>

Go to the source code of this file.

Data Structures

struct  dsi_block
 
struct  DSI
 

Macros

#define DSI_BLOCKSIZ   16
 
#define DSI_CMDSIZ   800
 
#define DSI_DATASIZ   8192
 
#define DSIFL_REQUEST   0x00
 
#define DSIFL_REPLY   0x01
 
#define DSIFL_MAX   0x01
 
#define DSIOPT_SERVQUANT   0x00
 
#define DSIOPT_ATTNQUANT   0x01
 
#define DSIFUNC_CLOSE   1
 
#define DSIFUNC_CMD   2
 
#define DSIFUNC_STAT   3
 
#define DSIFUNC_OPEN   4
 
#define DSIFUNC_TICKLE   5
 
#define DSIFUNC_WRITE   6
 
#define DSIFUNC_ATTN   8
 
#define DSIFUNC_MAX   8
 
#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
 
#define DSI_SERVQUANT_MAX   0xffffffffL
 
#define DSI_SERVQUANT_MIN   0x0004A2E0L
 
#define DSI_SERVQUANT_DEF   DSI_SERVQUANT_MIN
 
#define DSI_AFPOVERTCP_PORT   548
 
#define dsi_clientID(x)   ((x)->clientID++)
 
#define dsi_serverID(x)   ((x)->serverID++)
 
#define dsi_send(x)
 

Typedefs

typedef struct DSI DSI
 

Functions

size_t dsi_stream_read (DSI *, void *, const size_t)
 Read data from DSI buffer.
 
int dsi_stream_receive (DSI *, void *, const size_t, size_t *)
 
size_t dsi_stream_write (DSI *, void *, const size_t)
 
int dsi_stream_send (DSI *, void *, size_t)
 write data.
 

Detailed Description

DSI (Data Stream Interface) protocol definitions for the test-suite.

Client-side DSI used by the afptest tools. Unlike the libatalk server-side DSI implementation, this variant:

  • has no proto_open/proto_close, no listening socket, no AFPObj
  • uses statically allocated buffers (commands[DSI_CMDSIZ], data[DSI_DATASIZ]) sized to fit 16-bit AFP length fields
  • only implements the stream send/receive primitives a client needs; server-side helpers (dsi_init, dsi_readinit, dsi_writeinit, etc.) are intentionally not provided here

What a DSI packet looks like:

0 32
|-------------------------------|
|flags |command| requestID |
|-------------------------------|
|error code/enclosed data offset|
|-------------------------------|
|total data length |
|-------------------------------|
|reserved field |
|-------------------------------|
static dbd_flags_t flags
Definition cmd_dbd.c:43
#define data
Definition hash.c:38
Note
CONVENTION: anything with a dsi_ prefix is kept in network byte order.

Macro Definition Documentation

◆ DSI_AFPOVERTCP_PORT

#define DSI_AFPOVERTCP_PORT   548

default port number

◆ DSI_BLOCKSIZ

#define DSI_BLOCKSIZ   16

◆ dsi_clientID

#define dsi_clientID (   x)    ((x)->clientID++)

◆ DSI_CMDSIZ

#define DSI_CMDSIZ   800

◆ DSI_DATASIZ

#define DSI_DATASIZ   8192

◆ DSI_DEFQUANT

#define DSI_DEFQUANT   2

default attention quantum size

◆ dsi_send

#define dsi_send (   x)
Value:
do { \
(x)->header.dsi_len = htonl((x)->cmdlen); \
dsi_stream_send((x), (x)->commands, (x)->cmdlen); \
} while (0)
static void header(void)
Print test header with timestamp.
Definition speedtest.c:742

◆ dsi_serverID

#define dsi_serverID (   x)    ((x)->serverID++)

◆ DSI_SERVQUANT_DEF

#define DSI_SERVQUANT_DEF   DSI_SERVQUANT_MIN

default server quantum

◆ DSI_SERVQUANT_MAX

#define DSI_SERVQUANT_MAX   0xffffffffL

server quantum

◆ DSI_SERVQUANT_MIN

#define DSI_SERVQUANT_MIN   0x0004A2E0L

minimum server quantum

◆ DSIERR_BADVERS

#define DSIERR_BADVERS   0xfbd6

◆ DSIERR_BUFSMALL

#define DSIERR_BUFSMALL   0xfbd5

◆ DSIERR_NOACK

#define DSIERR_NOACK   0xfbcd

◆ DSIERR_NOSERV

#define DSIERR_NOSERV   0xfbd3

◆ DSIERR_NOSESS

#define DSIERR_NOSESS   0xfbd4

◆ DSIERR_OK

#define DSIERR_OK   0x0000

◆ DSIERR_PARM

#define DSIERR_PARM   0xfbd2

◆ DSIERR_SERVBUSY

#define DSIERR_SERVBUSY   0xfbd1

◆ DSIERR_SESSCLOS

#define DSIERR_SESSCLOS   0xfbd0

◆ DSIERR_SIZERR

#define DSIERR_SIZERR   0xfbcf

◆ DSIERR_TOOMANY

#define DSIERR_TOOMANY   0xfbce

◆ DSIFL_MAX

#define DSIFL_MAX   0x01

◆ DSIFL_REPLY

#define DSIFL_REPLY   0x01

◆ DSIFL_REQUEST

#define DSIFL_REQUEST   0x00

◆ DSIFUNC_ATTN

#define DSIFUNC_ATTN   8

DSIAttention

◆ DSIFUNC_CLOSE

#define DSIFUNC_CLOSE   1

DSICloseSession

◆ DSIFUNC_CMD

#define DSIFUNC_CMD   2

DSICommand

◆ DSIFUNC_MAX

#define DSIFUNC_MAX   8

largest command

◆ DSIFUNC_OPEN

#define DSIFUNC_OPEN   4

DSIOpenSession

◆ DSIFUNC_STAT

#define DSIFUNC_STAT   3

DSIGetStatus

◆ DSIFUNC_TICKLE

#define DSIFUNC_TICKLE   5

DSITickle

◆ DSIFUNC_WRITE

#define DSIFUNC_WRITE   6

DSIWrite

◆ DSIOPT_ATTNQUANT

#define DSIOPT_ATTNQUANT   0x01

attention quantum

◆ DSIOPT_SERVQUANT

#define DSIOPT_SERVQUANT   0x00

server request quantum

Typedef Documentation

◆ DSI

typedef struct DSI DSI

Function Documentation

◆ dsi_stream_read()

size_t dsi_stream_read ( DSI dsi,
void *  data,
const size_t  length 
)
extern

Read data from DSI buffer.

Essentially a loop around buf_read() to ensure "length" bytes are read from dsi->buffer and/or the socket.

Returns
length on success, some value smaller than length indicates an error

read raw data. return actual bytes read. this will wait until it gets length bytes

◆ dsi_stream_receive()

int dsi_stream_receive ( DSI dsi,
void *  buf,
const size_t  ilength,
size_t *  rlength 
)
extern

read data. function on success. 0 on failure. data length gets stored in length variable. this should really use size_t's, but that would require changes elsewhere.

◆ dsi_stream_send()

int dsi_stream_send ( DSI dsi,
void *  buf,
size_t  length 
)
extern

write data.

Returns
0 on failure.
Note
this assumes that dsi_len will never cause an overflow in the data buffer.

◆ dsi_stream_write()

size_t dsi_stream_write ( DSI dsi,
void *  data,
const size_t  length 
)
extern