1 
2 #ifndef EL__PROTOCOL_NNTP_RESPONSE_H
3 #define EL__PROTOCOL_NNTP_RESPONSE_H
4 
5 #include "protocol/nntp/connection.h"
6 
7 struct connection;
8 struct read_buffer;
9 
10 /* Reads multi-lined response data */
11 /* Slightly abusive usage of connection state to signal what is going on
12  * or what went wrong:
13  * S_TRANS (transferring) means 'end-of-text' not reached yet
14  * S_OK 		  means no more text expected
15  * S_OUT_OF_MEM		  allocation failure of some sort */
16 enum connection_state
17 read_nntp_response_data(struct connection *conn, struct read_buffer *rb);
18 
19 /* Reads the first line in the NNTP response from the @rb read buffer and
20  * returns the response code. */
21 /* Returns:
22  * NNTP_CODE_NONE	if no \r\n ended line could be read and another
23  *			check should be rescheduled.
24  * NNTP_CODE_INVALID	if the response code is not within the range
25  *			100 - 599 of valid codes. */
26 enum nntp_code
27 get_nntp_response_code(struct connection *conn, struct read_buffer *rb);
28 
29 #endif
30