"Fossies" - the Fresh Open Source Software Archive 
Member "tin-2.6.2/include/nntplib.h" (23 Dec 2022, 9339 Bytes) of package /linux/misc/tin-2.6.2.tar.xz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "nntplib.h" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
2.6.1_vs_2.6.2.
1 /*
2 * Project : tin - a Usenet reader
3 * Module : nntplib.h
4 * Author : I.Lea
5 * Created : 1991-04-01
6 * Updated : 2022-12-23
7 * Notes : nntp.h 1.5.11/1.6 with extensions for tin
8 *
9 * Copyright (c) 1991-2023 Iain Lea <iain@bricbrac.de>
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 *
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * 3. Neither the name of the copyright holder nor the names of its
24 * contributors may be used to endorse or promote products derived from
25 * this software without specific prior written permission.
26 *
27 * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40
41 #ifndef NNTPLIB_H
42 #define NNTPLIB_H 1
43
44 #ifndef NNTP_SERVER_FILE
45 # define NNTP_SERVER_FILE "/etc/nntpserver"
46 #endif /* !NNTP_SERVER_FILE */
47
48 #define NNTP_TCP_NAME "nntp"
49 #define NNTP_TCP_PORT "119"
50 #define NNTPS_TCP_NAME "nntps"
51 #define NNTPS_TCP_PORT "563"
52
53 /*
54 * # times to try and reconnect to server after timeout
55 */
56 #define NNTP_TRY_RECONNECT 2
57
58 /*
59 * @(#)Header: nntp.h,v 1.81 92/03/12 02:08:31 sob Exp $
60 *
61 * First digit:
62 *
63 * 1xx Informative message
64 * 2xx Command ok
65 * 3xx Command ok so far, continue
66 * 4xx Command was correct, but couldn't be performed
67 * for some specified reason.
68 * 5xx Command unimplemented, incorrect, or a
69 * program error has occurred.
70 *
71 * Second digit:
72 *
73 * x0x Connection, setup, miscellaneous
74 * x1x Newsgroup selection
75 * x2x Article selection
76 * x3x Distribution
77 * x4x Posting
78 */
79 #if 0 /* unused */
80 # define CHAR_INF '1'
81 # define CHAR_OK '2'
82 # define CHAR_CONT '3'
83 # define CHAR_ERR '4'
84 # define CHAR_FATAL '5'
85 #endif /* 0 */
86
87 /* TODO: cleanup against RFC 2980, RFC 3977, RFC 4643, RFC 6048, RFC 8054 */
88 #define INF_HELP 100 /* Help text on way */
89 #define INF_CAPABILITIES 101 /* Capability list follows */
90 #define INF_DATE 111 /* yyyymmddhhmmss Server date and time */
91
92 #define OK_CANPOST 200 /* Hello; you can post */
93 #define OK_NOPOST 201 /* Hello; you can't post */
94 #define OK_EXTENSIONS 202 /* extensions supported follow */
95 #define OK_GOODBYE 205 /* Closing connection */
96 #define OK_COMPRESS 206 /* Compression active */
97 #define OK_GROUP 211 /* Group selected */
98 #define OK_GROUPS 215 /* Newsgroups follow */
99 #define OK_MOTD 215 /* News motd follows */
100
101 #define OK_ARTICLE 220 /* Article (head & body) follows */
102 #define OK_HEAD 221 /* Head follows */
103 #define OK_XHDR 221 /* headers follow */
104 #define OK_XPAT 221 /* headers follow */
105 #define OK_BODY 222 /* Body follows */
106 #define OK_NOTEXT 223 /* No text sent -- stat, next, last */
107 #define OK_XOVER 224 /* .overview data follows */
108 #define OK_HDR 225 /* headers follow */
109 #define OK_NEWNEWS 230 /* New articles by message-id follow */
110 #define OK_NEWGROUPS 231 /* New newsgroups follow */
111 #define OK_XFERED 235 /* Article transferred successfully */
112 #define OK_POSTED 240 /* Article posted successfully */
113 #define OK_AUTHSYS 280 /* Authorization system ok */
114 #define OK_AUTH 281 /* Authorization (user/pass) ok */
115 #define OK_BIN 282 /* binary data follows */
116 #define OK_LIST 282 /* list follows */
117 #define OK_AUTH_SASL 283 /* authentication accepted (with success data) */
118
119 #define CONT_XFER 335 /* Continue to send article */
120 #define CONT_POST 340 /* Continue to post article */
121 #define NEED_AUTHINFO 380 /* authorization is required */
122 #define NEED_AUTHDATA 381 /* <type> authorization data required */
123 #define NEED_AUTHDATA_SASL 383 /* continue with SASL exchange */
124
125 #define ERR_GOODBYE 400 /* Have to hang up for some reason */
126 #define ERR_CONNSTATE 401 /* The client must change the state of the connection */
127 #define ERR_COMPRESS 403 /* Unable to activate compression */
128 #define ERR_NOGROUP 411 /* No such newsgroup */
129 #define ERR_NCING 412 /* Not currently in newsgroup */
130
131 #define ERR_NOCRNT 420 /* No current article selected */
132 #define ERR_NONEXT 421 /* No next article in this group */
133 #define ERR_NOPREV 422 /* No previous article in this group */
134 #define ERR_NOARTIG 423 /* No such article in this group */
135 #define ERR_NOART 430 /* No such article at all */
136 #define ERR_GOTIT 435 /* Already got that article, don't send */
137 #define ERR_XFERFAIL 436 /* Transfer failed */
138 #define ERR_XFERRJCT 437 /* Article rejected, don't resend */
139 #define ERR_NOPOST 440 /* Posting not allowed */
140 #define ERR_POSTFAIL 441 /* Posting failed */
141 #define ERR_NOAUTH 480 /* authorization required for command */
142 #define ERR_AUTHFAIL 481 /* Authentication failed/rejected */
143 #define ERR_AUTHSEQ 482 /* Authentication commands issued out of sequence or SASL protocol error */
144 #define ERR_ENCRYPT 483 /* encryption required */
145
146 #define ERR_COMMAND 500 /* Command not recognized */
147 #define ERR_CMDSYN 501 /* Command syntax error */
148 #define ERR_ACCESS 502 /* Access to server denied */
149 #define ERR_FAULT 503 /* Program fault, command not performed */
150 #define ERR_MOTD 503 /* No news motd file */
151 #define ERR_COMPRESS_ALG 503 /* Compression algorithm not supported */
152 #define ERR_AUTHBAD 580 /* Authorization Failed */
153
154 /*
155 * RFC 977 defines this; don't change it.
156 */
157 #define NNTP_STRLEN 512
158 /*
159 * RFC 3977 3.1
160 */
161 #define NNTP_GRPLEN 497
162
163 /*
164 * OVERVIEW.FMT field types
165 */
166 enum f_type { OVER_T_ERROR, OVER_T_INT, OVER_T_STRING, OVER_T_FSTRING };
167
168 /*
169 * CAPABILITIES
170 * remember to update init.c and nntplib.c:check_extensions() if you change
171 * t_capabilities
172 */
173 enum extension_type { NONE, CAPABILITIES, BROKEN };
174
175 enum sasl_types {
176 SASL_NONE = 0,
177 SASL_PLAIN = 1 << 0,
178 SASL_CRAM_MD5 = 1 << 1,
179 SASL_DIGEST_MD5 = 1 << 2,
180 SASL_GSSAPI = 1 << 3,
181 SASL_EXTERNAL = 1 << 4,
182 SASL_OTP = 1 << 5,
183 SASL_NTLM = 1 << 6,
184 SASL_LOGIN = 1 << 7
185 };
186 enum c_algorithms { COMPRESS_NONE, COMPRESS_DEFLATE };
187
188 struct t_capabilities {
189 enum extension_type type; /* NONE, CAPABILITIES, BROKEN */
190 unsigned int version; /* CAPABILITIES version */
191 t_bool mode_reader:1; /* MODE-READER: "MODE READER" */
192 t_bool reader:1; /* READER: "ARTICLE", "BODY", "DATE", "GROUP", "LAST", "LISTGROUP", "NEWGROUPS", "NEXT" */
193 t_bool post:1; /* POST */
194 t_bool list_active:1; /* LIST ACTIVE */
195 t_bool list_active_times:1; /* LIST ACTIVE.TIMES, optional */
196 t_bool list_distrib_pats:1; /* LIST DISTRIB.PATS, optional */
197 t_bool list_headers:1; /* LIST HEADERS */
198 char *headers_range; /* list of headers by range */
199 char *headers_id; /* list of headers by id */
200 t_bool list_newsgroups:1; /* LIST NEWSGROUPS */
201 t_bool list_overview_fmt:1; /* LIST OVERVIEW.FMT */
202 t_bool list_motd:1; /* LIST MOTD, "private" extension */
203 t_bool list_subscriptions:1; /* LIST SUBSCRIPTIONS, "private" extension, RFC 2980 */
204 t_bool list_distributions:1; /* LIST DISTRIBUTIONS, "private" extension, RFC 2980 */
205 t_bool list_moderators:1; /* LIST MODERATORS, "private" extension */
206 t_bool list_counts:1; /* LIST COUNTS, "private" extension */
207 t_bool xpat:1; /* XPAT, "private" extension, RFC 2980 */
208 t_bool hdr:1; /* HDR: "HDR", "LIST HEADERS" */
209 const char *hdr_cmd; /* [X]HDR */
210 t_bool over:1; /* OVER: "OVER", "LIST OVERVIEW.FMT" */
211 t_bool over_msgid:1; /* OVER: "OVER mid" */
212 const char *over_cmd; /* [X]OVER */
213 t_bool newnews:1; /* NEWNEWS */
214 char *implementation; /* IMPLEMENTATION */
215 t_bool starttls:1; /* STARTTLS */
216 t_bool authinfo_user:1; /* AUTHINFO USER/PASS */
217 t_bool authinfo_sasl:1; /* AUTHINFO SASL */
218 t_bool authinfo_state:1; /* AUTHINFO not supported in current state */
219 enum sasl_types sasl; /* SASL_NONE, SASL_PLAIN, SASL_CRAM_MD5, SASL_DIGEST_MD5, SASL_GSSAPI, SASL_EXTERNAL, SASL_OTP, SASL_NTLM, SASL_LOGIN */
220 t_bool compress:1; /* COMPRESS */
221 enum c_algorithms compress_algorithm; /* COMPRESS_NONE, COMPRESS_DEFLATE */
222 #if defined(MAXARTNUM) && defined(USE_LONG_ARTICLE_NUMBERS)
223 t_artnum maxartnum; /* MAXARTNUM indicating article numbers >=2^31 */
224 #endif /* MAXARTNUM && USE_LONG_ARTICLE_NUMBERS */
225 #if 0
226 /* we don't do MODE STREAM, CHECK, TAKETHIS or IHAVE*/
227 t_bool streaming:1; /* STREAMING: "MODE STREAM", "CHECK", "TAKETHIS" */
228 t_bool ihave:1; /* IHAVE: "IHAVE" */
229 #endif /* 0 */
230 t_bool broken_listgroup:1; /* LISTGROUP doesn't select newsgroup */
231 };
232
233 #endif /* !NNTPLIB_H */