netatalk 4.5.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
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 struct atpxobuf {
87 uint16_t atpxo_tid;
88 struct timeval atpxo_tv;
89 int atpxo_reltime;
90 struct atpbuf *atpxo_packet[8];
91};
92
93 struct atpbuf {
94 struct atpbuf *atpbuf_next;
95 size_t atpbuf_dlen;
96 struct sockaddr_at atpbuf_addr;
97 union {
98 char atpbuf_data[ATP_BUFSIZ];
99 struct atpxobuf atpbuf_xo;
100 } atpbuf_info;
101};
102
103 struct atp_handle {
104 int atph_socket;
105 struct sockaddr_at atph_saddr;
106 uint16_t atph_tid;
107 uint16_t atph_rtid;
108 uint8_t atph_rxo;
109 int atph_rreltime;
110 struct atpbuf *atph_sent;
111 struct atpbuf *atph_queue;
112 int atph_reqtries;
113 int atph_reqto;
114 int atph_rrespcount;
115 uint8_t atph_rbitmap;
116 struct atpbuf *atph_reqpkt;
117 struct timeval atph_reqtv;
118 struct atpbuf *atph_resppkt[8];
119};
120
121 typedef struct atp_handle *ATP;
122
123#define atp_sockaddr( h ) (&(h)->atph_saddr)
124#define atp_fileno(x) ((x)->atph_socket)
125
126 struct sreq_st {
127 char *atpd_data;
128 int atpd_dlen;
129 int atpd_tries;
130 int atpd_to;
131};
132
133 struct rres_st {
134 struct iovec *atpd_iov;
135 int atpd_iovcnt;
136};
137
138 struct rreq_st {
139 char *atpd_data;
140 int atpd_dlen;
141};
142
143 struct sres_st {
144 struct iovec *atpd_iov;
145 int atpd_iovcnt;
146};
147
148 struct atp_block {
149 struct sockaddr_at *atp_saddr;
150 union {
151 struct sreq_st sreqdata;
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
157 struct rres_st rresdata;
158#define atp_rresiov atp_data.rresdata.atpd_iov
159#define atp_rresiovcnt atp_data.rresdata.atpd_iovcnt
160
161 struct rreq_st rreqdata;
162#define atp_rreqdata atp_data.rreqdata.atpd_data
163#define atp_rreqdlen atp_data.rreqdata.atpd_dlen
164
165 struct sres_st sresdata;
166#define atp_sresiov atp_data.sresdata.atpd_iov
167#define atp_sresiovcnt atp_data.sresdata.atpd_iovcnt
168 } atp_data;
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
187 extern ATP atp_open(uint8_t, const struct at_addr *);
188 extern int atp_close(ATP);
189 extern int atp_sreq(ATP, struct atp_block *, int, uint8_t);
190 extern int atp_rresp(ATP, struct atp_block *);
191 extern int atp_rsel(ATP, struct sockaddr_at *, int);
192 extern int atp_rreq(ATP, struct atp_block *);
193 extern int atp_sresp(ATP, struct atp_block *);
194
195#endif /* NO_DDP */
196#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
struct atp_handle * ATP
Definition atp.h:121
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:51
atp_sreq
int atp_sreq(ATP, struct atp_block *, int, uint8_t)
Send ATP transaction service request.
Definition atp_sreq.c:56
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:79
at_addr
Definition at.h:68
atp_block
Definition atp.h:148
atp_block::atp_saddr
struct sockaddr_at * atp_saddr
Definition atp.h:149
atp_block::rreqdata
struct rreq_st rreqdata
Definition atp.h:161
atp_block::sreqdata
struct sreq_st sreqdata
Definition atp.h:151
atp_block::atp_bitmap
uint8_t atp_bitmap
Definition atp.h:169
atp_block::atp_data
union atp_block::@357364171152073232276057335275003360055361330210 atp_data
atp_block::rresdata
struct rres_st rresdata
Definition atp.h:157
atp_block::sresdata
struct sres_st sresdata
Definition atp.h:165
atp_handle
Definition atp.h:103
atp_handle::atph_reqpkt
struct atpbuf * atph_reqpkt
Definition atp.h:116
atp_handle::atph_rbitmap
uint8_t atph_rbitmap
Definition atp.h:115
atp_handle::atph_rreltime
int atph_rreltime
Definition atp.h:109
atp_handle::atph_queue
struct atpbuf * atph_queue
Definition atp.h:111
atp_handle::atph_reqtv
struct timeval atph_reqtv
Definition atp.h:117
atp_handle::atph_rrespcount
int atph_rrespcount
Definition atp.h:114
atp_handle::atph_rxo
uint8_t atph_rxo
Definition atp.h:108
atp_handle::atph_resppkt
struct atpbuf * atph_resppkt[8]
Definition atp.h:118
atp_handle::atph_reqto
int atph_reqto
Definition atp.h:113
atp_handle::atph_reqtries
int atph_reqtries
Definition atp.h:112
atp_handle::atph_sent
struct atpbuf * atph_sent
Definition atp.h:110
atp_handle::atph_rtid
uint16_t atph_rtid
Definition atp.h:107
atp_handle::atph_tid
uint16_t atph_tid
Definition atp.h:106
atp_handle::atph_socket
int atph_socket
Definition atp.h:104
atp_handle::atph_saddr
struct sockaddr_at atph_saddr
Definition atp.h:105
atpbuf
Definition atp.h:93
atpbuf::atpbuf_info
union atpbuf::@233043014260331136100017040240133364325335167340 atpbuf_info
atpbuf::atpbuf_dlen
size_t atpbuf_dlen
Definition atp.h:95
atpbuf::atpbuf_xo
struct atpxobuf atpbuf_xo
Definition atp.h:99
atpbuf::atpbuf_addr
struct sockaddr_at atpbuf_addr
Definition atp.h:96
atpbuf::atpbuf_data
char atpbuf_data[ATP_BUFSIZ]
Definition atp.h:98
atpbuf::atpbuf_next
struct atpbuf * atpbuf_next
Definition atp.h:94
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:86
atpxobuf::atpxo_tv
struct timeval atpxo_tv
Definition atp.h:88
atpxobuf::atpxo_reltime
int atpxo_reltime
Definition atp.h:89
atpxobuf::atpxo_tid
uint16_t atpxo_tid
Definition atp.h:87
atpxobuf::atpxo_packet
struct atpbuf * atpxo_packet[8]
Definition atp.h:90
rreq_st
Definition atp.h:138
rreq_st::atpd_data
char * atpd_data
Definition atp.h:139
rreq_st::atpd_dlen
int atpd_dlen
Definition atp.h:140
rres_st
Definition atp.h:133
rres_st::atpd_iov
struct iovec * atpd_iov
Definition atp.h:134
rres_st::atpd_iovcnt
int atpd_iovcnt
Definition atp.h:135
sockaddr_at
Definition at.h:88
sreq_st
Definition atp.h:126
sreq_st::atpd_tries
int atpd_tries
Definition atp.h:129
sreq_st::atpd_to
int atpd_to
Definition atp.h:130
sreq_st::atpd_dlen
int atpd_dlen
Definition atp.h:128
sreq_st::atpd_data
char * atpd_data
Definition atp.h:127
sres_st
Definition atp.h:143
sres_st::atpd_iovcnt
int atpd_iovcnt
Definition atp.h:145
sres_st::atpd_iov
struct iovec * atpd_iov
Definition atp.h:144