3 * smtp.h -- definitions for the nmh SMTP Interface
8 /* various modes for SMTP */
14 /* length is the length of the string in text[], which is also NUL
15 * terminated, so s.text[s.length] should always be 0.
27 int sm_init (char *, char *, int, int, int, int, int, int, char *, char *);
28 int sm_winit (int, char *);
29 int sm_wadr (char *, char *, char *);
31 int sm_wtxt (char *, int);
34 char *rp_string (int);
41 /* The remainder of this file is derived from "mmdf.h" */
44 * Copyright (C) 1979,1980,1981,1982,1983 University of Delaware
45 * Used by permission, May, 1984.
49 * MULTI-CHANNEL MEMO DISTRIBUTION FACILITY (MMDF)
52 * Copyright (C) 1979,1980,1981,1982,1983 University of Delaware
54 * Department of Electrical Engineering
55 * University of Delaware
56 * Newark, Delaware 19711
58 * Phone: (302) 738-1163
61 * This program module was developed as part of the University
62 * of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
64 * Acquisition, use, and distribution of this module and its listings
65 * are subject restricted to the terms of a license agreement.
66 * Documents describing systems using this module must cite its source.
68 * The above statements must be retained with all copies of this
69 * program and may not be removed without the consent of the
70 * University of Delaware.
74 /* Reply Codes for MMDF
76 * Based on: "Revised FTP Reply Codes", by Jon Postel & Nancy Neigus Arpanet
77 * RFC 640 / NIC 30843, in the "Arpanet Protocol Handbook", E. Feinler
78 * and J. Postel (eds.), NIC 7104, Network Information Center, SRI
79 * International: Menlo Park, CA. (NTIS AD-A0038901)
81 * Actual values are different, but scheme is same. Codes must fit into
82 * 8-bits (to pass on exit() calls); fields are packed 2-3-3 and interpreted
87 * 0yz: positive completion; entire action done
88 * 1yz: positive intermediate; only part done
89 * 2yz: Transient negative completion; may work later
90 * 3yz: Permanent negative completion; you lose forever
93 * x1z: general; doesn't fit any other category
94 * x2z: connections; truly transfer-related
95 * x3z: user/authentication/account
99 * 3-bit z field is unique to the reply. In the following,
100 * the RP_xVAL defines are available for masking to obtain a field.
104 * FIELD DEFINITIONS & BASIC VALUES
107 /* FIELD 1: Basic degree of success (2-bits) */
109 #define RP_BTYP '\200' /* good vs. bad; on => bad */
110 #define RP_BVAL '\300' /* basic degree of success */
112 #define RP_BOK '\000' /* went fine; all done */
113 #define RP_BPOK '\100' /* only the first part got done */
114 #define RP_BTNO '\200' /* temporary failure; try later */
115 #define RP_BNO '\300' /* not now, nor never; you lose */
117 /* FIELD 2: Basic domain of discourse (3-bits) */
119 #define RP_CVAL '\070' /* basic category (domain) of reply */
121 #define RP_CSYN '\000' /* purely a matter of form */
122 #define RP_CGEN '\010' /* couldn't find anywhere else for it */
123 #define RP_CCON '\020' /* data-transfer-related issue */
124 #define RP_CUSR '\030' /* pertaining to the user */
125 #define RP_CMAI '\040' /* specific to mail semantics */
126 #define RP_CFIL '\050' /* file system */
127 #define RP_CLIO '\060' /* local i/o system */
129 /* FIELD 3: Specific value for this reply (3-bits) */
131 #define RP_SVAL '\007' /* specific value of reply */
135 * SPECIFIC SUCCESS VALUES
142 /* done (e.g., w/transaction) */
143 #define RP_DONE (RP_BOK | RP_CGEN | '\000')
145 /* general-purpose OK */
146 #define RP_OK (RP_BOK | RP_CGEN | '\001')
148 /* message is accepted (w/text) */
149 #define RP_MOK (RP_BOK | RP_CMAI | '\000')
156 /* you are the requestor */
157 #define RP_MAST (RP_BPOK| RP_CGEN | '\000')
159 /* you are the requestee */
160 #define RP_SLAV (RP_BPOK| RP_CGEN | '\001')
162 /* message address is accepted */
163 #define RP_AOK (RP_BPOK| RP_CMAI | '\000')
167 * SPECIFIC FALURE VALUES
174 /* not now; maybe later */
175 #define RP_AGN (RP_BTNO | RP_CGEN | '\000')
178 #define RP_TIME (RP_BTNO | RP_CGEN | '\001')
180 /* no-op; nothing done, this time */
181 #define RP_NOOP (RP_BTNO | RP_CGEN | '\002')
183 /* encountered an end of file */
184 #define RP_EOF (RP_BTNO | RP_CGEN | '\003')
186 /* channel went bad */
187 #define RP_NET (RP_BTNO | RP_CCON | '\000')
189 /* foreign host screwed up */
190 #define RP_BHST (RP_BTNO | RP_CCON | '\001')
193 #define RP_DHST (RP_BTNO | RP_CCON | '\002')
195 /* general net i/o problem */
196 #define RP_NIO (RP_BTNO | RP_CCON | '\004')
198 /* error reading/writing file */
199 #define RP_FIO (RP_BTNO | RP_CFIL | '\000')
201 /* unable to create file */
202 #define RP_FCRT (RP_BTNO | RP_CFIL | '\001')
204 /* unable to open file */
205 #define RP_FOPN (RP_BTNO | RP_CFIL | '\002')
207 /* general local i/o problem */
208 #define RP_LIO (RP_BTNO | RP_CLIO | '\000')
210 /* resource currently locked */
211 #define RP_LOCK (RP_BTNO | RP_CLIO | '\001')
218 /* bad mechanism/path; try alternate? */
219 #define RP_MECH (RP_BNO | RP_CGEN | '\000')
221 /* general-purpose NO */
222 #define RP_NO (RP_BNO | RP_CGEN | '\001')
224 /* general prototocol error */
225 #define RP_PROT (RP_BNO | RP_CCON | '\000')
227 /* bad reply code (PERMANENT ERROR) */
228 #define RP_RPLY (RP_BNO | RP_CCON | '\001')
230 /* couldn't deliver */
231 #define RP_NDEL (RP_BNO | RP_CMAI | '\000')
233 /* couldn't parse the request */
234 #define RP_HUH (RP_BNO | RP_CSYN | '\000')
236 /* no such command defined */
237 #define RP_NCMD (RP_BNO | RP_CSYN | '\001')
240 #define RP_PARM (RP_BNO | RP_CSYN | '\002')
242 /* command not implemented */
243 #define RP_UCMD (RP_BNO | RP_CSYN | '\003')
246 #define RP_USER (RP_BNO | RP_CUSR | '\000')
250 * Macros to access reply info
253 /* get the entire return value */
254 #define rp_gval(val) ((signed char) (val))
258 * The next three give the field's bits, within the whole value
261 /* get the basic part of return value */
262 #define rp_gbval(val) (rp_gval (val) & RP_BVAL)
264 /* get the domain part of value */
265 #define rp_gcval(val) (rp_gval (val) & RP_CVAL)
267 /* get the specific part of value */
268 #define rp_gsval(val) (rp_gval (val) & RP_SVAL)
272 * The next three give the numeric value withing the field
275 /* get the basic part right-shifted */
276 #define rp_gbbit(val) ((rp_gval (val) >> 6) & 03)
278 /* get the domain part right-shifted */
279 #define rp_gcbit(val) ((rp_gval (val) >> 3) & 07)
281 /* get the specific part right-shifted */
282 #define rp_gsbit(val) (rp_gval (val) & 07)
288 * The following treat the value as strictly numeric.
289 * It relies on the negative values being numerically
293 /* is return value positive? */
294 #define rp_isgood(val) (rp_gval (val) >= 0)
296 /* is return value negative? */
297 #define rp_isbad(val) (rp_gval (val) < 0)