Ethereal-dev: Re: [ethereal-dev] keeping state - any preferences as to when setup is called?
On Mon, Oct 18, 1999 at 09:50:14AM -0500, Neulinger, Nathan R. wrote:
>
>
> I've noticed that smb_init_protocol is called from files.c, very early on
> in
> the process.
>
> Is this the preferred way of setting of per-protocol structures? I was
> thinking of calling it the first time that my dissection routine is called.
>
> Is there a preferred way of doing it?
It depends on what your initialization does.
Conceptually, there are 2 types of initialization routines:
System-wide initialization, which happens once when Ethereal starts.
Per-file initialization, which happens when a new file is loaded.
The state-keeping routines need to keep state per-file, so they are
initialized when a file is loaded. (Both SMB and NCP have this type
of routine).
ethereal_proto_init() (in gtk/main.c) calls the system-wide
initialization routines, proto_init(), init_dissect_udp(), and
dfilter_init().
--gilbert