RLRP routing  v.0.1.0
Transport Namespace Reference

Classes

class  RawTransport
 Class for interacting with raw sockets of the real network interface. More...
 
class  UdsClient
 Unix Domain Socket (UDS) client class. More...
 
class  UdsServer
 Unix Domain Socket (UDS) server class. More...
 
class  VirtualTransport
 Class for interaction with virtual network interface. More...
 

Functions

def get_mac (interface_name)
 Get MAC address from the network interface. More...
 
def get_l3_addresses_from_interface ()
 Get L3 addresses from the network interface. More...
 
def get_l3_addresses_from_packet (packet)
 Ger L3 addresses from the data packet. More...
 
def get_upper_proto_info (packet)
 Get L4 protocol ID and port from the data packet. More...
 

Variables

 TRANSPORT_LOG = routing_logging.create_routing_log("routing.transport.log", "transport")
 Global routing_logging.LogWrapper object for logging Transport activity. More...
 
int TUNSETIFF = 0x400454ca
 Set tun interface ID. More...
 
int IFF_TUN = 0x0001
 The tun interface flag. More...
 
int SIOCSIFADDR = 0x8916
 Set the address of the device. More...
 
int SIOCSIFNETMASK = 0x891C
 Set the network mask for a device. More...
 
int SIOCSIFMTU = 0x8922
 Set the MTU (Maximum Transfer Unit) of a device. More...
 
int SIOCSIFFLAGS = 0x8914
 Set the active flag word of the device. More...
 
int IFF_UP = 0x1
 Interface is running flag. More...
 
int SIOCGIFINDEX = 0x8933
 Retrieve the interface index of the interface. More...
 
int SIOCGIFADDR = 0x8915
 Get the address of the device. More...
 
int IP4_ID = 0x0800
 IPv4 protocol ID on the L2 layer. More...
 
int IP6_ID = 0x86DD
 IPv6 protocol ID on the L2 layer. More...
 
dictionary PROTOCOL_IDS = {"ICMP4": 1, "ICMP6": 58, "TCP": 6, "UDP": 17}
 Define protocols ID list over IP layer, according to the RFCs: https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers. More...
 

Detailed Description

@package Transport
Created on Oct 8, 2014

@author: Dmitrii Dugaev


The Transport module is responsible for all the actual interaction with network interfaces (both virtual and real),
including frame generation, frame parsing, socket creation/closing/binding/receiving, raw packet processing, frame
filtering as well as providing methods for working with Linux networking stack via system calls.

Function Documentation

def Transport.get_l3_addresses_from_interface ( )

Get L3 addresses from the network interface.

Define a static function which will return a list of ip addresses assigned to the virtual interface (in a form of: [<ipv4 address>="">, <ipv6 address1>="">, <ipv6 address2>="">, <ipv6 addressn>="">]).

Returns
[<ipv4 address>="">, <ipv6 address1>="">, <ipv6 address2>="">, <ipv6 addressn>="">].

Here is the caller graph for this function:

def Transport.get_l3_addresses_from_packet (   packet)

Ger L3 addresses from the data packet.

Define a static function which will return src and dst L3 addresses of the given packet. For now, only IPv4 and IPv6 protocols are supported.

Parameters
packetRaw data packet received from network interface.
Returns
[src_ip, dst_ip].

Here is the caller graph for this function:

def Transport.get_mac (   interface_name)

Get MAC address from the network interface.

Define a static function which will return a mac address from the given network interface name.

Parameters
interface_nameName of the network interface.
Returns
MAC address in "xx:xx:xx:xx:xx:xx" format.

Here is the caller graph for this function:

def Transport.get_upper_proto_info (   packet)

Get L4 protocol ID and port from the data packet.

Define a static function which will return upper protocol ID and port number (if any) of the given packet. For now, only IPv4 and IPv6 protocols are supported on L3 layer, and UDP, TCP and ICMP on the upper level.

Parameters
packetRaw data packet received from network interface.
Returns
(L4 protocol name), (port number).

Here is the caller graph for this function:

Variable Documentation

Transport.IFF_TUN = 0x0001

The tun interface flag.

Transport.IFF_UP = 0x1

Interface is running flag.

Transport.IP4_ID = 0x0800

IPv4 protocol ID on the L2 layer.

Transport.IP6_ID = 0x86DD

IPv6 protocol ID on the L2 layer.

Transport.PROTOCOL_IDS = {"ICMP4": 1, "ICMP6": 58, "TCP": 6, "UDP": 17}

Define protocols ID list over IP layer, according to the RFCs: https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers.

Transport.SIOCGIFADDR = 0x8915

Get the address of the device.

Transport.SIOCGIFINDEX = 0x8933

Retrieve the interface index of the interface.

Transport.SIOCSIFADDR = 0x8916

Set the address of the device.

Transport.SIOCSIFFLAGS = 0x8914

Set the active flag word of the device.

Transport.SIOCSIFMTU = 0x8922

Set the MTU (Maximum Transfer Unit) of a device.

Transport.SIOCSIFNETMASK = 0x891C

Set the network mask for a device.

Transport.TRANSPORT_LOG = routing_logging.create_routing_log("routing.transport.log", "transport")

Global routing_logging.LogWrapper object for logging Transport activity.

Transport.TUNSETIFF = 0x400454ca

Set tun interface ID.