[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Router lanaguage




Hi,

I've started to re-read the ZMOG (Zmailer Op Guide) for the 3rd time
since I printed it <grin> and still having problems understanding the
routing configuration language.  I'm perfectly happy with message
submission, scheduler pickup/handling/configuration and TA spawning/control
protocol (ala #idle/#hungry).

I would also like to say I'm am very happy with programing Bourne shell
scripts, Perl 4 and 5 program and also C or C++ programs.  But some of
the key parts of the router configuration language still baffle me.

Some of these points are interrelated so reading all the mail first before
reply to parts maybe better.  (If you can stay with me that is <grin>)


*  The function flow control (calling, mainly parameter passing and
   return values).

	Regular scripts use funcname(param1, param2) and within the
	function have $1, $2, ... set to the paramters.

	The use of "uucproute" function in rrouter.cf seems to call
	it with $(uucproute param1 param2), and within the function
	you list the envvar names you want each paramter assigned to.
	But I have reason to believe the first word (label) after the
	opening $( construct may dictate other things.  Like using a
	keyword? a relation name?  What are the rules on this?

	I believe the command 'db' is a built in, yet this is called and
	used like you would an external command, not with
	constructs like $(db flush foobar) (okay flush maynot return a
	value!)  so that would the diffence be between "db count foobar"
	and $(db count foobar) ?

	Maybe the $( construct does something special to the return
	value.  i.e. when $(uucproute param1 param2) is used its a bit
	like `uucproute param1 param2` ?

*  The next part is multiple paramters passed as a group (a quad)
   and somehow you can throw the group of data around collectivly
   using one variable name.  A bit like pointers to structures in C, but
   I think they work more like associative arrays in Perl (for access).
   But I'm not sure if the key is only a positional paramter or a
   name you may assign.

   I'm not completely sure how to read, set, test for existance (maybe read
   and compare could achieve this) these associative arrys (if I call
   them this).  I believe maybe 'set' and/or 'setf' come into play with
   these somehow.  

   Also can you dump all associative variables out, then all the keys and
   then with each of these all the data values, without having to know the
   names of anything (a but like the keys/data keywords in perl).  Ok I
   admit with Perl you can't get the collective variable name of the
   associative array.

   What is the verbatim names of those used by stock zmailer, the collective
   name, and then the keys used in this collective.  Page 24 of ZMOG
   indicates some of these, I'm happy with the verbatim "field name" but
   the Class confuses me.  As in yes the To: message header line has one
   address, but the envelope (Rcpt To:<> - SMTP premable) can have something
   completely different.  Same with From: (and Mail From:<>) the class
   indicates these are retained independantly (Sender/Recipient/Envelope), but
   not how to access them.

   Does any of this make sense? <grin> Since my understanding maybe
   complete out.

*  Syntaxes like $(something somethingelse xyz) and
   $(something $somethingelse xxx) confuse me.  What significance does
   the $ disn have in the middle variable (or the last).

   in rrouter.cf:


   envelopeinfo=(message-id "<$USER.interactive@$hostname>" now 0)

   I'm taking an educated guess that the equivalent perl code would go
   something like:

   $envelopeinfo{'message-id'} = "<$USER.interactive@$hostname>";
   $envelopeinfo{'now'} = 0;


   Then we have:

   tmp="$(/bin/expr $(get envelopeinfo now) + "\1")"

   Ignoring the 'expr' use (I'm not sure why "\001" which my expr
   complaints with "non-numeric argument".  Unless zmailer translates
   "\1" into "1", then why use the \ ?

   $tmp = $envelopeinfo{'message-id'};


   in crossbar.cf:


   The function definition.

   crossbar(from, to) { }

   From that I gather these are collective quads, i.e. like passing a
   pointer to a structre (with 4 members) in C, or passing the parameter
   %from, %to in Perl.

   Now accessing them appears to be done by:

   $(user $from)
   $(channel $to)

   This is different to $(get from user) or $(get to channel).

   What is a function called 'user' or 'channel' exists?


*  Fully understanding doing the same things with relations, using the 'db'
   command looks straight forward.  Exactly how to read/test existance
   isn't clear.

   I'm happy to be able to initialise/declare its type, parameters and give
   it a name, but using it is still mystical to me).


With much of the above I've just planked about copying existing code, and
most things appear to work, but without knowing the definitive state of
these things does leave the whole thing "mysical".  Nor is it possible to
really know what can and cant be done (or best ways of implementeding
specific features) if I don't fully understand the language.

In the zmailer distribution in ./doc/routercommands/builtins it lists (very
briefly) the commands.  But things like 'envars' dont appear to work or do
anything (no error even) with "envars >/tmp/mylogfile".  Nor do they run
from "sendmail -bt".

Maybe it's just me being thick, as I've not seen this kind of quesion or
query on the zmailer list (I've been on it a few months now).  Do most
people use it on the Internet and so the stock configuration files work
just fine?

Are there any WWW resources specificaly addressing any of the above
problems?


Many thanks for your time in reading this.

-- 
Darryl Miles