libtins  4.0
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  AddressRange
 Represents a range of addresses. More...
 
class  AddressRangeIterator
 AddressRange iterator class. More...
 
class  ARP
 Represents an ARP PDU. More...
 
class  bad_tins_cast
 Exception thrown when a call to tins_cast fails. More...
 
class  BootP
 Represents a BootP PDU. More...
 
class  callback_not_set
 Exception thrown when a required callback for an object is not set. More...
 
class  ConstPDUIterator
 
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  Dot11
 Class representing an 802.11 frame. More...
 
class  Dot11Ack
 
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  Dot11Authentication
 IEEE 802.11 Authentication Request frame. More...
 
class  Dot11Beacon
 Represents an IEEE 802.11 Beacon. More...
 
class  Dot11BlockAck
 Class that represents an 802.11 block ack frame. More...
 
class  Dot11BlockAckRequest
 Class that represents an 802.11 Block Ack Request PDU. More...
 
class  Dot11CFEnd
 
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  Dot11Data
 Represents an IEEE 802.11 data frame. More...
 
class  Dot11Deauthentication
 IEEE 802.11 Deauthentication frame. More...
 
class  Dot11Disassoc
 Class representing a Disassociation frame in the IEEE 802.11 Protocol. More...
 
class  Dot11EndCFAck
 
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  Dot11PSPoll
 
class  Dot11QoSData
 
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  Dot11RTS
 IEEE 802.11 RTS frame. More...
 
class  Dot1Q
 
class  Dot3
 Class representing an IEEE 802.3 PDU. More...
 
class  EAPOL
 Represents the EAP encapsulation over LAN. More...
 
class  EAPOLHandshake
 Generic EAPOL handshake. More...
 
struct  Ethernet
 
class  EthernetII
 Represents an Ethernet II PDU. More...
 
class  exception_base
 Base class for all libtins exceptions. More...
 
class  feature_disabled
 Exception thrown when a feature has been disabled at compile time. More...
 
class  field_not_present
 Exception thrown when a field is not present in frame. More...
 
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  invalid_address
 Exception thrown when an invalid string representation of an address is provided. More...
 
class  invalid_domain_name
 Exception thrown when an invalid domain name is parsed. More...
 
class  invalid_interface
 Exception thrown when PDU::send requires a valid interface, but an invalid is used. More...
 
class  invalid_ipv6_extension_header
 Exception thrown when an IPv6 extension header is being created from invalid data. More...
 
class  invalid_option_value
 Exception thrown when a PDU option is set using an incorrect value. More...
 
class  invalid_packet
 Exception thrown when an invalid packet is provided to some function. More...
 
class  invalid_pcap_filter
 Exception thrown when an invalid pcap filter is compiled. More...
 
class  invalid_socket_type
 Exception thrown when an invalid socket type is provided to PacketSender. More...
 
class  IP
 Class that represents an IP PDU. More...
 
class  IPSecAH
 Represents an IPSec Authentication Header. More...
 
class  IPSecESP
 Represents an IPSec Authentication Header. More...
 
class  IPv4Address
 Abstraction of an IPv4 address. More...
 
class  IPv4Reassembler
 Reassembles fragmented IP packets. More...
 
class  IPv4ReassemblerProxy
 
class  IPv6
 
class  IPv6Address
 
class  LLC
 Representing a LLC frame. More...
 
class  Loopback
 Represents a Loopback PDU. More...
 
class  malformed_option
 Exception thrown when a malformed option is found. More...
 
class  malformed_packet
 Exception thrown when a malformed packet is parsed. More...
 
class  MPLS
 Represents an MPLS PDU. More...
 
class  NetworkInterface
 Abstraction of a network interface. More...
 
class  option_not_found
 Exception thrown when an option is not found. More...
 
class  option_payload_too_large
 Exception thrown when a payload is too large to fit into a PDUOption. More...
 
class  Packet
 
class  PacketSender
 Sends packets through a network interface. More...
 
class  PacketWrapper
 Represents a sniffed packet. More...
 
class  pcap_error
 Generic pcap error. More...
 
class  pcap_open_failed
 Exception thrown when opening a pcap handle fails. More...
 
class  PDU
 Base class for protocol data units. More...
 
class  pdu_not_found
 Exception thrown when a PDU is not found when using PDU::rfind_pdu. More...
 
class  pdu_not_serializable
 Exception thrown when serialiation of a non-serializable PDU is attempted. More...
 
class  PDUCacher
 PDU wrapper that caches the result of the wrapped PDU's serialization. More...
 
class  PDUIterator
 
class  PDUIteratorBase
 
class  PDUIteratorRange
 
class  PDUOption
 Represents a PDU option field. More...
 
