Hi,

As you said, udp_pkt is a instance of UDP Header parser class.
For getting the payload of UDP, please check pkt.protocols member, first.
It should be contains each protocol header instance and payload data (might be 
binary type).
e.g.)
 pkt.protocols might contain [ethernet(...), ipv4(..), udp(..), b'...']

Thanks,
Iwase

On 2016年12月20日 15:26, Garegin Grigoryan wrote:
> 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 
> <mailto: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 
> <mailto: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 
> <mailto:Ryu-devel@lists.sourceforge.net>
>         > https://lists.sourceforge.net/lists/listinfo/ryu-devel 
> <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
> 

------------------------------------------------------------------------------
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

Reply via email to