Class Packet

An object representing a Packet, inherits from Base_Object

Tables

Packet.sendrecv_args sendrecv arguments

Methods

Packet:source () Get the Source IP address of this packet
Packet:destination () Get the Destination IP address of this packet
Packet:new () Create a new Packet
Packet:sendrecv ([args]) Send a packet and wait for a reply
Packet:send ([interface]) Send a packet over the wire
Packet:bytes () Get the list of bytes contained in this packet
Packet:get (similar) Get a layer matching the given one
Packet:iplayer () Get the IP or IPv6 Layer of this packet
Packet:ip () Get the IP Layer of this packet
Packet:ipv6 () Get the IPv6 Layer of this packet
Packet:srh () Get the IPv6SegmentRoutingHeader Layer of this packet
Packet:tcp () Get the TCP Layer of this packet
Packet:udp () Get the UDP Layer of this packet
Packet:icmp () Get the ICMP Layer of this packet
Packet:payload () Get the Raw Layer of this packet (a.k.a.


Tables

Packet.sendrecv_args
sendrecv arguments

Fields:

  • timeout num How long to wait for a response
  • retry num

    How many times should we send another packet and try again

    in case of timeout
    
  • interface string

    force the outgoing interface, instead of using the

    default interface for the destination address
    

Methods

Packet:source ()
Get the Source IP address of this packet

Returns:

    string IP address
Packet:destination ()
Get the Destination IP address of this packet

Returns:

    string IP address
Packet:new ()
Create a new Packet

Returns:

    Packet a new empty Packet
Packet:sendrecv ([args])
Send a packet and wait for a reply

Parameters:

Returns:

    Packet reply A received packet with the same flow key, or an ICMP, or nil
Packet:send ([interface])
Send a packet over the wire

Parameters:

  • interface string

    force the outgoing interface, instead of using the

    default interface for the destination address
    
    (optional)
Packet:bytes ()
Get the list of bytes contained in this packet

Returns:

    table bytes a list of numbers [0-255] denoting the value of each byte in the packet
Packet:get (similar)
Get a layer matching the given one

Parameters:

  • similar Base_Object

Returns:

    Base_Object layer the corresponding layer or nil

Usage:

    local real_tcp = pkt:get(TCP)
Packet:iplayer ()
Get the IP or IPv6 Layer of this packet

Returns:

    IPLayer ip either IP or IPv6
Packet:ip ()
Get the IP Layer of this packet

Returns:

    IP the IP layer or nil
Packet:ipv6 ()
Get the IPv6 Layer of this packet

Returns:

    IPv6 the IPv6 layer or nil
Packet:srh ()
Get the IPv6SegmentRoutingHeader Layer of this packet

Returns:

    IPv6SegmentRoutingHeader the IPv6SegmentRoutingHeader layer or nil
Packet:tcp ()
Get the TCP Layer of this packet

Returns:

    TCP the TCP layer or nil
Packet:udp ()
Get the UDP Layer of this packet

Returns:

    UDP the UDP layer or nil
Packet:icmp ()
Get the ICMP Layer of this packet

Returns:

    ICMP the ICMP layer or nil
Packet:payload ()
Get the Raw Layer of this packet (a.k.a. all the data after the last known layer)

Returns:

    Raw the Raw layer or nil
generated by LDoc 1.4.3 Last updated 2015-05-04 17:26:47