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