netatalk  4.4.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
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
86struct atpxobuf {
87 uint16_t atpxo_tid;
88 struct timeval atpxo_tv;
90 struct atpbuf *atpxo_packet[8];
91};
92
102
120
121typedef struct atp_handle *ATP;
122
123#define atp_sockaddr( h ) (&(h)->atph_saddr)
124#define atp_fileno(x) ((x)->atph_socket)
125
126struct sreq_st {
127 char *atpd_data;
131};
132
133struct rres_st {
134 struct iovec *atpd_iov;
136};
137
138struct rreq_st {
139 char *atpd_data;
141};
142
143struct sres_st {
144 struct iovec *atpd_iov;
146};
147
148struct atp_block {
150 union {
152#define atp_sreqdata atp_data.sreqdata.atpd_data
153#define atp_sreqdlen atp_data.sreqdata.atpd_dlen
154#define atp_sreqtries atp_data.sreqdata.atpd_tries
155#define atp_sreqto atp_data.sreqdata.atpd_to
156
158#define atp_rresiov atp_data.rresdata.atpd_iov
159#define atp_rresiovcnt atp_data.rresdata.atpd_iovcnt
160
162#define atp_rreqdata atp_data.rreqdata.atpd_data
163#define atp_rreqdlen atp_data.rreqdata.atpd_dlen
164
166#define atp_sresiov atp_data.sresdata.atpd_iov
167#define atp_sresiovcnt atp_data.sresdata.atpd_iovcnt
169 uint8_t atp_bitmap;
170};
171
172
173/* flags for ATP options (and control byte)
174*/
175#define ATP_STS (1<<3)
176#define ATP_EOM (1<<4)
177#define ATP_XO (1<<5)
178
179/* function codes
180*/
181#define ATP_FUNCMASK (3<<6)
182
183#define ATP_TREQ (1<<6)
184#define ATP_TRESP (2<<6)
185#define ATP_TREL (3<<6)
186
187extern ATP atp_open(uint8_t, const struct at_addr *);
188extern int atp_close(ATP);
189extern int atp_sreq(ATP, struct atp_block *, int, uint8_t);
190extern int atp_rresp(ATP, struct atp_block *);
191extern int atp_rsel(ATP, struct sockaddr_at *, int);
192extern int atp_rreq(ATP, struct atp_block *);
193extern int atp_sresp(ATP, struct atp_block *);
194
195#endif /* NO_DDP */
196#endif
ATP atp_open(uint8_t, const struct at_addr *)
Definition atp_open.c:47
int atp_close(ATP)
Definition atp_close.c:23
struct atp_handle * ATP
Definition atp.h:121
#define ATP_BUFSIZ
Definition atp.h:72
int atp_rreq(ATP, struct atp_block *)
wait for a transaction service request
Definition atp_rreq.c:51
int atp_sreq(ATP, struct atp_block *, int, uint8_t)
Send ATP transaction service request.
Definition atp_sreq.c:56
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:79
Definition at.h:68
Definition atp.h:148
struct sockaddr_at * atp_saddr
Definition atp.h:149
struct rreq_st rreqdata
Definition atp.h:161
struct sreq_st sreqdata
Definition atp.h:151
uint8_t atp_bitmap
Definition atp.h:169
struct rres_st rresdata
Definition atp.h:157
union atp_block::@073263217065046156372326366051357056273016107223 atp_data
struct sres_st sresdata
Definition atp.h:165
Definition atp.h:103
struct atpbuf * atph_reqpkt
Definition atp.h:116
uint8_t atph_rbitmap
Definition atp.h:115
int atph_rreltime
Definition atp.h:109
struct atpbuf * atph_queue
Definition atp.h:111
struct timeval atph_reqtv
Definition atp.h:117
int atph_rrespcount
Definition atp.h:114
uint8_t atph_rxo
Definition atp.h:108
struct atpbuf * atph_resppkt[8]
Definition atp.h:118
int atph_reqto
Definition atp.h:113
int atph_reqtries
Definition atp.h:112
struct atpbuf * atph_sent
Definition atp.h:110
uint16_t atph_rtid
Definition atp.h:107
uint16_t atph_tid
Definition atp.h:106
int atph_socket
Definition atp.h:104
struct sockaddr_at atph_saddr
Definition atp.h:105
Definition atp.h:93
union atpbuf::@234010067115357036205066174107246143205070337331 atpbuf_info
size_t atpbuf_dlen
Definition atp.h:95
struct atpxobuf atpbuf_xo
Definition atp.h:99
struct sockaddr_at atpbuf_addr
Definition atp.h:96
char atpbuf_data[ATP_BUFSIZ]
Definition atp.h:98
struct atpbuf * atpbuf_next
Definition atp.h:94
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:86
struct timeval atpxo_tv
Definition atp.h:88
int atpxo_reltime
Definition atp.h:89
uint16_t atpxo_tid
Definition atp.h:87
struct atpbuf * atpxo_packet[8]
Definition atp.h:90
Definition atp.h:138
char * atpd_data
Definition atp.h:139
int atpd_dlen
Definition atp.h:140
Definition atp.h:133
struct iovec * atpd_iov
Definition atp.h:134
int atpd_iovcnt
Definition atp.h:135
Definition at.h:88
Definition atp.h:126
int atpd_tries
Definition atp.h:129
int atpd_to
Definition atp.h:130
int atpd_dlen
Definition atp.h:128
char * atpd_data
Definition atp.h:127
Definition atp.h:143
int atpd_iovcnt
Definition atp.h:145
struct iovec * atpd_iov
Definition atp.h:144