Vinod Kolapuram
01/21/2010 1:46 PM
post45694
|
Hi Forum,
One more question regarding the PFIL_IN and PFIL_OUT usage.
As I mentioned in other questions. I have the below described problem to which I am writing the solution using pfil hook
in io-pkt
Machine X and Machine Y are on the private network. Machine X is master and Machine Y is slave. All the startup code to
detect master and slave is in place and this code is proven.
Now the question is slave sends some data packets to master. And master reads those data packets and master in turn will
send other data and slave will read it. Its a full duplex communication on different ports of the machines. Master and
slave have more than 2 ports.
My design idea using PFIL
Machine X will create an input hook to the stack using PFIL_IN so that it can read all the stack data. After the data
read on the stack from Machine Y, the Machine X will send some data to Machine Y using mbuf and "if_output()" call which
is on ifnet struct.
Machine Y will also create an input hook to the stack using PFIL_IN. It will also read the stack to read the data from
Machine X. Machine Y will also use mbuf and "if_output()" call on ifnet struct to send data to Machine X.
In this 2 way communication while creating the hook I want to use
struct pfil_head *pfh_inet;
pfh_inet = pfil_head_get(FIL_TYPE_AF, AF_INET)
pfil_add_hook(My_hook, NULL, PFIL_IN|PFIL_WAITOK, pfh_inet);
Will this work for my problem described above or
do I have to use the below one.
struct pfil_head *pfh_inet;
pfh_inet = pfil_head_get(FIL_TYPE_IFNET, 0)
pfil_add_hook(My_hook, NULL, PFIL_IFNET, pfh_inet);
Thanks
Vinod
|
|
|