chiark / gitweb /
check fd watches; other bugfixes
[inn-innduct.git] / innfeed / article.h
1 /*  $Id: article.h 6648 2004-01-25 20:07:11Z rra $
2 **
3 **  The public interface to articles.
4 **
5 **  Written by James Brister <brister@vix.com>
6 **
7 **  The public interface to articles. The articles are implemented via
8 **  reference counting.  This interface provides the methods for getting the
9 **  contents of the article.
10 **
11 **  When an Article is created there's a chance that another copy of it
12 **  already exists.  For example if the Article is pulled out of a Tape for a
13 **  particular host it may already be in existance in some other host.  This
14 **  class will manage this situation to prevent multiple copies of the article
15 **  being in core.
16 */
17
18 #if ! defined ( article_h__ )
19 #define article_h__
20
21 #include <stdio.h>
22
23 #include "misc.h"
24
25
26   /* Create a new Article object. FILENAME is the path of the file the */
27   /* article is in. MSGID is the news message id of the article */
28 Article newArticle (const char *filename, const char *msgid) ;
29
30   /* delete the given article. Just decrements refcount and then FREEs if the
31      refcount is 0. */
32 void delArticle (Article article) ;
33
34 void gPrintArticleInfo (FILE *fp, unsigned int indentAmt) ;
35
36   /* print some debugging info about the article. */
37 void printArticleInfo (Article art, FILE *fp, unsigned int indentAmt) ;
38
39   /* return true if this article's file still exists. */
40 bool artFileIsValid (Article article) ;
41
42   /* return true if we have the article's contents (calling this may trigger
43      the reading off the disk). */
44 bool artContentsOk (Article article) ;
45
46   /* increments reference count and returns a copy of article that can be
47      kept (or passed off to someone else) */
48 Article artTakeRef (Article article) ;
49
50   /* return the pathname of the file the article is in. */
51 const char *artFileName (Article article) ;
52
53   /* return a list of buffers suitable for giving to an endpoint. The return
54      value can (must) be given to freeBufferArray */
55 Buffer *artGetNntpBuffers (Article article) ;
56
57   /* return the message id stoed in the article object */
58 const char *artMsgId (Article article) ;
59
60   /* return size of the article */
61 int artSize (Article article) ;
62
63   /* return the number of buffers that artGetNntpBuffers() would return. */
64 unsigned int artNntpBufferCount (Article article) ;
65
66   /* tell the Article class to log (or not) missing articles as they occur. */
67 void artLogMissingArticles (bool val) ;
68
69   /* if VAL is true, then when an article is read off disk the necesary
70      carriage returns are inserted instead of setting up iovec-style buffers
71      for writev. Useful for systems like solaris that have very small max
72      number of iovecs that writev can take. Must be called only once before
73      the first article is created.  */
74 void artBitFiddleContents (bool val) ;
75
76   /* set the limit on the number of bytes in all articles (this is not a hard
77      limit). Can only be called one time before any articles are created. */
78 void artSetMaxBytesInUse (unsigned int val) ;
79
80 #endif /* article_h__ */