implemented complete C wrapper, except packet stuff