1 #ifndef CHILD_H 2 #define CHILD_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 /* Child's representation of itself */ 24 25 26 #ifndef COMMON_H 27 #include "common.h" 28 #endif 29 30 #ifndef INTERCOM_H 31 #include "intercom.h" 32 #endif 33 34 #ifndef PIPELINE_DEPTH 35 #define PIPELINE_DEPTH 4 36 #elif (PIPELINE_DEPTH < 1) 37 #undef PIPELINE_DEPTH 38 #define PIPELINE_DEPTH 1 39 #endif 40 41 struct ChildData { 42 char *server; 43 IntercomQ *in_q; /* For reading messages to us */ 44 Intercom *intercom; 45 IntercomQ *out_q; /* For sending messages to parent */ 46 rw_buf *sbuf; /* For NNTP socket */ 47 char *path; 48 49 BOOL path_done, all_requested; 50 BOOL pipeline; 51 BOOL ignore_436; 52 53 int thread_idx; 54 int pipeline_depth; 55 long int rq_group_ix; /* Group to request articles from */ 56 57 #if ENABLE_ICONV 58 const char *to_charset; 59 const char *from_charset; 60 const char *ole_charset; 61 const char *transfer_encoding; 62 #define ICONV_NULL NULL, NULL, NULL, NULL, 63 #else 64 #define ICONV_NULL 65 #endif 66 67 long int group_ix[PIPELINE_DEPTH]; 68 long int artnum[PIPELINE_DEPTH]; 69 BOOL change_group[PIPELINE_DEPTH]; 70 BOOL backfill[PIPELINE_DEPTH]; 71 BOOL sent_quit; 72 char *path_filter_line; 73 }; 74 75 #define CHILD_NULL { \ 76 NULL, NULL, NULL, NULL, NULL, NULL, \ 77 FALSE, FALSE, TRUE, FALSE, \ 78 0, 0, -1, \ 79 ICONV_NULL \ 80 {0}, {0}, {0}, {0}, \ 81 FALSE, \ 82 NULL \ 83 } 84 85 void child_start(int thread_idx, IntercomQ *in_q, IntercomQ *out_q); 86 87 /* Declared so rw can send stats */ 88 void child_send_command(ChildData *child_data, 89 intercom_Command code, const char *data, ...); 90 91 ChildData *child_data_from_index(int thread_idx); 92 93 #if USE_PTHREADS 94 int child_lookup_current_thread_idx(void); 95 #endif 96 97 #endif /* CHILD_H */ 98