[Initng] Object serialization & Events

Ismael Luceno ismael.luceno at gmail.com
Fri Sep 7 06:24:27 CEST 2007


Some time ago I had the idea of exporting internal initng events to scripts, 
but that time I hadn't any reasonable method to do so...

Some days ago, while programming a honeypot at work, I got a very good idea, I 
don't really know why, but I imagined how to implement a generic object 
serializer.

I don't have any real code, but there's my idea:

  struct {
	char type;
	char *out_fmt;
  } serializer_vtypes[] = {
	{ VARTYPE_STRING, "%s=%s\n" },
	{ VARTYPE_INT,    "%s=%d\n" },
  };

  struct vsd_s {
	char *name;
	int in_type;
	void *offset;

	list_h list;
  };

Then, we can put a vsd_s inside the thing we want to serialize, and do 
something like:

  serialized_event =  serialize(event, event->vsd);

For now, i don't see a need to export anything complex, so we should be able 
to simply use printf, but if we do need something more complex we can replace
out_fmt with a function and add a size element to vsd_s.

What do you think guys?


More information about the Initng mailing list