Do you have any plan to use non-ethernet type?

On Fri, May 24, 2013 at 05:05:32PM +0000, Shaun Crampton wrote:
> From: Shaun Crampton <[email protected]>
> 
> Allow packet type to be specified when parsing packet.
> 
> Signed-off-by: Shaun Crampton <[email protected]>
> 
> ---
> 
> Our application has a need to parse raw IP packets to determine
> their destination.
> 
>  ryu/lib/packet/packet.py |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py
> index 2ef08c1..f5fd82d 100644
> --- a/ryu/lib/packet/packet.py
> +++ b/ryu/lib/packet/packet.py
> @@ -31,15 +31,14 @@ class Packet(object):
>      *data* should be omitted when encoding a packet.
>      """
>  
> -    def __init__(self, data=None):
> +    def __init__(self, data=None, parse_cls=ethernet.ethernet):
>          super(Packet, self).__init__()
>          self.data = data
>          self.protocols = []
>          self.protocol_idx = 0
>          self.parsed_bytes = 0
>          if self.data:
> -            # Do we need to handle non ethernet?
> -            self._parser(ethernet.ethernet)
> +            self._parser(parse_cls)
>  
>      def _parser(self, cls):
>          while cls:
> -- 
> 1.7.9.5
> 
> 
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

-- 
yamahata

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to