From f28cab2d1c44ac253133ba142f3f70ddd1bdf482 Mon Sep 17 00:00:00 2001 From: Stuart Gathman Date: Thu, 18 Apr 2013 04:06:02 +0000 Subject: [PATCH] Doc updates --- doc/mainpage.py | 25 ++++++++++++++----------- doc/milter.py | 30 ++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/doc/mainpage.py b/doc/mainpage.py index c533379..5adcb6e 100644 --- a/doc/mainpage.py +++ b/doc/mainpage.py @@ -7,30 +7,32 @@ # events include the initial connection from a MTA, the envelope sender and # recipients, the top level mail headers, and the message body. There are # options to mangle all of these components of the message as it passes through -# the milter. +# the %milter. # # At the next level, the Milter module (note the case difference) # provides a Python friendly object oriented wrapper for the low level API. To # use the Milter module, an application registers a 'factory' to create an # object for each connection from a MTA to sendmail. These connection objects -# must provide methods corresponding to the libmilter callback events. +# must provide methods corresponding to the libmilter event callbacks. # -# Each event method returns a code to tell sendmail whether to proceed with +# Each callback method returns a code to tell sendmail whether to proceed with # processing the message. This is a big advantage of milters over other mail # filtering systems. Unwanted mail can be stopped in its tracks at the -# earliest possible point. +# earliest possible point. The callback return codes are +# milter.CONTINUE, milter.REJECT, milter.DISCARD, milter.ACCEPT, +# milter.TEMPFAIL, milter.SKIP, milter.NOREPLY. # -# The Milter.Base class provides default implementations for +# The Milter.Base class provides default implementations for # event methods that do nothing, and also provides wrappers for the libmilter # methods to mutate the message. It automatically negotiates with MTA -# which protocol steps need to be processed by the milter, based on +# which protocol steps need to be processed by the %milter, based on # which callback methods are overridden. # -# The Milter.Milter class provides an alternate default -# implementation that logs the main milter events, but otherwise does nothing. -# It is provided for compatibility. +# The Milter.Milter class provides an alternate default +# implementation that logs the main milter callbacks, but otherwise does +# nothing. It is provided for compatibility. # -# The mime module provides a wrapper for the Python email package +# The mime module provides a wrapper for the Python email package # that fixes some bugs, and simplifies modifying selected parts of a MIME # message. # @@ -50,4 +52,5 @@ # You may find the # # multiprocessing module useful. It can be a drop-in -# replacement for threading as illustrated in milter-template. +# replacement for threading as illustrated in +# milter-template.py. diff --git a/doc/milter.py b/doc/milter.py index 528baae..9954067 100644 --- a/doc/milter.py +++ b/doc/milter.py @@ -3,7 +3,10 @@ ## @package milter # -# A thin wrapper around libmilter. +# A thin wrapper around libmilter. Most users will not import +# milter directly, but will instead import Milter and subclass +# Milter.Base. This module gives you ultimate low level control +# from python. # ## Continue processing the current connection, message, or recipient. @@ -169,6 +172,16 @@ def set_exception_policy(code): pass # xxfi_data callback, called when the DATA # SMTP command is received. def register(name,negotiate=None,unknown=None,data=None): pass + +## Attempt to create the socket used to communicate with the MTA. +# milter.opensocket() attempts to create the socket specified previously by a +# call to milter.setconn() which will be the interface between MTAs and the +# %milter. This allows the calling application to ensure that the socket can be +# created. If this is not called, milter.main() will do so implicitly. +# Calls +# smfi_opensocket. While not documented for libmilter, my experiments +# indicate that you must call register() before calling opensocket(). +# @param rmsock Try to remove an existing unix domain socket if true. def opensocket(rmsock): pass ## Transfer control to libmilter. @@ -199,12 +212,17 @@ def setbacklog(n): pass # unix, inet, or inet6 socket. By default, a unix domain socket # is used. It must not exist, # and sendmail will throw warnings if, eg, the file is under a -# group or world writable directory. +# group or world writable directory. milter.setconn() will not fail with +# an invalid socket - this will be detected only when calling milter.main() +# or milter.opensocket(). +# @param s the socket address in proto:address format #
-# setconn('unix:/var/run/pythonfilter')
-# setconn('inet:8800') 			# listen on ANY interface
-# setconn('inet:7871@@publichost')	# listen on a specific interface
-# setconn('inet6:8020')
+# milter.setconn('unix:/var/run/pythonfilter')  # a named pipe
+# milter.setconn('local:/var/run/pythonfilter') # a named pipe
+# milter.setconn('inet:8800') 			# listen on ANY interface
+# milter.setconn('inet:7871@@publichost')	# listen on a specific interface
+# milter.setconn('inet6:8020')
+# milter.setconn('inet6:8020@[2001:db8:1234::1]')      # listen on specific IP
 # 
def setconn(s): pass