I think I can do it this way, because udp headers is 8 bytes:
udp_pointer = len(msg.data) - udp_segment.total_length + 8
print msg.data[udp_pointer:]
On Tue, Dec 20, 2016 at 1:08 AM, Garegin Grigoryan <grig...@clarkson.edu>
wrote:
> Thanks!
>
> But udp_pkt contains only the header, as I understand it.
> I want to get the application data from the udp_segment and nothing else
> (no headers).
>
> On Tue, Dec 20, 2016 at 1:05 AM, Iwase Yusuke <iwase.yusu...@gmail.com>
> wrote:
>
>> Hi,
>>
>>
>> On 2016年12月20日 14:18, Garegin Grigoryan wrote:
>> > Hi,
>> >
>> > What is the best way to parse UDP segments in ryu controller? I want to
>> see the application data.
>> > I've tried this but it doesn't work:
>> >
>> > udp_parser = stream_parser.StreamParser()
>> > print udp_parser.parse(msg.data)
>>
>> Does "msg.data" mean the packet data of PacketIn message?
>>
>> The packet data of PacketIn message is the ethernet frame.
>> So you can use packet.Packet() instead.
>>
>> e.g.)
>> from ryu.lib.packet import packet
>> from ryu.lib.packet import ethernet
>> from ryu.lib.packet import udp
>> ...(snip)
>>
>> pkt = packet.Packet(msg.data)
>> udp_pkt = pkt.get_protocol(udp.udp)
>> if udp_pkt:
>> # do something
>> ...(snip)
>>
>>
>> Thanks,
>> Iwase
>>
>>
>> >
>> > TypeError: Can't instantiate abstract class StreamParser with abstract
>> methods try_parse
>> >
>> >
>> > --
>> > Sincerely,
>> > Garegin Grigoryan
>> >
>> >
>> > ------------------------------------------------------------
>> ------------------
>> > Developer Access Program for Intel Xeon Phi Processors
>> > Access to Intel Xeon Phi processor-based developer platforms.
>> > With one year of Intel Parallel Studio XE.
>> > Training and support from Colfax.
>> > Order your platform today.http://sdm.link/intel
>> >
>> >
>> >
>> > _______________________________________________
>> > Ryu-devel mailing list
>> > Ryu-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
>> >
>>
>
>
>
> --
> Sincerely,
> Garegin Grigoryan
>
--
Sincerely,
Garegin Grigoryan
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel