This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C to Scheme questions regarding bit vectors



I am messing around with a packet analyzer that I am trying to write in 
guille.  It's a basic interface to libpcap and some guile glue.  Most of 
it is just a pipe dream right now, so sorry I don't have much code to 
show for it.  I am still trying to work out how to do the interface which 
is complicated by the fact that with libpcap I want to pass bit vectors 
to guille.

it basically works like this

I open the listening interface and I call a looping function to which I 
pass a function pointer.  That function pointer is called when each 
packet arrives from the listening interface.  I want to have that 
function call a scheme function.  That is not to hard in itself, but it's 
the type conversion.  I want to pass the packet itself, raw, to some 
scheme code, but the gh_* interface doesn't seem to have a way to setup 
bit vectors.  I would prefer not having to create a vector with gh_vector 
and then step thru it and use gh_vset for each bit with an SCM_BOOL.

Is there an easy way to convert a big buffer into a SCM bit vector?  
Would you suggest using a different scheme data structure to represent a 
raw packet (ethernet headers and all) in guile?

Do I need to go past the gh_* interface to do this?

thanx, and I apologize if this has been covered already, or if I'm askin 
a stupid question.



Craig Brozefsky              craig@onshore.com
onShore Inc.                 http://www.onshore.com/~craig
Development Team             p_priority=PFUN+(p_work/4)+(2*p_cash)
I hear my inside, the mechanized hum of another world - Steely Dan