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