[Bro-Dev] script loading changes
seth at icir.org
Wed Jul 13 18:12:09 PDT 2011
On Jul 13, 2011, at 5:11 PM, Jonathan Siwek wrote:
> The problem we're trying to solve is how to best organize the packages
> under protocol/ such that there's a way to load them without a possibly
> unwanted side-effect of loading an entire package under frameworks/
> because one script happens to require it (is that right Seth?).
> e.g. we want "@load protocols/http" to avoid loading frameworks/software.
> Why don't we just write the __load__.bro manifest of the package to not
> @load scripts that may have unwanted side effects? The __load__.bro that
> gets loaded implicitly is already provided only for convenience and may
> not actually load the entire contents of the package.
The __load__.bro scripts are actually where I would be hiding these extra dependency based loads. I was just looking for a way to reduce dependencies without having to add code to manage things manually. For example, I'd like packages to offer the ability to do something with the software framework if it's available, but if it's not available to just not load the functionality.
I'm starting to recognize that I'm looking to do something like dependency injection but perhaps we're still a bit early on in the modularization of Bro scripts for us to figure out how to do this well. If everyone's onboard we can just table this discussion for now and I can do this more manually, I may even be able to rig up a dependency injection-like framework in script-land.
I would still really like the relative path based loading though, it's really painful to do inter-directory script loading right now and it would be a bit difficult for others to contribute external scripts and manage them well because the full path is used for loading.
> 3) the "I don't care how much extra stuff gets loaded, give me everything
> in the package" approach via "@load protocols/http/*" to recursively
> load all files that have a .bro extension (skipping __load__.bro)
I'm not sure this is a good option as I have written a couple of things where you would never want to load everything and loading everything could actually lead to disaster (or at least broken-ness). :)
International Computer Science Institute
(Bro) because everyone has a network
More information about the bro-dev