WCCP v2 implementation thoughts.

From: Joe Cooper <joe@dont-contact.us>
Date: Thu, 19 Jul 2001 03:57:29 -0500

Hi folks,

I've now made some time for working on WCCP v2 support. I've mostly set
aside the WCCP v2 implementation Kevin did on top of the v1 module, and
am rewriting it (with much nudging from the old code).

I plan to implement a complete framework for full WCCP v2 support,
eventually to include MD5 security, alternate assignments, and different
service types (once Squid supports other service types, that is). It
will, in its first incarnation, support multiple routers, shutdown
requests, etc.

Over the past couple of days, with Adrian's occasional nudges, I've
defined the data structures and specced out the routines. I've even
started writing the first of the routines. But I wanted to query you
guys to see if maybe I should be thinking slightly differently...

Here's the quick summary of where I'm having doubts:

I've defined a structure for each major type of packet that will be
issued by the cache and each type that will be received. I've also
defined structures for all of the components of each packet. While
reading the spec, this seemed like the obvious way to do it.

When creating a packet, I'll fill the structure with the correct values
(either based on the initial values or drawn from the previous received
packet, or a combination of both), and then roll those values out into a
packet to send to the router.

When receiving a packet from the router, we'll accept it, and parse it
out into it's appropriate structure to be acted upon.

Now my concern is that there is a better way to do this, and I'm just
not seeing it. Many of these fields will contain the same values, just
in different positions. Should I be making those into 'global' (across
the module anyway) variables instead of redundant members of structures?
  It will save a lot of memory (relatively speaking--though all told
we're only talking about a few kilobytes for the full WCCP
implementation regardless of whether I use structures for everything and
have lots of duplicate data). It just seems like extensibility is
greatly enhanced by having everythings purpose and place easily
identifiable.

The other concern I have is, that maybe it would be nicer if I could
generalize the outgoing packets (of which there are now several types,
where there used to be only 1). Is there a way to generalize a function
to rollout the values in a given structure, even if all of the fields in
the structure are different?

By this, I mean, I have a struct foo, and a struct bar:

struct foo {
        uint16_t type;
        uint16_t length;
};

struct bar{
        struct foo foostruct;
        uint32_t length;
}

Now, is there a way to (safely) unroll the values of either of these
structs into a packet buffer using the same function even though their
contents are dissimilar? Pointers to documentation would be fine, I'm
just not seeing any examples in any of my books.

Feel free to ridicule me for going about it all wrong from the get go.
(Just offer up tips for the right direction.)

Thanks!
                                   --
                      Joe Cooper <joe@swelltech.com>
                  Affordable Web Caching Proxy Appliances
                         http://www.swelltech.com
Received on Thu Jul 19 2001 - 02:50:02 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:07 MST