in reply to Re^3: How to use Inline::C properly
in thread How to use Inline::C properly

I tried your suggestion, it has type declaration conflicts error because the type defined in header types.h are different for src_ip,src_port...
I even tried the same type declared in types.h as:
int p0fq(_s32 p0f_socket, _u32 src_ip, _u16 s_port, _u32 dst_ip, _u16 +d_port)

Perl complains that the p0fq funcion not defined.I will just leave this problem alone for a while before I gain more knowledge about Perl and C, thanks :)

Replies are listed 'Best First'.
Re^5: How to use Inline::C properly
by samtregar (Abbot) on Mar 09, 2007 at 17:48 UTC
    I think you're right to take a step back and learn some basic Perl and C before trying to tackle this one. When you do get back to it, here's a hint: you need to convert the string representation of an IP "192.168.1.1", which is a char * (or SVPV, in Perl) into the packed 32-bit integer representation (_u32). I've seen this done a few different ways - usually it means breaking up the string into 4 individual bytes and then packing them into a single 4-byte (32-bit) integer, using bit-math or sometimes a union.

    -sam