class  PPPoE
 Represents a Point-to-point protocol over Ethernet PDU. More...
 
class  protocol_disabled
 Exception thrown when sniffing a protocol that has been disabled at compile time. More...
 
class  RadioTap
 Class that represents the IEEE 802.11 radio tap header. More...
 
class  RawPDU
 
class  RC4EAPOL
 Class that represents the RC4 EAPOL PDU. More...
 
class  RSNEAPOL
 Class that represents the RSN EAPOL PDU. More...
 
class  RSNHandshakeCapturer
 
class  RSNInformation
 Class that models the RSN information structure. More...
 
class  serialization_error
 Exception thrown when serializing a packet fails. More...
 
class  SLL
 Represents a Linux cooked-mode capture (SLL) PDU. More...
 
class  small_uint
 Represents a field of n bits. More...
 
class  SNAP
 Represents a SNAP frame. More...
 
struct  sniff_data
 
class  socket_close_error
 Exception thrown when PacketSender fails to close a socket. More...
 
class  socket_open_error
 Exception thrown when PacketSender fails to open a socket. More...
 
class  socket_write_error
 Exception thrown when PacketSender fails to write on a socket. More...
 
class  STP
 Represents a Spanning Tree Protocol PDU. More...
 
class  stream_not_found
 Exception thrown when a stream is not found. More...
 
class  TCP
 Represents a TCP PDU. More...
 
class  Timestamp
 Represents a packet timestamp. More...
 
class  UDP
 Represents an UDP PDU. More...
 
class  unknown_link_type
 Exception thrown when an unkown link layer PDU type is found while sniffing. More...
 
class  unsupported_function
 Exception thrown when a function not supported on the current OS is called. More...
 
class  value_too_large
 

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 *, TimestampPtrPacket
 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 Concrete >
bool operator== (const PDUIteratorBase< Concrete > &lhs, const PDUIteratorBase< Concrete > &rhs)
 
template<typename Concrete >
bool operator!= (const PDUIteratorBase< Concrete > &lhs, const PDUIteratorBase< Concrete > &rhs)
 
PDUIteratorRange< PDUIteratoriterate_pdus (PDU *pdu)
 
PDUIteratorRange< PDUIteratoriterate_pdus (PDU &pdu)
 
PDUIteratorRange< PDUIteratoriterate_pdus (Packet &packet)
 
PDUIteratorRange< ConstPDUIteratoriterate_pdus (const PDU *pdu)
 
PDUIteratorRange< ConstPDUIteratoriterate_pdus (const PDU &pdu)
 
PDUIteratorRange< ConstPDUIteratoriterate_pdus (const Packet &packet)
 
PacketSender::SocketType pdu_type_to_sender_type (PDU::PDUType type)
 
ostream & operator<< (ostream &output, const IPv4Address &addr)
 
ostream & operator<< (ostream &os, const IPv6Address &addr)
 
const char * make_error_string ()
 
template<typename T >
void add_integral_option (RadioTap &radio, RadioTap::PresentFlags type, T value)
 
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)
 
void sniff_loop_raw_handler (u_char *user, const struct pcap_pkthdr *h, const u_char *bytes)
 
void sniff_loop_dot11_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)
 
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
 
const int MICROSECONDS_IN_SECOND = 1000000
 

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

PDUIteratorRange< PDUIterator > Tins::iterate_pdus ( PDU pdu)

Creates an iterator range out of a PDU

PDUIteratorRange< PDUIterator > Tins::iterate_pdus ( PDU pdu)

Creates an iterator range out of a PDU

PDUIteratorRange< PDUIterator > Tins::iterate_pdus ( Packet packet)

Creates an iterator range out of a PDU

PDUIteratorRange< ConstPDUIterator > Tins::iterate_pdus ( const PDU pdu)

Creates an iterator range out of a PDU

PDUIteratorRange< ConstPDUIterator > Tins::iterate_pdus ( const PDU pdu)

Creates an iterator range out of a PDU

PDUIteratorRange< ConstPDUIterator > Tins::iterate_pdus ( const Packet packet)

Creates an iterator range out of a packet

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.
template<typename Concrete >
bool Tins::operator!= ( const PDUIteratorBase< Concrete > &  lhs,
const PDUIteratorBase< Concrete > &  rhs 
)

Compares iterators for equality

Parameters
lhsThe left hand side iterator to be compared
rhsThe right hand side iterator to be compared
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/=
template<typename Concrete >
bool Tins::operator== ( const PDUIteratorBase< Concrete > &  lhs,
const PDUIteratorBase< Concrete > &  rhs 
)

Compares iterators for equality

Parameters
lhsThe left hand side iterator to be compared
rhsThe right hand side iterator to be compared

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
}