Hi Ramana,

In Ryu, TCP payload will be at the last element of pkt.protocols if the payload 
exists.

 e.g.)
  If the payload exists:
    pkt.protocols = [ethernet(...), ipv4(...), tcp(...), 'payload_data']
  You can access the payload like "pkt.protocols[-1]".

  If the payload does not exist:
    pkt.protocols = [ethernet(...), ipv4(...), tcp(...)]

Thanks,
Iwase

On 2015年12月18日 12:58, Ramana Reddy wrote:
> Thanks for your reply. The library pkt.get_protocol(tcp.
> tcp) gives the entire packet including the header. I could not see any api to 
> get only tcp payload. In pox, tcp.payload gives the payload without the 
> header. Any such api in ryu.
> 
> Thanks,
> Ramana
> 
> On 18 Dec 2015 5:26 am, "Yusuke Iwase" <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     Hi Ramana,
> 
>     Please refer to this Ryu-Book page for the usage of the packet library.
>       http://osrg.github.io/ryu-book/en/html/packet_lib.html
> 
>      e.g.)
>         tcp_packet = pkt.get_protocol(tcp.tcp)
>         if tcp_packet:
>             print(tcp_packet)
> 
>     Thanks,
>     Iwase
> 
>     On 2015年12月18日 02:16, Ramana Reddy wrote:
>     > What I need basically is:
>     >
>     > msg = ev.msg
>     > pkt = packet.Packet(msg.data)
>     >
>     > from 'pkt' we will get all ethernet, IP and TCP headers using 
> pkt.get_protocol(). But I would like to know
>     > how to extract the payload of the packet after stripping of all these 
> headers.
>     >
>     > Regards,
>     > Ramana
>     >
>     >
>     >
>     > On Thu, Dec 17, 2015 at 10:38 PM, Ramana Reddy <[email protected] 
> <mailto:[email protected]> <mailto:[email protected] 
> <mailto:[email protected]>>> wrote:
>     >
>     >     Hi All,
>     >
>     >     I would like to know the API to extract the payload of a tcp packet.
>     >
>     >
>     >     Thanks & Regards,
>     >     Ramana
>     >
>     >
>     >
>     >
>     > 
> ------------------------------------------------------------------------------
>     >
>     >
>     >
>     > _______________________________________________
>     > Ryu-devel mailing list
>     > [email protected] <mailto:[email protected]>
>     > https://lists.sourceforge.net/lists/listinfo/ryu-devel
>     >
> 
> 
> 
> ------------------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to