netatalk  4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
atp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1990,1991 Regents of The University of Michigan.
3 * All Rights Reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software and
6 * its documentation for any purpose and without fee is hereby granted,
7 * provided that the above copyright notice appears in all copies and
8 * that both that copyright notice and this permission notice appear
9 * in supporting documentation, and that the name of The University
10 * of Michigan not be used in advertising or publicity pertaining to
11 * distribution of the software without specific, written prior
12 * permission. This software is supplied as is without expressed or
13 * implied warranties of any kind.
14 *
15 * Research Systems Unix Group
16 * The University of Michigan
17 * c/o Mike Clark
18 * 535 W. William Street
19 * Ann Arbor, Michigan
20 * +1-313-763-0525
21 * netatalk@itd.umich.edu
22 */
23
24#ifndef _ATALK_ATP_H
25#define _ATALK_ATP_H 1
26
27#ifndef NO_DDP
28
29#include <stdint.h>
30#include <sys/types.h>
31#include <sys/time.h>
32#include <netatalk/at.h>
33
62
63struct atphdr {
65 uint8_t atphd_bitmap;
66 uint16_t atphd_tid;
67};
68
69/* ATP protocol parameters
70*/
71#define ATP_MAXDATA (578+4)
72#define ATP_BUFSIZ 587
73#define ATP_HDRSIZE 5
74
75#define ATP_TRELMASK 0x07
76#define ATP_RELTIME 30
77
78#define ATP_TREL30 0x0
79#define ATP_TREL1M 0x1
80#define ATP_TREL2M 0x2
81#define ATP_TREL4M 0x3
82#define ATP_TREL8M 0x4
83
84#define ATP_TRIES_INFINITE -1
85
86#define ATP_MAXQUEUE 8
87#define ATP_MAXRESP 8
88
89struct atpxobuf {
90 uint16_t atpxo_tid;
91 struct timeval atpxo_tv;
93 struct atpbuf *atpxo_packet[8];
94};
95
96struct atpbuf {
98 size_t atpbuf_dlen;
100 union {
101 char atpbuf_data[ATP_BUFSIZ];
102 struct atpxobuf atpbuf_xo;
104};
105
123
124typedef struct atp_handle *ATP;
125
126#define atp_sockaddr( h ) (&(h)->atph_saddr)
127#define atp_fileno(x) ((x)->atph_socket)
128
129struct sreq_st {
130 char *atpd_data;
134};
135
136struct rres_st {
137 struct iovec *atpd_iov;
139};
140
141struct rreq_st {
142 char *atpd_data;
144};
145
146struct sres_st {
147 struct iovec *atpd_iov;
149};
150
151struct atp_block {
153 union {
154 struct sreq_st sreqdata;
155#define atp_sreqdata atp_data.sreqdata.atpd_data
156#define atp_sreqdlen atp_data.sreqdata.atpd_dlen
157#define atp_sreqtries atp_data.sreqdata.atpd_tries
158#define atp_sreqto atp_data.sreqdata.atpd_to
159
160 struct rres_st rresdata;
161#define atp_rresiov atp_data.rresdata.atpd_iov
162#define atp_rresiovcnt atp_data.rresdata.atpd_iovcnt
163
164 struct rreq_st rreqdata;
165#define atp_rreqdata atp_data.rreqdata.atpd_data
166#define atp_rreqdlen atp_data.rreqdata.atpd_dlen
167
168 struct sres_st sresdata;
169#define atp_sresiov atp_data.sresdata.atpd_iov
170#define atp_sresiovcnt atp_data.sresdata.atpd_iovcnt
172 uint8_t atp_bitmap;
173};
174
175
176/* flags for ATP options (and control byte)
177*/
178#define ATP_STS (1<<3)
179#define ATP_EOM (1<<4)
180#define ATP_XO (1<<5)
181
182/* function codes
183*/
184#define ATP_FUNCMASK (3<<6)
185
186#define ATP_TREQ (1<<6)
187#define ATP_TRESP (2<<6)
188#define ATP_TREL (3<<6)
189
190extern ATP atp_open(uint8_t, const struct at_addr *);
191extern int atp_close(ATP);
192extern int atp_sreq(ATP, struct atp_block *, int, uint8_t);
193extern int atp_rresp(ATP, struct atp_block *);
194extern int atp_rsel(ATP, struct sockaddr_at *, int);
195extern int atp_rreq(ATP, struct atp_block *);
196extern int atp_rreq_try(ATP,
197 struct atp_block *);
198extern int atp_sresp(ATP, struct atp_block *);
199
200#endif /* NO_DDP */
201#endif
ATP atp_open(uint8_t, const struct at_addr *)
Definition atp_open.c:47
int atp_close(ATP)
Definition atp_close.c:23
int atp_rreq_try(ATP, struct atp_block *)
Definition atp_rreq.c:55
struct atp_handle * ATP
Definition atp.h:124
#define ATP_BUFSIZ
Definition atp.h:72
int atp_rreq(ATP, struct atp_block *)
wait for a transaction service request
Definition atp_rreq.c:127
int atp_sreq(ATP, struct atp_block *, int, uint8_t)
Send ATP transaction service request.
Definition atp_sreq.c:56
#define ATP_MAXRESP
Definition atp.h:87
int atp_sresp(ATP, struct atp_block *)
send a transaction response
Definition atp_sresp.c:53
int atp_rresp(ATP, struct atp_block *)
Receives ATP response packets.
Definition atp_rresp.c:51
int atp_rsel(ATP, struct sockaddr_at *, int)
Receive ATP packets.
Definition atp_rsel.c:97
Definition at.h:68
Definition atp.h:151
struct sockaddr_at * atp_saddr
Definition atp.h:152
union atp_block::@255015045007342167245074040013164225204147103166 atp_data
uint8_t atp_bitmap
Definition atp.h:172
Definition atp.h:106
struct atpbuf * atph_reqpkt
Definition atp.h:119
uint8_t atph_rbitmap
Definition atp.h:118
int atph_rreltime
Definition atp.h:112
struct atpbuf * atph_queue
Definition atp.h:114
struct timeval atph_reqtv
Definition atp.h:120
int atph_rrespcount
Definition atp.h:117
struct atpbuf * atph_resppkt[ATP_MAXRESP]
Definition atp.h:121
uint8_t atph_rxo
Definition atp.h:111
int atph_reqto
Definition atp.h:116
int atph_reqtries
Definition atp.h:115
struct atpbuf * atph_sent
Definition atp.h:113
uint16_t atph_rtid
Definition atp.h:110
uint16_t atph_tid
Definition atp.h:109
int atph_socket
Definition atp.h:107
struct sockaddr_at atph_saddr
Definition atp.h:108
Definition atp.h:96
size_t atpbuf_dlen
Definition atp.h:98
struct sockaddr_at atpbuf_addr
Definition atp.h:99
union atpbuf::@157340277261011272143373334361067027036061345004 atpbuf_info
struct atpbuf * atpbuf_next
Definition atp.h:97
Definition atp.h:63
uint16_t atphd_tid
Definition atp.h:66
uint8_t atphd_ctrlinfo
Definition atp.h:64
uint8_t atphd_bitmap
Definition atp.h:65
Definition atp.h:89
struct timeval atpxo_tv
Definition atp.h:91
int atpxo_reltime
Definition atp.h:92
uint16_t atpxo_tid
Definition atp.h:90
struct atpbuf * atpxo_packet[8]
Definition atp.h:93
Definition atp.h:141
char * atpd_data
Definition atp.h:142
int atpd_dlen
Definition atp.h:143
Definition atp.h:136
struct iovec * atpd_iov
Definition atp.h:137
int atpd_iovcnt
Definition atp.h:138
Definition at.h:88
Definition atp.h:129
int atpd_tries
Definition atp.h:132
int atpd_to
Definition atp.h:133
int atpd_dlen
Definition atp.h:131
char * atpd_data
Definition atp.h:130
Definition atp.h:146
int atpd_iovcnt
Definition atp.h:148
struct iovec * atpd_iov
Definition atp.h:147
char atpbuf_data[ATP_BUFSIZ]