libtins  3.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Namespaces | Classes | Typedefs | Functions | Variables
Tins Namespace Reference

The Tins namespace. More...

Namespaces

 Allocators
 Defines inner PDU allocators.
 
 Constants
 Constants used in protocols.
 
 Utils
 Network utils namespace.
 

Classes

class  AddressRangeIterator
 AddressRange iterator class. More...
 
class  AddressRange
 Represents a range of addresses. More...
 
class  ARP
 Represents an ARP PDU. More...
 
class  BootP
 Represents a BootP PDU. More...
 
struct  Ethernet
 
struct  DataLinkType
 Maps a libtins link layer PDU to a libpcap data link identifier. More...
 
class  DHCP
 Represents the DHCP PDU. More...
 
class  DHCPv6
 Represents a DHCPv6 PDU. More...
 
class  DNS
 Represents a DNS PDU. More...
 
class  Dot11Disassoc
 Class representing a Disassociation frame in the IEEE 802.11 Protocol. More...
 
class  Dot11AssocRequest
 Class representing an Association Request frame in the IEEE 802.11 Protocol. More...
 
class  Dot11AssocResponse
 Class representing an Association Response frame in the IEEE 802.11 Protocol. More...
 
class  Dot11ReAssocRequest
 Class representing an ReAssociation Request frame in the IEEE 802.11 Protocol. More...
 
class  Dot11ReAssocResponse
 IEEE 802.11 ReAssociation Response frame. More...
 
class  Dot11Authentication
 IEEE 802.11 Authentication Request frame. More...
 
class  Dot11Deauthentication
 IEEE 802.11 Deauthentication frame. More...
 
class  Dot11
 Class representing an 802.11 frame. More...
 
class  Dot11Beacon
 Represents an IEEE 802.11 Beacon. More...
 
class  Dot11Control
 Represents an IEEE 802.11 control frame. More...
 
class  Dot11ControlTA
 Class that represents an abstraction of the 802.11 control frames that contain a target address. More...
 
class  Dot11RTS
 IEEE 802.11 RTS frame. More...
 
class  Dot11PSPoll
 
class  Dot11CFEnd
 
class  Dot11EndCFAck
 
class  Dot11Ack
 
class  Dot11BlockAckRequest
 Class that represents an 802.11 Block Ack Request PDU. More...
 
class  Dot11BlockAck
 Class that represents an 802.11 block ack frame. More...
 
class  Dot11Data
 Represents an IEEE 802.11 data frame. More...
 
class  Dot11QoSData
 
class  Dot11ManagementFrame
 Base class for all management frames in the IEEE 802.11 protocol. More...
 
class  Dot11ProbeRequest
 Class representing an Probe Request frame in the IEEE 802.11 Protocol. More...
 
class  Dot11ProbeResponse
 Class representing an Probe Response frame in the IEEE 802.11 Protocol. More...
 
class  Dot1Q
 
class  Dot3
 Class representing an IEEE 802.3 PDU. More...
 
class  EAPOL
 Represents the EAP encapsulation over LAN. More...
 
class  RC4EAPOL
 Class that represents the RC4 EAPOL PDU. More...
 
class  RSNEAPOL
 Class that represents the RSN EAPOL PDU. More...
 
class  EthernetII
 Represents an Ethernet II PDU. More...
 
class  exception_base
 Base class for all libtins exceptions. More...
 
class  option_not_found
 Exception thrown when an option is not found. More...
 
class  malformed_packet
 Exception thrown when a malformed packet is parsed. More...
 
class  serialization_error
 Exception thrown when serializing a packet fails. More...
 
class  pdu_not_found
 Exception thrown when a PDU is not found when using PDU::rfind_pdu. More...
 
class  invalid_interface
 Exception thrown when PDU::send requires a valid interface, but an invalid is used. More...
 
class  invalid_address
 Exception thrown when an invalid string representation of an address is provided. More...
 
class  field_not_present
 Exception thrown when a field is not present in frame. More...
 
class  socket_open_error
 Exception thrown when PacketSender fails to open a socket. More...
 
class  socket_close_error
 Exception thrown when PacketSender fails to close a socket. More...
 
class  socket_write_error
 Exception thrown when PacketSender fails to write on a socket. More...
 
class  invalid_socket_type
 Exception thrown when an invalid socket type is provided to PacketSender. More...
 
class  unknown_link_type
 Exception thrown when an unkown link layer PDU type is found while sniffing. More...
 
class  malformed_option
 Exception thrown when a malformed option is found. More...
 
class  bad_tins_cast
 Exception thrown when a call to tins_cast fails. More...
 
class  protocol_disabled
 Exception thrown when sniffing a protocol that has been disabled at compile time. More...
 
class  feature_disabled
 Exception thrown when a feature has been disabled at compile time. More...
 
class  option_payload_too_large
 Exception thrown when a payload is too large to fit into a PDUOption. More...
 
class  pcap_error
 Generic pcap error. More...
 
class  invalid_pcap_filter
 Exception thrown when an invalid pcap filter is compiled. More...
 
class  pdu_not_serializable
 Exception thrown when serialiation of a non-serializable PDU is attempted. More...
 
