Originally Posted by mousars
What is the parameter int (*okfn)(struct sk_buff *) which is passed to the hook ?
Thats a C general question ( a pointer to a function that takes parameters )
Otherwise if its a netfilter question, have a look at this very simple example:
How to obtain the declaration of a variable or a function:
- Write on the left the natural description of the type
- On the right, the identifier to declare (only one)
- While the left expression is not a base type, enum, struct or union, transform the two expressions like this:
- function returning an expl expr -> expl (expr)()
- array of expl expr -> expl (expr)
- pointer on expl expr -> expl *expr
As a side note, on rule (2.1) and (2.2) if expr
is not of the form *exp, then parenthesis around expr
can be ommited
int (*okfn)(struct sk_buff *)
Thats a pointer to a "function which takes as param a pointer to sk_buff , and returns int"
left: the type , right the identifier (alone!)
pointer to a func taking as param a pointer to sk_buff and returns int okfn
function which takes as param a pointer to sk_buff and returns int *okfn
int (*okfn)(struct sk_buff*)
He have it.
As an exercise to the reader
void (*signal(int sig,int (*func)(int)))(int);