code generation for C packet