]> arthur.barton.de Git - netatalk.git/blob - include/atalk/asp.h
Merge master
[netatalk.git] / include / atalk / asp.h
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_ASP_H
25 #define _ATALK_ASP_H 1
26
27 #include <sys/types.h>
28 #include <netatalk/endian.h>
29 #include <netatalk/at.h>
30 #include <atalk/atp.h>
31 #include <atalk/afp.h>
32 #include <atalk/server_child.h>
33
34 #define ASP_HDRSIZ        4
35 #define ASP_CMDSIZ        578
36
37 #define ASP_MAXPACKETS    8
38 #define ASP_CMDMAXSIZ     (ASP_CMDSIZ + ASP_HDRSIZ)
39 #define ASP_DATASIZ       (ASP_CMDSIZ*ASP_MAXPACKETS)
40 #define ASP_DATAMAXSIZ    ((ASP_CMDSIZ + ASP_HDRSIZ)*ASP_MAXPACKETS)
41
42 typedef struct ASP {
43     ATP                 asp_atp;
44     struct sockaddr_at  asp_sat;
45     u_int8_t            asp_wss;
46     u_int8_t            asp_sid;
47     union {
48         struct {
49             char                        *as_status;
50             int                         as_slen;
51         }                       asu_status;
52         u_int16_t               asu_seq;
53     }                   asp_u;
54 #define asp_status      asp_u.asu_status.as_status
55 #define asp_slen        asp_u.asu_status.as_slen
56 #define asp_seq         asp_u.asu_seq
57     int                 asp_flags;
58     char                child, inited, *commands;
59     char                cmdbuf[ASP_CMDMAXSIZ];
60     char                data[ASP_DATAMAXSIZ];  
61     size_t              cmdlen, datalen;
62     off_t               read_count, write_count;
63 } *ASP;
64
65 #define ASPFL_SLS       1
66 #define ASPFL_SSS       2
67
68 #define ASPFUNC_CLOSE   1
69 #define ASPFUNC_CMD     2
70 #define ASPFUNC_STAT    3
71 #define ASPFUNC_OPEN    4
72 #define ASPFUNC_TICKLE  5
73 #define ASPFUNC_WRITE   6
74 #define ASPFUNC_WRTCONT 7
75 #define ASPFUNC_ATTN    8
76
77 #define ASPERR_OK       0x0000
78 #define ASPERR_BADVERS  0xfbd6
79 #define ASPERR_BUFSMALL 0xfbd5
80 #define ASPERR_NOSESS   0xfbd4
81 #define ASPERR_NOSERV   0xfbd3
82 #define ASPERR_PARM     0xfbd2
83 #define ASPERR_SERVBUSY 0xfbd1
84 #define ASPERR_SESSCLOS 0xfbd0
85 #define ASPERR_SIZERR   0xfbcf
86 #define ASPERR_TOOMANY  0xfbce
87 #define ASPERR_NOACK    0xfbcd
88
89 extern ASP asp_init         (ATP);
90 extern void asp_setstatus   (ASP, char *, const int);
91 extern ASP asp_getsession   (ASP, server_child *, const int);
92 extern int asp_close        (ASP);
93 extern int asp_shutdown     (ASP);
94 extern int asp_attention    (ASP, AFPUserBytes);
95 extern int asp_getrequest   (ASP);
96 extern int asp_cmdreply     (ASP, int);
97 extern int asp_wrtcont      (ASP, char *, size_t *);
98 #define asp_wrtreply(a,b)   asp_cmdreply((a), (b))
99 extern void asp_kill        (int);
100 extern int asp_tickle      (ASP, const u_int8_t, struct sockaddr_at *);
101 extern void asp_stop_tickle (void);
102
103 #endif