Back to index

courier  0.68.2
libfilter.h
Go to the documentation of this file.
00001 #ifndef       libfilter_h
00002 #define       libfilter_h
00003 
00004 /*
00005 ** Copyright 2000 Double Precision, Inc.
00006 ** See COPYING for distribution information.
00007 */
00008 
00009 
00010 #ifdef  __cplusplus
00011 extern "C" {
00012 #endif
00013 
00014 /*
00015 
00016 Create and initialize the filesystem socket used to accept filtering requests.
00017 Typically we have a configuration file (modfile), then specifies whether
00018 everything or just the selected mail sources are filtered.
00019 
00020 lf_init reads modfile, then creates either "allname", which should be a
00021 complete pathname to $(allfiltersocketdir), or "notallname", which should be a
00022 complete pathname to $(filtersocketdir).
00023 
00024 alltmpname and notalltmpname are temporary names, in the corresponding
00025 directories (beginning with a .), that are used to create the socket.
00026 
00027 lf_init() returns a non-zero file descriptor, or -1 for error.
00028 
00029 See dupfilter.c for example usage.
00030 
00031 */
00032 
00033 int lf_init(const char *modfile,
00034               const char *allname,
00035               const char *alltmpname,
00036               const char *notallname,
00037               const char *notalltmpname);
00038 
00039 /*
00040 
00041 After success in lf_init, the filter may do some additional initialization,
00042 then call lf_init_completed(), passing the opened file descriptor from lf_init.
00043 
00044 lf_init_completed closes the file descriptor #3, which is a signal to
00045 filterctl that initialization has been completed.
00046 
00047 */
00048 
00049 void lf_init_completed(int);
00050 
00051 /*
00052 
00053 lf_accept is used to accept a new connection to the filter.
00054 
00055 If lf_accept returns <0, the system is shutting down.
00056 
00057 */
00058 
00059 int lf_accept(int);
00060 
00061 /*
00062 
00063 You will now read the following from the file descriptor returned by lf_accept:
00064 
00065 1) The pathname to the file containing the contents of the message to filter,
00066    followed by a newline.
00067 
00068 2) One or more pathnames to files containing message control files.
00069    Each pathname is terminated by a newline
00070 
00071 3) A newline character (empty pathname).
00072 
00073 ** YOU MUST read all of the above information, even if you do not need to read
00074    the contents of the control files.
00075 
00076 After reading the last newline, you write one of the following messages to
00077 the file descriptor:
00078 
00079 200 Ok<NL>
00080 
00081 500 Error message<NL>
00082 
00083 Then close the descriptor.
00084 
00085 */
00086 
00087 #ifdef  __cplusplus
00088 }
00089 #endif
00090 
00091 #endif