TCP option field in jpcap.packet.TCPPacket class

Hello, I try to send a TCP packet via jpcap api (I'm not using net.sourceforge.jpcap API)

here my code:

byte [] options ={(byte)0x02, (byte)0x04, (byte)0x05, (byte)0xB4};

TCPPacket p =new TCPPacket(....);

p.option = options;

sender.sendPacket(p);

when I spy the TCP packets with wireshark (etherreal), there is no option bytes in my packet ?

Do you have an idea ?

kind regards,

Manu

[696 byte] By [manu_13a] at [2007-10-3 9:32:52]
# 1
Did you try stepping through the code (library) to see what it is doing?Given that you pointed out that you were not using a particular library it might help to point out which library you are in fact using.
jschella at 2007-7-15 4:47:57 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

Hi and sorry for my delay answer.

I'm using jpcap api found here : http://netresearch.ics.uci.edu/kfujii/jpcap/doc/index.html

I have debug the native function and I can see that in jpcap library (packet_tcp.c, function set_tcp), the TCP option field is not managed, when I have checked into netinet/tcp.h the structure of tcp header is like that:

struct tcphdr {

u_shortth_sport;/* source port */

u_shortth_dport;/* destination port */

tcp_seqth_seq;/* sequence number */

tcp_seqth_ack;/* acknowledgement number */

#if BYTE_ORDER == LITTLE_ENDIAN

u_charth_x2:4,/* (unused) */

th_off:4;/* data offset */

#endif

#if BYTE_ORDER == BIG_ENDIAN

u_charth_off:4,/* data offset */

th_x2:4;/* (unused) */

#endif

u_charth_flags;

#defineTH_FIN0x01

#defineTH_SYN0x02

#defineTH_RST0x04

#defineTH_PUSH0x08

#defineTH_ACK0x10

#defineTH_URG0x20

u_shortth_win;/* window */

u_shortth_sum;/* checksum */

u_shortth_urp;/* urgent pointer */

};

but I don't know how the option field is managed, may be I need to change the struct to include option field...

Any suggestions ?

bye.

manu_a at 2007-7-15 4:47:57 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
finally I changed the source code of jpcap (c files and java files) to be able to give options byte in parameter.If someone want to get my version, contact me at: emmanuel.bachimon@gemalto.comregards.
manu_a at 2007-7-15 4:47:57 > top of Java-index,Java HotSpot Virtual Machine,Specifications...