libtins  4.0
 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  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  invalid_option_value
 Exception thrown when a PDU option is set using an incorrect value. 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  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  PacketWrapper
 Represents a sniffed packet. More...
 
class  Packet
 
class  PacketSender
 Sends packets through a network interface. 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  PDUIteratorBase
 
class  PDUIterator
 
class  ConstPDUIterator
 
class  PDUIteratorRange
 
class  PDUOption
 Represents a PDU option field. More...
 
class  PPPoE
 Represents a Point-to-point protocol over Ethernet PDU. More...
 
class  RawPDU
 
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  STP
 Represents a Spanning Tree Protocol PDU. More...
 
class  TCP
 Represents a TCP PDU. 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 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 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
< ConstPDUIterator
iterate_pdus (const PDU *pdu)
 
PDUIteratorRange
< ConstPDUIterator
iterate_pdus (const PDU &pdu)
 
PDUIteratorRange
< ConstPDUIterator
iterate_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)
 
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)
 
void sniff_loop_raw_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.

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
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/=
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
}