class  pcap_open_failed
 Exception thrown when opening a pcap handle fails. More...
 
class  unsupported_function
 Exception thrown when a function not supported on the current OS is called. More...
 
class  invalid_domain_name
 Exception thrown when an invalid domain name is parsed. More...
 
class  stream_not_found
 Exception thrown when a stream is not found. More...
 
class  callback_not_set
 Exception thrown when a required callback for an object is not set. More...
 
class  invalid_packet
 Exception thrown when an invalid packet is provided to some function. More...
 
class  EAPOLHandshake
 Generic EAPOL handshake. More...
 
class  RSNHandshakeCapturer
 
class  HWAddress
 Represents a hardware address. More...
 
class  ICMP
 Class that represents an ICMP PDU. More...
 
class  ICMPExtension
 Class that represents an ICMP extension object. More...
 
class  ICMPExtensionsStructure
 Class that represents an ICMP extensions structure. More...
 
class  ICMPv6
 Represents an ICMPv6 PDU. More...
 
class  IP
 Class that represents an IP PDU. More...
 
class  IPv4Address
 Abstraction of an IPv4 address. More...
 
class  IPv4Reassembler
 Reassembles fragmented IP packets. More...
 
class  IPv4ReassemblerProxy
 
class  IPSecAH
 Represents an IPSec Authentication Header. More...
 
class  IPSecESP
 Represents an IPSec Authentication Header. More...
 
class  IPv6
 
class  IPv6Address
 
class  LLC
 Representing a LLC frame. More...
 
class  Loopback
 Represents a Loopback PDU. More...
 
class  MPLS
 Represents an MPLS PDU. More...
 
class  NetworkInterface
 Abstraction of a network interface. More...
 
class  OfflinePacketFilter
 Wraps a pcap filter and matches it against a packet or buffer. More...
 
class  PacketWrapper
 Represents a sniffed packet. More...
 
class  Packet
 
class  PacketSender
 Sends packets through a network interface. More...
 
class  PacketWriter
 Writes PDUs to a pcap format file. More...
 
class  PDU
 Base class for protocol data units. More...
 
class  PDUCacher
 PDU wrapper that caches the result of the wrapped PDU's serialization. More...
 
class  PDUOption
 Represents a PDU option field. More...
 
class  PKTAP
 Represents a PKTAP PDU. More...
 
class  PPI
 Represents a Per-Packet Information PDU. More...
 
class  PPPoE
 Represents a Point-to-point protocol over Ethernet PDU. More...
 
class  RadioTap
 Class that represents the IEEE 802.11 radio tap header. More...
 
class  RawPDU
 
class  RSNInformation
 Class that models the RSN information structure. More...
 
class  SLL
 Represents a Linux cooked-mode capture (SLL) PDU. More...
 
class  value_too_large
 
class  small_uint
 Represents a field of n bits. More...
 
class  SNAP
 Represents a SNAP frame. More...
 
class  BaseSniffer
 Base class for sniffers. More...
 
class  Sniffer
 Sniffs packets from a network interface. More...
 
class  FileSniffer
 Reads pcap files and interprets the packets in it. More...
 
class  HandlerProxy
 
class  SnifferIterator
 Iterates over packets sniffed by a BaseSniffer. More...
 
class  SnifferConfiguration
 Represents the configuration of a BaseSniffer object. More...
 
class  STP
 Represents a Spanning Tree Protocol PDU. More...
 
class  TCP
 Represents a TCP PDU. More...
 
class  TCPStream
 Represents a TCP stream. More...
 
class  TCPStreamFollower
 Follows TCP streams and notifies the user when data is available. More...
 
class  Timestamp
 Represents a packet timestamp. More...
 
class  UDP
 Represents an UDP PDU. More...
 
struct  sniff_data
 

Typedefs

typedef AddressRange< IPv4AddressIPv4Range
 
typedef AddressRange< IPv6AddressIPv6Range
 
typedef EAPOLHandshake< RSNEAPOLRSNHandshake
 
typedef Dot3 IEEE802_3
 
typedef PacketWrapper< PDU
&, const Timestamp & > 
RefPacket
 Thin wrapper over a PDU and Timestamp reference.
 
typedef PacketWrapper< PDU
*, Timestamp
PtrPacket
 Thin wrapper over a PDU pointer and a Timestamp.
 
typedef std::vector< uint8_t > byte_array
 
typedef int socket_type
 

Functions

template<size_t n>
AddressRange< HWAddress< n > > operator/ (const HWAddress< n > &addr, int mask)
 Constructs an AddressRange from a base address and a mask. More...
 
IPv6Range operator/ (const IPv6Address &addr, int mask)
 Constructs an IPv6Range from a base IPv6Address and a mask. More...
 
IPv4Range operator/ (const IPv4Address &addr, int mask)
 Constructs an IPv4Range from a base IPv4Address and a mask. More...
 
template<typename Functor >
IPv4ReassemblerProxy< Functor > make_ipv4_reassembler_proxy (Functor func)
 
template<typename T >
T & operator/= (T &lop, const PDU &rop)
 Concatenation operator. More...
 
template<typename T >
operator/ (T lop, const PDU &rop)
 Concatenation operator. More...
 
template<typename T >
T * operator/= (T *lop, const PDU &rop)
 Concatenation operator on PDU pointers. More...
 
template<typename T , typename U >
tins_cast (U *pdu)
 
template<typename T , typename U >
T & tins_cast (U &pdu)
 
template<typename T >
HandlerProxy< T > make_sniffer_handler (T *ptr, typename HandlerProxy< T >::fun_type function)
 
PacketSender::SocketType pdu_type_to_sender_type (PDU::PDUType type)
 
ostream & operator<< (ostream &output, const IPv4Address &addr)
 
IPv6Address operator& (const IPv6Address &lhs, const IPv6Address &rhs)
 
const char * make_error_string ()
 
template<typename T >
T * safe_alloc (const u_char *bytes, bpf_u_int32 len)
 
template<typename T >
void sniff_loop_handler (u_char *user, const struct pcap_pkthdr *h, const u_char *bytes)
 
void sniff_loop_eth_handler (u_char *user, const struct pcap_pkthdr *h, const u_char *bytes)
 
uint32_t add_sequence_numbers (uint32_t seq1, uint32_t seq2)
 
uint32_t subtract_sequence_numbers (uint32_t seq1, uint32_t seq2)
 
int compare_seq_numbers (uint32_t seq1, uint32_t seq2)
 
template<typename Iterator , typename Container >
Iterator erase_iterator (Iterator it, Container &cont)
 
uint32_t sum_range (const uint8_t *start, const uint8_t *end)
 Computes the 16 bit sum of the input buffer. More...
 
uint32_t pseudoheader_checksum (IPv4Address source_ip, IPv4Address dest_ip, uint32_t len, uint32_t flag)
 

Variables

const AddressRange< IPv4Addressprivate_ranges []
 
const AddressRange< IPv4Addressloopback_range = IPv4Address("127.0.0.0") / 8
 
const AddressRange< IPv4Addressmulticast_range = IPv4Address("224.0.0.0") / 4
 
const IPv6Address loopback_address = "::1"
 
static const uint32_t seq_number_diff = 2147483648U
 

Detailed Description

The Tins namespace.

Typedef Documentation

typedef std::vector<uint8_t> Tins::byte_array

The type used to store several PDU option values.

An IPv4 address range.

An IPv6 address range.

The type used to store RSN handshakes.

Function Documentation

template<typename Functor >
IPv4ReassemblerProxy<Functor> Tins::make_ipv4_reassembler_proxy ( Functor  func)

Helper function that creates an IPv4ReassemblerProxy.

Parameters
funcThe functor object to use in the IPv4ReassemblerProxy.
Returns
An IPv4ReassemblerProxy.
IPv6Address Tins::operator& ( const IPv6Address &  lhs,
const IPv6Address &  rhs 
)

Applies a mask to an address

template<size_t n>
AddressRange<HWAddress<n> > Tins::operator/ ( const HWAddress< n > &  addr,
int  mask 
)

Constructs an AddressRange from a base address and a mask.

Parameters
addrThe range's first address.
maskThe bit-length of the prefix.
IPv6Range Tins::operator/ ( const IPv6Address &  addr,
int  mask 
)

Constructs an IPv6Range from a base IPv6Address and a mask.

Parameters
addrThe range's first address.
maskThe bit-length of the prefix.
IPv4Range Tins::operator/ ( const IPv4Address &  addr,
int  mask 
)

Constructs an IPv4Range from a base IPv4Address and a mask.

Parameters
addrThe range's first address.
maskThe bit-length of the prefix.
template<typename T >
T Tins::operator/ ( lop,
const PDU &  rop 
)

Concatenation operator.

See Also
operator/=
template<typename T >
T& Tins::operator/= ( T &  lop,
const PDU &  rop 
)

Concatenation operator.

This operator concatenates several PDUs. A copy of the right operand is set at the end of the left one's inner PDU chain. This means that:

IP some_ip = IP("127.0.0.1") / TCP(12, 13) / RawPDU("bleh");

Works as expected, meaning the output PDU will look like the following:

IP - TCP - RawPDU

Parameters
lopThe left operand, which will be the one modified.
ropThe right operand, the one which will be appended to lop.
template<typename T >
T* Tins::operator/= ( T *  lop,
const PDU &  rop 
)

Concatenation operator on PDU pointers.

See Also
operator/=
uint32_t Tins::sum_range ( const uint8_t *  start,
const uint8_t *  end 
)

Computes the 16 bit sum of the input buffer.

If there's and odd number of bytes in the buffer, the last one is padded and added to the checksum.

Parameters
startThe pointer to the start of the buffer.
endThe pointer to the end of the buffer(excluding the last element).
Returns
Returns the checksum between start and end (non inclusive) in network endian

Variable Documentation

const AddressRange<IPv4Address> Tins::private_ranges[]
Initial value:
= {
IPv4Address("192.168.0.0") / 16,
IPv4Address("10.0.0.0") / 8,
IPv4Address("172.16.0.0") / 12
}