netatalk
4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Toggle main menu visibility
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
63
struct
atphdr
{
64
uint8_t
atphd_ctrlinfo
;
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
89
struct
atpxobuf
{
90
uint16_t
atpxo_tid
;
91
struct
timeval
atpxo_tv
;
92
int
atpxo_reltime
;
93
struct
atpbuf
*
atpxo_packet
[8];
94
};
95
96
struct
atpbuf
{
97
struct
atpbuf
*
atpbuf_next
;
98
size_t
atpbuf_dlen
;
99
struct
sockaddr_at
atpbuf_addr
;
100
union
{
101
char
atpbuf_data
[
ATP_BUFSIZ
];
102
struct
atpxobuf
atpbuf_xo
;
103
}
atpbuf_info
;
104
};
105
106
struct
atp_handle
{
107
int
atph_socket
;
108
struct
sockaddr_at
atph_saddr
;
109
uint16_t
atph_tid
;
110
uint16_t
atph_rtid
;
111
uint8_t
atph_rxo
;
112
int
atph_rreltime
;
113
struct
atpbuf
*
atph_sent
;
114
struct
atpbuf
*
atph_queue
;
115
int
atph_reqtries
;
116
int
atph_reqto
;
117
int
atph_rrespcount
;
118
uint8_t
atph_rbitmap
;
119
struct
atpbuf
*
atph_reqpkt
;
120
struct
timeval
atph_reqtv
;
121
struct
atpbuf
*
atph_resppkt
[
ATP_MAXRESP
];
122
};
123
124
typedef
struct
atp_handle
*
ATP
;
125
126
#define atp_sockaddr( h ) (&(h)->atph_saddr)
127
#define atp_fileno(x) ((x)->atph_socket)
128
129
struct
sreq_st
{
130
char
*
atpd_data
;
131
int
atpd_dlen
;
132
int
atpd_tries
;
133
int
atpd_to
;
134
};
135
136
struct
rres_st
{
137
struct
iovec *
atpd_iov
;
138
int
atpd_iovcnt
;
139
};
140
141
struct
rreq_st
{
142
char
*
atpd_data
;
143
int
atpd_dlen
;
144
};
145
146
struct
sres_st
{
147
struct
iovec *
atpd_iov
;
148
int
atpd_iovcnt
;
149
};
150
151
struct
atp_block
{
152
struct
sockaddr_at
*
atp_saddr
;
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
171
}
atp_data
;
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
190
extern
ATP
atp_open
(uint8_t,
const
struct
at_addr
*);
191
extern
int
atp_close
(
ATP
);
192
extern
int
atp_sreq
(
ATP
,
struct
atp_block
*,
int
, uint8_t);
193
extern
int
atp_rresp
(
ATP
,
struct
atp_block
*);
194
extern
int
atp_rsel
(
ATP
,
struct
sockaddr_at
*,
int
);
195
extern
int
atp_rreq
(
ATP
,
struct
atp_block
*);
196
extern
int
atp_rreq_try
(
ATP
,
197
struct
atp_block
*);
198
extern
int
atp_sresp
(
ATP
,
struct
atp_block
*);
199
200
#endif
/* NO_DDP */
201
#endif
at.h
atp_open
ATP atp_open(uint8_t, const struct at_addr *)
Definition
atp_open.c:47
atp_close
int atp_close(ATP)
Definition
atp_close.c:23
atp_rreq_try
int atp_rreq_try(ATP, struct atp_block *)
Definition
atp_rreq.c:55
ATP
struct atp_handle * ATP
Definition
atp.h:124
ATP_BUFSIZ
#define ATP_BUFSIZ
Definition
atp.h:72
atp_rreq
int atp_rreq(ATP, struct atp_block *)
wait for a transaction service request
Definition
atp_rreq.c:127
atp_sreq
int atp_sreq(ATP, struct atp_block *, int, uint8_t)
Send ATP transaction service request.
Definition
atp_sreq.c:56
ATP_MAXRESP
#define ATP_MAXRESP
Definition
atp.h:87
atp_sresp
int atp_sresp(ATP, struct atp_block *)
send a transaction response
Definition
atp_sresp.c:53
atp_rresp
int atp_rresp(ATP, struct atp_block *)
Receives ATP response packets.
Definition
atp_rresp.c:51
atp_rsel
int atp_rsel(ATP, struct sockaddr_at *, int)
Receive ATP packets.
Definition
atp_rsel.c:97
at_addr
Definition
at.h:68
atp_block
Definition
atp.h:151
atp_block::atp_saddr
struct sockaddr_at * atp_saddr
Definition
atp.h:152
atp_block::atp_data
union atp_block::@255015045007342167245074040013164225204147103166 atp_data
atp_block::atp_bitmap
uint8_t atp_bitmap
Definition
atp.h:172
atp_handle
Definition
atp.h:106
atp_handle::atph_reqpkt
struct atpbuf * atph_reqpkt
Definition
atp.h:119
atp_handle::atph_rbitmap
uint8_t atph_rbitmap
Definition
atp.h:118
atp_handle::atph_rreltime
int atph_rreltime
Definition
atp.h:112
atp_handle::atph_queue
struct atpbuf * atph_queue
Definition
atp.h:114
atp_handle::atph_reqtv
struct timeval atph_reqtv
Definition
atp.h:120
atp_handle::atph_rrespcount
int atph_rrespcount
Definition
atp.h:117
atp_handle::atph_resppkt
struct atpbuf * atph_resppkt[ATP_MAXRESP]
Definition
atp.h:121
atp_handle::atph_rxo
uint8_t atph_rxo
Definition
atp.h:111
atp_handle::atph_reqto
int atph_reqto
Definition
atp.h:116
atp_handle::atph_reqtries
int atph_reqtries
Definition
atp.h:115
atp_handle::atph_sent
struct atpbuf * atph_sent
Definition
atp.h:113
atp_handle::atph_rtid
uint16_t atph_rtid
Definition
atp.h:110
atp_handle::atph_tid
uint16_t atph_tid
Definition
atp.h:109
atp_handle::atph_socket
int atph_socket
Definition
atp.h:107
atp_handle::atph_saddr
struct sockaddr_at atph_saddr
Definition
atp.h:108
atpbuf
Definition
atp.h:96
atpbuf::atpbuf_dlen
size_t atpbuf_dlen
Definition
atp.h:98
atpbuf::atpbuf_addr
struct sockaddr_at atpbuf_addr
Definition
atp.h:99
atpbuf::atpbuf_info
union atpbuf::@157340277261011272143373334361067027036061345004 atpbuf_info
atpbuf::atpbuf_next
struct atpbuf * atpbuf_next
Definition
atp.h:97
atphdr
Definition
atp.h:63
atphdr::atphd_tid
uint16_t atphd_tid
Definition
atp.h:66
atphdr::atphd_ctrlinfo
uint8_t atphd_ctrlinfo
Definition
atp.h:64
atphdr::atphd_bitmap
uint8_t atphd_bitmap
Definition
atp.h:65
atpxobuf
Definition
atp.h:89
atpxobuf::atpxo_tv
struct timeval atpxo_tv
Definition
atp.h:91
atpxobuf::atpxo_reltime
int atpxo_reltime
Definition
atp.h:92
atpxobuf::atpxo_tid
uint16_t atpxo_tid
Definition
atp.h:90
atpxobuf::atpxo_packet
struct atpbuf * atpxo_packet[8]
Definition
atp.h:93
rreq_st
Definition
atp.h:141
rreq_st::atpd_data
char * atpd_data
Definition
atp.h:142
rreq_st::atpd_dlen
int atpd_dlen
Definition
atp.h:143
rres_st
Definition
atp.h:136
rres_st::atpd_iov
struct iovec * atpd_iov
Definition
atp.h:137
rres_st::atpd_iovcnt
int atpd_iovcnt
Definition
atp.h:138
sockaddr_at
Definition
at.h:88
sreq_st
Definition
atp.h:129
sreq_st::atpd_tries
int atpd_tries
Definition
atp.h:132
sreq_st::atpd_to
int atpd_to
Definition
atp.h:133
sreq_st::atpd_dlen
int atpd_dlen
Definition
atp.h:131
sreq_st::atpd_data
char * atpd_data
Definition
atp.h:130
sres_st
Definition
atp.h:146
sres_st::atpd_iovcnt
int atpd_iovcnt
Definition
atp.h:148
sres_st::atpd_iov
struct iovec * atpd_iov
Definition
atp.h:147
atp_block::[union].atp_data::sreqdata
struct sreq_st sreqdata
atpbuf::[union].atpbuf_info::atpbuf_data
char atpbuf_data[ATP_BUFSIZ]
atpbuf::[union].atpbuf_info::atpbuf_xo
struct atpxobuf atpbuf_xo
include
atalk
atp.h
Generated by
1.18.0