On Tue, Oct 15, 2013 at 7:22 PM, Alexander Nasonov <[email protected]> wrote: > Lourival Vieira Neto wrote: >> I'm developing a library to handle buffers in Lua, named lbuf. It is >> been developed as part of my efforts to perform experimentation in >> kernel network stack using Lua. Initially, I intended to bind mbuf to >> allow, for example, to write protocols dissectors in Lua. For example, >> calling a Lua function to inspect network packets: >> >> function filter(packet) >> if packet.field == value then return DROP end >> return PASS >> end >> >> Thus, I started to design a Lua binding to mbuf inspired by '#pragma >> pack' and bitfields of C lang. Then, I realized that this Lua library >> could be useful to other kernel (and user-space) areas, such as device >> drivers and user-level protocols. So, I started to develop this >> binding generically as a independent library to give random access to >> bits in a buffer. It is just in the early beginning, but I want to >> share some thoughts. > > I wonder if you looked at Lua support in Wireshark [1]? Unfortunately, > it's GPL and they even have a special section 'Beware the GPL' on wiki. > > [1] http://wiki.wireshark.org/Lua > > Alex
Yes. In fact, I have already implemented a Wireshark dissector in Lua for a proprietary protocol that I was designing, inspired in ERP, to detect network loops. WS Lua dissectors also served as inspiration. However, I just used the API; I never looked at the binding implementation. Wireshark Lua dissectors is a good example of what can be done with Lua in that sense. But I'm looking for a more generic API that could allow random bit access in a buffer using Lua table notation, that could also be used to communicate with devices, for example. I think (IMHO) that lbuf masks is more straight forward. Regards, -- Lourival Vieira Neto
