Quote:
|
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:
http://whatisthekernel.blogspot.com/...ter-hooks.html
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 exp
r is not of the form *exp, then parenthesis around exp
r can be ommited
Example:
int (*okfn)(struct sk_buff *)
Thats a pointer to a "function which takes as param a pointer to sk_buff , and returns int"
so:
left: the type , right the identifier (alone!)
Code:
pointer to a func taking as param a pointer to sk_buff and returns int okfn
Code:
function which takes as param a pointer to sk_buff and returns int *okfn
Code:
int (*okfn)(struct sk_buff*)
He have it.
As an exercise to the reader

void (*signal(int sig,int (*func)(int)))(int);