]> diplodocus.org Git - nmh/blob - mts/smtp/smtp.h
d73a643820fbeb6ac1d6ef91f77ea722c0e3bb9b
[nmh] / mts / smtp / smtp.h
1 /*
2 * smtp.h -- definitions for the nmh SMTP Interface
3 */
4
5 /* length is the length of the string in text[], which is also NUL
6 * terminated, so s.text[s.length] should always be 0.
7 */
8 struct smtp {
9 int code;
10 int length;
11 char text[BUFSIZ];
12 };
13
14 /*
15 * prototypes
16 */
17 /* int client (); */
18 /* TLS flags */
19 #define S_STARTTLS 0x01
20 #define S_INITTLS 0x02
21 #define S_TLSENABLEMASK 0x03
22 #define S_NOVERIFY 0x04
23 int sm_init (char *, char *, char *, int, int, int, int, const char *,
24 const char *, const char *, int);
25 int sm_winit (char *, int, int);
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 /* The remainder of this file is derived from "mmdf.h" */
34
35 /*
36 * Copyright (C) 1979,1980,1981,1982,1983 University of Delaware
37 * Used by permission, May, 1984.
38 */
39
40 /*
41 * MULTI-CHANNEL MEMO DISTRIBUTION FACILITY (MMDF)
42 *
43 *
44 * Copyright (C) 1979,1980,1981,1982,1983 University of Delaware
45 *
46 * Department of Electrical Engineering
47 * University of Delaware
48 * Newark, Delaware 19711
49 *
50 * Phone: (302) 738-1163
51 *
52 *
53 * This program module was developed as part of the University
54 * of Delaware's Multi-Channel Memo Distribution Facility (MMDF).
55 *
56 * Acquisition, use, and distribution of this module and its listings
57 * are subject restricted to the terms of a license agreement.
58 * Documents describing systems using this module must cite its source.
59 *
60 * The above statements must be retained with all copies of this
61 * program and may not be removed without the consent of the
62 * University of Delaware.
63 *
64 */
65
66 /* Reply Codes for MMDF
67 *
68 * Based on: "Revised FTP Reply Codes", by Jon Postel & Nancy Neigus Arpanet
69 * RFC 640 / NIC 30843, in the "Arpanet Protocol Handbook", E. Feinler
70 * and J. Postel (eds.), NIC 7104, Network Information Center, SRI
71 * International: Menlo Park, CA. (NTIS AD-A0038901)
72 *
73 * Actual values are different, but scheme is same. Codes must fit into
74 * 8-bits (to pass on exit() calls); fields are packed 2-3-3 and interpreted
75 * as octal numbers.
76 *
77 * Basic format:
78 *
79 * 0yz: positive completion; entire action done
80 * 1yz: positive intermediate; only part done
81 * 2yz: Transient negative completion; may work later
82 * 3yz: Permanent negative completion; you lose forever
83 *
84 * x0z: syntax
85 * x1z: general; doesn't fit any other category
86 * x2z: connections; truly transfer-related
87 * x3z: user/authentication/account
88 * x4x: mail
89 * x5z: file system
90 *
91 * 3-bit z field is unique to the reply. In the following,
92 * the RP_xVAL defines are available for masking to obtain a field.
93 */
94
95 /*
96 * FIELD DEFINITIONS & BASIC VALUES
97 */
98
99 /* FIELD 1: Basic degree of success (2-bits) */
100
101 #define RP_BOK '\000' /* went fine; all done */
102 #define RP_BPOK '\100' /* only the first part got done */
103 #define RP_BTNO '\200' /* temporary failure; try later */
104 #define RP_BNO '\300' /* not now, nor never; you lose */
105
106 /* FIELD 2: Basic domain of discourse (3-bits) */
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
114
115 /*
116 * SPECIFIC SUCCESS VALUES
117 */
118
119 /*
120 * Complete Success
121 */
122
123 /* general-purpose OK */
124 #define RP_OK (RP_BOK | RP_CGEN | '\001')
125
126 /* message is accepted (w/text) */
127 #define RP_MOK (RP_BOK | RP_CMAI | '\000')
128
129
130 /*
131 * Partial Success
132 */
133
134 /* message address is accepted */
135 #define RP_AOK (RP_BPOK| RP_CMAI | '\000')
136
137
138 /*
139 * SPECIFIC FALURE VALUES
140 */
141
142 /*
143 * Partial Failure
144 */
145
146 /* foreign host screwed up */
147 #define RP_BHST (RP_BTNO | RP_CCON | '\001')
148
149
150 /*
151 * Complete Failure
152 */
153
154 /* general-purpose NO */
155 #define RP_NO (RP_BNO | RP_CGEN | '\001')
156
157 /* bad reply code (PERMANENT ERROR) */
158 #define RP_RPLY (RP_BNO | RP_CCON | '\001')
159
160 /* couldn't deliver */
161 #define RP_NDEL (RP_BNO | RP_CMAI | '\000')
162
163 /* bad parameter */
164 #define RP_PARM (RP_BNO | RP_CSYN | '\002')
165
166 /* command not implemented */
167 #define RP_UCMD (RP_BNO | RP_CSYN | '\003')
168
169 /* unknown user */
170 #define RP_USER (RP_BNO | RP_CUSR | '\000')
171
172
173 /*
174 * MACHINE DEPENDENCY
175 *
176 * The following treat the value as strictly numeric.
177 * It relies on the negative values being numerically
178 * negative.
179 */
180
181 /* is return value negative? */
182 #define rp_isbad(val) (((signed char)(val)) < 0)