Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
rancid(3)		   Library Functions Manual		     rancid(3)

NAME
       rancid -	rancid Perl and	Python modules

INTRODUCTION
       The   rancid  library  provides	functions  for	handling  rancid.types
       configuration files, loading modules, and the basic  global  variables,
       variables   from	  parsing  rancid.types	 files,	 and  output  handling
       functions that are common to all	rancid device modules,	all  of	 which
       are  exported  (in Perl terms) for use by those that import the module.
       Specifically, the library is used by rancid(1), but it could be used by
       any Perl	program	for site-specific handling or additional automata.

       Input handling functions: The rancidcontrib library contains  functions
       for  similar purposes, but are not part of the base rancid.  Please see
       the text	of the module itself for its documentation.

       RunCommand(*INPUT, *OUTPUT, command)
	      Parse a single command that returns no required info; the	output
	      is dropped.  This	could be used as the processing	function in  a
	      command definition in a rancid.types file.

       Output handling functions:

       ProcessHistory([tag], [sort_function], [sort_function_argument],
       string)
	      If  the  optional	 tag  string  and  sort_function arguments are
	      omitted, the  string  is	output	immediately.   Otherwise,  the
	      strings	are   accumulated   in	 a   hash,  by	the  hash  key
	      sort_function_argument, each  time  ProcessHistory()  is	called
	      until  the tag or	sort_function changes, at which	time the queue
	      is flushed and the new string is handled.	 If sort_function  had
	      been supplied, it	is called with the hash	as its argument.

	      Note that	if the hash key	sort_function_argument exists, the new
	      strings is appended to the existing hash value.

       keysort(%hash)
	      A	 sort  routine	that  will sort	on the keys of a hash as if it
	      were a normal array.  For	example:

	      ProcessHistory("TAG","keysort","B0","!\n");
	      ProcessHistory("TAG","keysort","D0","!\n");

	      B0 and D0	are the	sort keys.

       valsort(%hash)
	      A	sort routine that will sort on the values of a hash as	if  it
	      were a normal array.

	      ProcessHistory("TAG","valsort","","!B0\n");
	      ProcessHistory("TAG","valsort","","!D0\n");

       numsort(%hash)
	      A	numerical sort routine (ascending).

       ipsort(IPv4 dotted-quad/v6 address)
	      A	 sort  routine	that  will  sort on the	ip address when	the IP
	      address is anywhere in the strings.

	      ProcessHistory("TAG","ipsort","192.168.0.0","!B0\n");
	      ProcessHistory("TAG","ipsort","192.168.1.0","!D0\n");

       sortbyipaddr(XXX)
	      A	sort routine that will sort based upon IPv4/v6 addresses.

       Please see the library code for exported	variables.

       Please see the pydoc(1) for documentation on the	rancid Python  module.
       It is equivalent	to the Perl module, but	in a Pythonic manner.

SEE ALSO
       rancid(1), rancid.types.conf(5)

				 21 July 2021			     rancid(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=rancid&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help