]> diplodocus.org Git - nmh/blob - mts/smtp/smtp.h
8b6b32c0db42faf8a9822ea4206f2f03bd33622b
[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 /* TLS flags */
20 #define S_STARTTLS 0x01
21 #define S_INITTLS 0x02
22 #define S_TLSENABLEMASK 0x03
23 #define S_NOVERIFY 0x04
24 int sm_init (char *, char *, char *, int, int, int, int, const char *,
25 const char *, const char *, int);
26 int sm_winit (char *, int, int);
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_BOK '\000' /* went fine; all done */
103 #define RP_BPOK '\100' /* only the first part got done */
104 #define RP_BTNO '\200' /* temporary failure; try later */
105 #define RP_BNO '\300' /* not now, nor never; you lose */
106
107 /* FIELD 2: Basic domain of discourse (3-bits) */
108
109 #define RP_CSYN '\000' /* purely a matter of form */
110 #define RP_CGEN '\010' /* couldn't find anywhere else for it */
111 #define RP_CCON '\020' /* data-transfer-related issue */
112 #define RP_CUSR '\030' /* pertaining to the user */
113 #define RP_CMAI '\040' /* specific to mail semantics */
114
115
116 /*
117 * SPECIFIC SUCCESS VALUES
118 */
119
120 /*
121 * Complete Success
122 */
123
124 /* general-purpose OK */
125 #define RP_OK (RP_BOK | RP_CGEN | '\001')
126
127 /* message is accepted (w/text) */
128 #define RP_MOK (RP_BOK | RP_CMAI | '\000')
129
130
131 /*
132 * Partial Success
133 */
134
135 /* message address is accepted */
136 #define RP_AOK (RP_BPOK| RP_CMAI | '\000')
137
138
139 /*
140 * SPECIFIC FALURE VALUES
141 */
142
143 /*
144 * Partial Failure
145 */
146
147 /* foreign host screwed up */
148 #define RP_BHST (RP_BTNO | RP_CCON | '\001')
149
150
151 /*
152 * Complete Failure
153 */
154
155 /* general-purpose NO */
156 #define RP_NO (RP_BNO | RP_CGEN | '\001')
157
158 /* bad reply code (PERMANENT ERROR) */
159 #define RP_RPLY (RP_BNO | RP_CCON | '\001')
160
161 /* couldn't deliver */
162 #define RP_NDEL (RP_BNO | RP_CMAI | '\000')
163
164 /* bad parameter */
165 #define RP_PARM (RP_BNO | RP_CSYN | '\002')
166
167 /* command not implemented */
168 #define RP_UCMD (RP_BNO | RP_CSYN | '\003')
169
170 /* unknown user */
171 #define RP_USER (RP_BNO | RP_CUSR | '\000')
172
173
174 /*
175 * MACHINE DEPENDENCY
176 *
177 * The following treat the value as strictly numeric.
178 * It relies on the negative values being numerically
179 * negative.
180 */
181
182 /* is return value negative? */
183 #define rp_isbad(val) (((signed char)(val)) < 0)
184