-
Hay,
I am still looking around for help. Thax alot for the good work from Sang-drax
Now, I have :
u_long SEQ_N // sequence # in a tcp header
I need to extract that from the tcp header having known the packet pointer tcp_ptr;
This is my code :
Code:
SEQ_N=*tcp_ptr <<8 //extract the 1st byte.
*tcp_ptr ++; // goto next byte.
SEQ_N=SEQ_N | *tcp_ptr;
*tcp_ptr++; // 3rd byte.
SEQ_N=SEQ_N | *tcp_ptr;
*tcp_ptr++; // 4th byte
SEQ_N = SEQ_N | *tcp_ptr;
...
...
..
Well, I am not sure if this would work! Have I done right ? would any one follow the code and tell me if I got the SEQ_N value right ?!1
Apreciated and kind of help.
Ahmed.
-
Assuming tcp_ptr points to the first byte of the sequence number (first in the TCP package is the port numbers):
Code:
SEQ_N=*tcp_ptr;//extract the 1st byte.
*tcp_ptr ++; // goto next byte.
SEQ_N|= *tcp_ptr << 8;
*tcp_ptr++; // 3rd byte.
SEQ_N|= *tcp_ptr << 16;
*tcp_ptr++; // 4th byte
SEQ_N |= *tcp_ptr << 24;