Re: [squid-users] squid config parser library

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 10 Sep 2010 17:55:27 +1200

On 10/09/10 17:03, Mikio Kishi wrote:
> Hi, Amos
>
>> To what purpose?
>
> I'd like to implement my squid config viewer. It becomes easier to implement it
> if there is already such a parser library. Just a simple question.
>

With a potentially complicated solution.

I'm not aware of any as such. Webmin plays with the config in a GUI so
there may be something they use.

I tried my hand at a config validator/upgrader a year or so ago, it
turned out to be some trouble keeping up with all the little details fro
validation. I've turned to making the squid internal parser report
better instead.

A simple viewer should be a lot easier than one which tries to do
things, the overall options come in a few distinct flavours which can be
known an displayed appropriately despite the churn in fine detail...

Toggles are:
   directive optionlist

Access controls are:
   directive acllist
or
   directive valuelist acllist

Compounds are:
   directive valuelist optionlist

external_acl_type is a bit of an exception with its multiple lists:
   directive name [optionlist] formatlist helperparams

acllist ::= [allow|deny] acl [ acl ...]

optionlist ::= option [option ...]

valuelist is a fixed number for fields dependent on the directive name.

option ::= name ["=" flaglist ]

flaglist ::= flag ["," flag]

With the appropriate password a query to the Squid cachemgr API will
produce dump of the running config. This will also inline the sub-file
content and included sub-configs for you. It does loose the comments and
includes options still at their default values though.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.8
   Beta testers wanted for 3.2.0.2
Received on Fri Sep 10 2010 - 05:55:32 MDT

This archive was generated by hypermail 2.2.0 : Fri Sep 10 2010 - 12:00:04 MDT