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