annotate protocol.h @ 0:04124a4423d4 noffle

[svn] Initial revision
author enz
date Tue, 04 Jan 2000 11:35:42 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
1 /*
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
2 protocol.h
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
3
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
4 Functions related with the NNTP protocol which are useful for both
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
5 the server and the client.
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
6
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
7 $Id: protocol.h 3 2000-01-04 11:35:42Z enz $
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
8 */
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
9
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
10 #ifndef PRT_H
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
11 #define PRT_H
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
12
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
13 #include "dynamicstring.h"
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
14 #include "over.h"
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
15
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
16 #define STAT_HELP_FOLLOWS 100
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
17 #define STAT_DEBUG_FOLLOWS 199
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
18
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
19 #define STAT_READY_POST_ALLOW 200
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
20 #define STAT_READY_NO_POST_ALLOW 201
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
21 #define STAT_CMD_OK 202
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
22 #define STAT_GOODBYE 205
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
23 #define STAT_GRP_SELECTED 211
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
24 #define STAT_GRPS_FOLLOW 215
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
25 #define STAT_ART_FOLLOWS 220
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
26 #define STAT_HEAD_FOLLOWS 221
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
27 #define STAT_BODY_FOLLOWS 222
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
28 #define STAT_ART_RETRIEVED 223
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
29 #define STAT_OVERS_FOLLOW 224
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
30 #define STAT_NEW_GRP_FOLLOW 231
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
31 #define STAT_POST_OK 240
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
32 #define STAT_AUTH_ACCEPTED 281
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
33
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
34 #define STAT_SEND_ART 340
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
35 #define STAT_MORE_AUTH_REQUIRED 381
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
36
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
37 #define STAT_NO_SUCH_GRP 411
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
38 #define STAT_NO_GRP_SELECTED 412
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
39 #define STAT_NO_ART_SELECTED 420
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
40 #define STAT_NO_NEXT_ART 421
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
41 #define STAT_NO_PREV_ART 422
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
42 #define STAT_NO_SUCH_NUMB 423
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
43 #define STAT_NO_SUCH_ID 430
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
44 #define STAT_ART_REJECTED 437
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
45 #define STAT_POST_FAILED 441
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
46 #define STAT_AUTH_REQUIRED 480
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
47 #define STAT_AUTH_REJECTED 482
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
48
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
49 #define STAT_NO_SUCH_CMD 500
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
50 #define STAT_SYNTAX_ERR 501
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
51 #define STAT_NO_PERMISSION 502
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
52 #define STAT_PROGRAM_FAULT 503
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
53
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
54 /*
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
55 Read next line from f into Str, up to "\n" or "\r\n". Don't save "\n"
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
56 or "\r\n" in line. Terminate with '\0'.
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
57 */
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
58 Bool
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
59 Prt_getLn( Str line, FILE *f );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
60
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
61 /*
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
62 Read a text line from server. Returns TRUE if line != ".", removes
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
63 leading '.' otherwise.
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
64 */
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
65 Bool
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
66 Prt_getTxtLn( Str line, Bool *err, FILE *f );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
67
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
68 /*
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
69 Write text line to f. Escape "." at the beginning with another ".".
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
70 Terminate with "\r\n".
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
71 */
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
72 Bool
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
73 Prt_putTxtLn( const char* line, FILE *f );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
74
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
75 /*
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
76 Write text buffer of lines each ending with '\n'.
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
77 Replace '\n' by "\r\n".
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
78 */
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
79 Bool
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
80 Prt_putTxtBuf( const char *buf, FILE *f );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
81
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
82 /*
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
83 Write text-ending "."-line to f
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
84 */
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
85 Bool
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
86 Prt_putEndOfTxt( FILE *f );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
87
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
88 /*
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
89 Splits line in field and value. Field is converted to lower-case.
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
90 */
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
91 Bool
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
92 Prt_getField( Str resultField, Str resultValue, const char* line );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
93
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
94 /* Search header. Works only with single line headers (ignores continuation
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
95 lines */
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
96 Bool
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
97 Prt_searchHeader( const char *artTxt, const char* which, Str result );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
98
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
99 Bool
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
100 Prt_isValidMsgId( const char *msgId );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
101
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
102 void
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
103 Prt_genMsgId( Str msgId, const char *from, const char *suffix );
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
104
04124a4423d4 [svn] Initial revision
enz
parents:
diff changeset
105 #endif