1 #ifndef NNTP_H 2 #define NNTP_H 3 4 /* 5 newsstar - advanced news fetcher 6 Copyright (C) 2001-2002 Tony Houghton <h@realh.co.uk> 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22 23 /* For communicating with NNTP server */ 24 25 #include <sys/types.h> 26 #include <sys/socket.h> 27 #include <netdb.h> 28 29 #ifndef DEBLOG_H 30 #include "deblog.h" 31 #endif 32 #ifndef RW_H 33 #include "rw.h" 34 #endif 35 36 /* Not strictly NNTP, but... (port is in machine byte order) */ 37 BOOL nntp_resolve_address(const char *addr_name, int port, 38 struct sockaddr **p_addr, size_t *p_len, int *p_proto); 39 40 /* Returns response or NULL if problem. message should contain %s for response, 41 * but no trailing \n or : . allow contains each character allowed at start of 42 * response eg "23". log_level is level at which any problems are reported. */ 43 const char *nntp_check_response(rw_buf *, const char *server_name, 44 const char *message, const char *allow, deblog_level_t log_level); 45 46 /* Returns buffered socket */ 47 rw_buf *nntp_connect(const char *server_name, struct sockaddr *addr, 48 size_t addr_len, int proto, int thread_idx, BOOL ssl); 49 50 /* Returns TRUE if there's a problem */ 51 BOOL nntp_authenticate(rw_buf *, const char *server_name, 52 const char *user, const char *passwd); 53 54 /* Returns TRUE if there's a problem; mode is "STREAM" or "READER" */ 55 BOOL nntp_set_mode(rw_buf *, const char *server_name, const char *mode); 56 57 /* Returns TRUE if there's a problem, otherwise fills in first and last 58 * available article numbers (both must be non-NULL for either to be filled in 59 */ 60 BOOL nntp_enter_group(rw_buf *, const char *server_name, const char *groupname, 61 long int *first, long int *last, BOOL check_response); 62 63 #endif /* NNTP_H */ 64