Thanks, it works.

On Thu, 7 Mar 2019 10:06 IWAMOTO Toshihiro, <iwam...@valinux.co.jp> wrote:

> On Wed, 06 Mar 2019 10:32:47 +0900,
> knet solutions wrote:
> > I am trying to parse the NDN header (UDP Application), inside my
> > application.
> >
> > As i understand from the lib(and existing packet parser code),  payload
> is
> > passed as bytearray.
> >
> >
> > When i print the packet,    i get the below traces.
> >
> > pkt = packet.Packet(msg.data)
> > self.logger.info(pkt)
> >
> >
> > ethernet(dst='be:15:43:a7:96:91',ethertype=2048,src='7a:27:88:05:5b:88'),
> >
> ipv4(csum=5878,dst='10.0.0.1',flags=0,header_length=5,identification=20297,offset=0,option=None,proto=17,src='10.0.0.2',tos=0,total_length=172,ttl=64,version=4),
> > udp(csum=25487,dst_port=6363,src_port=6363,total_length=152),
> >
> '\x05\x8e\x07~\x08\x08localhop\x08\x03ndn\x08\x04nlsr\x08\x04sync\x08\x02\xfd\x06\x08]x\x9cc`\xa0>`\x04\xe2C/Z\xed\xf8\xc5\xb8\x84i`<E\x00\xe4\xb6\xa5\x0b\xd5w\x86=\xec\xe3\xa1\xb7\xbd\x07\x0eo\xb8\x99[\xff\xb1\x81\x1c\xbd\xd3\xf7x\x1a\x14u\x8a\xd6Q\xea\x06\x989\xa4\xbag0\xc7)2\x18\xa8\xf8\x1d*\x80\x92tH\x8e]\xd4H3\xd4J\xff\x83\x19\xe0J\xb7\x00\xc5\x9c.H\t\x02\x12\x00\n\x04\x1d\x8e%\x1f\x0c\x02\xea`
> >
> > >From the library i understand, i can access the payload as  "pkt.data".
> > Just trying to decode first two bytes and print it.
> >
> > _NDN_PACK_STR = '!BB'
> > (t,l) =  struct.unpack(_NDN_PACK_STR, pkt)
>
> pkt isn't a bytearray and I think this code raises an exception.
> I guess you want to unpack pkt.protocols[-1] instead?
>
> > self.logger.info(t)
> > self.logger.info(l)
> > But its not returning the correct values seen as per the header.
> >
> > Any suggestions?
> > Thanks
> > suresh
> >
> >
>
> --
> IWAMOTO Toshihiro
>
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to