Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / mts / sendmail / smail.h
1 /* smail.h - definitions for the MH-SendMail/SMTP Interface */
2
3
4 #define S_MAIL  0
5 #define S_SEND  1
6 #define S_SOML  2
7 #define S_SAML  3
8
9
10 struct smtp {
11     int     code;
12     int     length;
13     char    text[BUFSIZ];
14 };
15
16
17 int     client ();
18 int     sm_init (), sm_winit (), sm_wadr (), sm_waend (), sm_wtxt (),
19         sm_wtend (), sm_end ();
20 char   *rp_string ();
21
22 /* \f */
23
24 /* The remainder of this file is derived from "mmdf.h" */
25
26 /*
27  *     Copyright (C) 1979,1980,1981,1982,1983  University of Delaware
28  *     Used by permission, May, 1984.
29  */
30
31 /*
32  *     MULTI-CHANNEL MEMO DISTRIBUTION FACILITY  (MMDF)
33  *     
34  *
35  *     Copyright (C) 1979,1980,1981,1982,1983  University of Delaware
36  *     
37  *     Department of Electrical Engineering
38  *     University of Delaware
39  *     Newark, Delaware  19711
40  *
41  *     Phone:  (302) 738-1163
42  *     
43  *     
44  *     This program module was developed as part of the University
45  *     of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
46  *     
47  *     Acquisition, use, and distribution of this module and its listings
48  *     are subject restricted to the terms of a license agreement.
49  *     Documents describing systems using this module must cite its source.
50  *
51  *     The above statements must be retained with all copies of this
52  *     program and may not be removed without the consent of the
53  *     University of Delaware.
54  *     
55  */
56
57 /*                      Reply Codes for MMDF
58  *
59  *  Based on: "Revised FTP Reply Codes", by Jon Postel & Nancy Neigus Arpanet
60  *      RFC 640 / NIC 30843, in the "Arpanet Protocol Handbook", E.  Feinler
61  *      and J. Postel (eds.), NIC 7104, Network Information Center, SRI
62  *      International:  Menlo Park, CA.  (NTIS AD-A0038901)
63  *
64  *  Actual values are different, but scheme is same.  Codes must fit into
65  *  8-bits (to pass on exit() calls); fields are packed 2-3-3 and interpreted
66  *  as octal numbers.
67  *
68  *  Basic format:
69  *
70  *      0yz: positive completion; entire action done
71  *      1yz: positive intermediate; only part done
72  *      2yz: Transient negative completion; may work later
73  *      3yz: Permanent negative completion; you lose forever
74  *
75  *      x0z: syntax
76  *      x1z: general; doesn't fit any other category
77  *      x2z: connections; truly transfer-related
78  *      x3z: user/authentication/account
79  *      x4x: mail
80  *      x5z: file system
81  *
82  *      3-bit z field is unique to the reply.  In the following,
83  *      the RP_xVAL defines are available for masking to obtain a field.
84  */
85
86 /* \f */
87
88 /***************  FIELD DEFINITIONS & BASIC VALUES  ******************* */
89
90 /*          Field 1:  Basic degree of success (2-bits)                  */
91
92 #define RP_BTYP '\200'            /* good vs. bad; on => bad            */
93
94 #define RP_BVAL '\300'            /* basic degree of success            */
95
96 #define RP_BOK  '\000'            /* went fine; all done                */
97 #define RP_BPOK '\100'            /* only the first part got done       */
98 #define RP_BTNO '\200'            /* temporary failure; try later       */
99 #define RP_BNO  '\300'            /* not now, nor never; you lose       */
100
101 /*          Field 2:  Basic domain of discourse (3-bits)                */
102
103 #define RP_CVAL '\070'            /* basic category (domain) of reply   */
104
105 #define RP_CSYN '\000'            /* purely a matter of form            */
106 #define RP_CGEN '\010'            /* couldn't find anywhere else for it */
107 #define RP_CCON '\020'            /* data-transfer-related issue        */
108 #define RP_CUSR '\030'            /* pertaining to the user             */
109 #define RP_CMAI '\040'            /* specific to mail semantics         */
110 #define RP_CFIL '\050'            /* file system                        */
111 #define RP_CLIO '\060'            /* local i/o system                   */
112
113 /*          Field 3:  Specific value for this reply (3-bits)            */
114
115 #define RP_SVAL '\007'            /* specific value of reply            */
116
117 /* \f */
118
119 /*********************  SPECIFIC SUCCESS VALUES  ********************** */
120
121
122 /*                        Complete Success                              */
123
124 #define RP_DONE (RP_BOK | RP_CGEN | '\000')
125                                   /* done (e.g., w/transaction)         */
126 #define RP_OK   (RP_BOK | RP_CGEN | '\001')
127                                   /* general-purpose OK                 */
128
129 #define RP_MOK  (RP_BOK | RP_CMAI | '\000')
130                                   /* message is accepted (w/text)       */
131
132
133 /*                        Partial Success                               */
134
135 #define RP_MAST (RP_BPOK| RP_CGEN | '\000')
136                                   /* you are the requestor              */
137 #define RP_SLAV (RP_BPOK| RP_CGEN | '\001')
138                                   /* you are the requestee              */
139 #define RP_AOK  (RP_BPOK| RP_CMAI | '\000')
140                                   /* message address is accepted        */
141
142 /* \f */
143
144 /* ********************  SPECIFIC FALURE VALUES  ********************** */
145
146
147 /*                        Partial Failure                               */
148
149 #define RP_AGN  (RP_BTNO | RP_CGEN | '\000')
150                                   /* not now; maybe later               */
151 #define RP_TIME (RP_BTNO | RP_CGEN | '\001')
152                                   /* timeout                            */
153 #define RP_NOOP (RP_BTNO | RP_CGEN | '\002')
154                                   /* no-op; nothing done, this time     */
155 #define RP_EOF  (RP_BTNO | RP_CGEN | '\003')
156                                   /* encountered an end of file         */
157
158 #define RP_NET  (RP_BTNO | RP_CCON | '\000')
159                                   /* channel went bad                   */
160 #define RP_BHST (RP_BTNO | RP_CCON | '\001')
161                                   /* foreign host screwed up            */
162 #define RP_DHST (RP_BTNO | RP_CCON | '\002')
163                                   /* host went away                     */
164 #define RP_NIO  (RP_BTNO | RP_CCON | '\004')
165                                   /* general net i/o problem            */
166
167 #define RP_FIO  (RP_BTNO | RP_CFIL | '\000')
168                                   /* error reading/writing file         */
169 #define RP_FCRT (RP_BTNO | RP_CFIL | '\001')
170                                   /* unable to create file              */
171 #define RP_FOPN (RP_BTNO | RP_CFIL | '\002')
172                                   /* unable to open file                */
173 #define RP_LIO  (RP_BTNO | RP_CLIO | '\000')
174                                   /* general local i/o problem          */
175 #define RP_LOCK (RP_BTNO | RP_CLIO | '\001')
176                                   /* resource currently locked          */
177
178
179 /*                       Complete Failure                               */
180
181 #define RP_MECH (RP_BNO | RP_CGEN | '\000')
182                                   /* bad mechanism/path; try alternate? */
183 #define RP_NO   (RP_BNO | RP_CGEN | '\001')
184                                   /* general-purpose NO                 */
185
186 #define RP_PROT (RP_BNO | RP_CCON | '\000')
187                                   /* general prototocol error           */
188
189 #define RP_RPLY (RP_BNO | RP_CCON | '\001')
190                                   /* bad reply code (PERMANENT ERROR)   */
191
192 #define RP_NDEL (RP_BNO | RP_CMAI | '\000')
193                                   /* couldn't deliver                   */
194
195 #define RP_HUH  (RP_BNO | RP_CSYN | '\000')
196                                   /* couldn't parse the request         */
197 #define RP_NCMD (RP_BNO | RP_CSYN | '\001')
198                                   /* no such command defined            */
199 #define RP_PARM (RP_BNO | RP_CSYN | '\002')
200                                   /* bad parameter                      */
201 #define RP_UCMD (RP_BNO | RP_CSYN | '\003')
202                                   /* command not implemented            */
203 #define RP_USER (RP_BNO | RP_CUSR | '\000')
204                                   /* unknown user                       */
205
206 /* \f */
207
208 /*              PSEUDO-FUNCTIONS TO ACCESS REPLY INFO                   */
209
210 #define rp_gval(val)    ((char) (val))
211                                   /* get the entire return value        */
212
213
214 /*  The next three give the field's bits, within the whole value        */
215
216 #define rp_gbval(val)   (rp_gval (val) & RP_BVAL)
217                                   /* get the basic part of return value */
218 #define rp_gcval(val)   (rp_gval (val) & RP_CVAL)
219                                   /* get the domain part of value       */
220 #define rp_gsval(val)   (rp_gval (val) & RP_SVAL)
221                                   /* get the specific part of value     */
222
223
224 /*  The next three give the numeric value withing the field             */
225
226 #define rp_gbbit(val)   ((rp_gval (val) >> 6) & 03)
227                                   /* get the basic part right-shifted   */
228 #define rp_gcbit(val)   ((rp_gval (val) >> 3 ) & 07)
229                                   /* get the domain part right-shifted  */
230 #define rp_gsbit(val)   (rp_gval (val) & 07)
231                                   /* get the specific part right-shifted */
232
233
234 /* MACHINE DEPENDENCY:  The following treat the value as strictly numeric.
235  *                      It relies on the negative values being numerically
236  *                      negative.
237  */
238
239 #define rp_isgood(val)  (rp_gval (val) >= 0)
240                                   /* is return value positive?          */
241 #define rp_isbad(val)   (rp_gval (val) < 0)
242                                   /* is return value negative?          */