chiark / gitweb /
xfoo => mfoo, rename
[innduct.git] / innfeed / innlistener.h
1 /*  $Id: innlistener.h 6648 2004-01-25 20:07:11Z rra $
2 **
3 **  The public interface to the InnListener class.
4 **
5 **  Written by James Brister <brister@vix.com>
6 **
7 **  The public interface of the things that listens to commands from INN. It
8 **  receives lines of the form:
9 **
10 **      filename msgid peer1 peer2 peer3
11 **
12 **  and turns them into Article objects and hands those Articles off to the
13 **  Host objects.
14 */
15
16 #if ! defined ( innlistener_h__ )
17 #define innlistener_h__
18
19 #include <stdio.h>
20
21 #include "misc.h"
22
23
24 extern InnListener mainListener ;
25
26 /* Initialization of the InnListener object. If it fails then returns
27   NULL. ENDPOINT is the endpoint where the article info will come
28   from. A dummy listener exists when processing backlog files and is
29   there just to help drive the process. */
30 InnListener newListener (EndPoint endp, bool isDummy, bool dynamicPeers) ;
31
32 /* print some useful debugging information about the Listener and all its
33  * Hosts and all their Connecitons/Article/Buffers etc. to the given FILE.
34  */
35 void gPrintListenerInfo (FILE *fp, unsigned int indentAmt) ;
36 void printListenerInfo (InnListener listener, FILE *fp, unsigned int indentAmt) ;
37
38 /* Called by the Host when it is about to delete itself */
39 unsigned int listenerHostGone (InnListener listener, Host host) ;
40
41 /* Called to hook up the given Host to the Listener. */
42 bool listenerAddPeer (InnListener listener, Host hostObj) ;
43
44 /* true if the listener is a dummy. */
45 bool listenerIsDummy (InnListener listener) ;
46
47 /*
48  * This gets called to stop accepting new articles from innd. Typically
49  * called by the signal handler, or when the listener gets EOF on its input
50  * (in channel mode)
51  */
52 void shutDown (InnListener cxn) ;
53
54 /* Callback fired after config file is loaded */
55 int listenerConfigLoadCbk (void *data) ;
56
57   /* stop a specific host. */
58 void shutDownHost (InnListener cxn, const char *peerName) ;
59
60   /* Called by the Host when it has nothing to do (so it can be shut down
61      if necessary). */
62 void listenerHostIsIdle (InnListener listener, Host host) ;
63
64 void openInputFile (void) ;
65
66 void openDroppedArticleFile (void) ;
67 void closeDroppedArticleFile (void) ;
68
69 void listenerLogStatus (FILE *fp) ;
70
71 #endif /* innlistener_h__ */