Where to store the stack "state"

Harald Welte laforge at gnumonks.org
Mon Apr 25 13:51:41 UTC 2011

Hi Sylvain,

On Mon, Apr 18, 2011 at 02:19:18PM +0200, Sylvain Munaut wrote:
> To add support for traffic extraction, it's necessary to introduce
> some nothing of "state" in the MAC layer (since the DL_USAGE must be
> 'remembered' to know how to interpret further data) ...
> Any suggestion how to achieve that as cleanly as possible ?
> Having a global doesn't sound that nice, but passing a struct around either.
> Maybe introduce a pointer to a 'tetra_state' in the primitive struct ?

I have been thinking about the same issue while working on the LLC reassembly,
which obviously also needs state.

I guess in the end we will have something like a global 'tetra_carrier_state'
struct, which then has sub-structs for the logical channels that we see.

And as I've now extended the primitive to use a msgb for storing the actual
unpacked type-1 bits, I guess we could simply use something out of msgb->cb
to point to the 'lchan' (in OpenBSC terminology).

- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)

More information about the tetra mailing list