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