How to decode undecoded packet which we get from getPayload method from PcapPacket?

6 replies [Last post]
pkgoms
Offline
Joined: 05/31/2009

Hi,

How to decode and get the .au audio file from undecoded packtes which i got from getPayload() method.

Regards,
Gomathi.K

Mark Bednarczyk
Mark Bednarczyk's picture
Offline
Joined: 03/22/2008
As long as the protocol

As long as the protocol header you are trying to decode is supported or you have one written it can be done quiet easily. All you need to do is encapsulate your buffer (retrieved as payload) in a JMemoryPacket and provide the proper first header in the buffer numerical ID.

Sly Technologies, Inc.
R&D

pkgoms
Offline
Joined: 05/31/2009
How to decode undecoded packet which we get from getPayload met

Hai Mark,

Thaks a lot for your quick reply.
I have encapsulated the JBuffer which contains payload in a JMemoryPacket.

JMemoryPacket jMPacket=new JMemoryPacket(jBuffer);

Further how to decode? can you please give me some line of code how to do that.

Regards,
Gomathi.K

Mark Bednarczyk
Mark Bednarczyk's picture
Offline
Joined: 03/22/2008
You can use JMemoryPacket

You can use JMemoryPacket constructor that takes the ID of the first protocol (what there that is in the payload) or you can call JPacket.scan(int) that takes the ID.

Sly Technologies, Inc.
R&D

pkgoms
Offline
Joined: 05/31/2009
How 2 decode undecoded Packet(got from getPayload)

Hai Mark,

Thank you for your reply.
byte[] payload = jNSPacket.getDataValue();

(jNSPacket---jNetStream Packet)

JMemoryPacket jMPacket = new JMemoryPacket(Ethernet.ID,payload);
System.out.println(jMPacket);

When i print jMPacket the ouput is:
Frame:
Frame: number = 185
Frame: timestamp = 2010-06-24 23:27:06.888
Frame: wire length = 252 bytes
Frame: captured length = 252 bytes
Frame:
Eth: ******* Ethernet - "Ethernet" - offset=0 (0x0) length=14
Eth:
Eth: destination = 80:8:26:3a:0:0
Eth: .... ..0. .... .... = [2] LG bit
Eth: .... ...0 .... .... = [0] IG bit
Eth: source = af:50:f3:cb:20:1
Eth: .... ..0. .... .... = [2] LG bit
Eth: .... ...0 .... .... = [0] IG bit
Eth: type = 0xE6E4 (59108)
Eth:
Data: ******* Payload offset=14 (0xE) length=238
Data:
000e: e6 de 76 54 5f 64 66 7e 7c 7e 79 79 7e 76 74 7d ..vT_df~|~yy~vt}
001e: 7d 70 77 7d 7c 74 41 c5 5e 67 df fc 76 53 f6 c0 }pw}|tA.^g..vS..
002e: cd f1 f9 ff ed e8 e7 eb 87 81 e6 f7 98 90 6f 17 ..............o.

From this i have extracted only payload (packet CONTENT),from this Data payload how to get .au sound file.

Can u please help me to save .au file from payload raw data.

Regards,
Gomathi.K

Mark Bednarczyk
Mark Bednarczyk's picture
Offline
Joined: 03/22/2008
I think you are on the wrong

I think you are on the wrong track here. The ".au" files do not contain packets, therefore you can not use libpcap to read it like an offline pcap capture file. Ethernet is a network protocol that is also not stored in actual .au files. jNetPcap or jNetStream will not be able to read the .au file structure.

Sorry.

Sly Technologies, Inc.
R&D

pkgoms
Offline
Joined: 05/31/2009
How to decode undecoded packet which we get from getPayload

Hai Mark,

Thank you for your quick reply.

Regards,
Gomathi.K

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.