![]() |
TSDuck v3.40-4161
MPEG Transport Stream Toolkit
|
Networking features. More...
Files | |
file | tsIP.h |
Include the multiple and messy system headers for IP networking. | |
file | tsIPProtocols.h |
Definitions of protocols for IP networking. | |
file | tsIPUtils.h |
Utilities for IP networking. | |
Classes | |
class | ts::AbstractNetworkAddress |
Abstract base class for all network address and socket address classes. More... | |
class | ts::tlv::Connection< SAFETY > |
TCP connection using TLV messages. More... | |
class | ts::IPAddress |
A generic representation of an IP address, IPv4 or IPv6. More... | |
class | ts::IPAddressMask |
A combination of IP address and network mask or prefix. More... | |
class | ts::IPPacket |
Representation of a raw IPv4 or IPv6 packet. More... | |
class | ts::IPSocketAddress |
Generic socket address class (IPv4 or IPv6 address & port). More... | |
class | ts::MACAddress |
A basic representation of a MAC address. More... | |
class | ts::NetworkInterface |
Description of a network interface. More... | |
class | ts::PcapFile |
Read a pcap or pcapng capture file format. More... | |
class | ts::PcapFilter |
Read a pcap or pcapng file with packet filtering. More... | |
class | ts::PcapStream |
Read a TCP/IP session from a pcap or pcapng file. More... | |
class | ts::Socket |
Base class for TCP and UDP sockets. More... | |
class | ts::SRTSocket |
Secure Reliable Transport (SRT) Socket. More... | |
class | ts::TCPConnection |
Base class for a TCP/IP session. More... | |
class | ts::TCPServer |
Implementation of a TCP/IP server. More... | |
class | ts::TCPSocket |
Base class for TCP/IP sockets. More... | |
class | ts::TelnetConnection |
Implementation of a half-duplex line oriented telnet connection. More... | |
class | ts::UDPReceiver |
UDP datagram receiver with common command line options. More... | |
class | ts::UDPReceiverArgs |
Command line arguments for the class UDPReceiver. More... | |
class | ts::UDPReceiverArgsList |
Command line arguments for the class UDPReceiver. More... | |
class | ts::UDPSocket |
UDP Socket. More... | |
class | ts::URL |
Representation of a Uniform Resource Locator (URL). More... | |
class | ts::VLANId |
A structure which describes a VLAN identification. More... | |
class | ts::VLANIdStack |
A stack of VLAN identifiers, from outer to inner VLAN. More... | |
class | ts::WebRequest |
Perform a simple Web request (HTTP, HTTPS, FTP). More... | |
class | ts::WebRequestArgs |
Command line arguments for the class WebRequest. More... | |
Typedefs | |
using | ts::rtp_units = cn::duration< std::intmax_t, std::ratio< 1, RTP_RATE_MP2T > > |
Definition of a number of RTP clock units as a std::chrono::duration type. | |
using | ts::SysRecvBufferPointer = platform_specific |
Pointer type for the address of the data buffer for a recv() system call. | |
using | ts::SysSendBufferPointer = platform_specific |
Pointer type for the address of the data buffer for a send() system call. | |
using | ts::SysSendSizeType = platform_specific |
Integer type for the size of the data buffer for a send() system call. | |
using | ts::SysSocketLengthType = platform_specific |
Integer data type which receives the length of a struct sockaddr. | |
using | ts::SysSocketLingerType = platform_specific |
Integer data type for the field l_linger in the struct linger socket option. | |
using | ts::SysSocketMulticastLoopType = platform_specific |
Integer data type for the IPv4 multicast loop socket option. | |
using | ts::SysSocketMulticastLoopType6 = platform_specific |
Integer data type for the IPv6 multicast loop socket option. | |
using | ts::SysSocketMulticastTTLType = platform_specific |
Integer data type for the multicast Time To Live (TTL) socket option. | |
using | ts::SysSocketPktInfoType = platform_specific |
Integer data type for the IP_PKTINFO socket option. | |
using | ts::SysSocketSignedSizeType = platform_specific |
Integer data type for a "signed size" returned from send() or recv() system calls. | |
using | ts::SysSocketTClassType = platform_specific |
Integer data type for the Traffic Class (TCLASS) IPv6 socket option. | |
using | ts::SysSocketTOSType = platform_specific |
Integer data type for the Type Of Service (TOS) IPv4 socket option. | |
using | ts::SysSocketTTLType = platform_specific |
Integer data type for the Time To Live (TTL) socket option. | |
using | ts::SysSocketType = platform_specific |
Data type for socket descriptors as returned by the socket() system call. | |
using | ts::SysSocketV6OnlyType = platform_specific |
Integer data type for the IPV6_V6ONLY socket option. | |
using | ts::SysSockOptPointer = platform_specific |
Pointer type for the address of a socket option value. | |
Functions | |
const std::error_category & | ts::getaddrinfo_category () |
Get the std::error_category for getaddrinfo() error code (Unix only). | |
bool | ts::IPInitialize (Report &=(ts::CerrReport::Instance())) |
Initialize the IP libraries in the current process. | |
UString | ts::IPProtocolName (uint8_t protocol, bool long_format=false) |
Get the name of an IP protocol (UDP, TCP, etc). | |
int | ts::SysCloseSocket (SysSocketType sock) |
The close() system call which applies to socket devices. | |
bool | ts::TCPOrderedSequence (uint32_t seq1, uint32_t seq2) |
Check if two TCP sequence numbers are ordered, including wrapping back at 0xFFFFFFFF. | |
uint32_t | ts::TCPSequenceDiff (uint32_t seq1, uint32_t seq2) |
Compute the difference between two TCP sequence numbers, including wrapping back at 0xFFFFFFFF. | |
Variables | |
constexpr int | ts::SYS_SOCKET_ERR_NOTCONN = platform_specific |
System error code value meaning "peer socket not connected". | |
constexpr int | ts::SYS_SOCKET_ERR_RESET = platform_specific |
System error code value meaning "connection reset by peer". | |
constexpr SysSocketType | ts::SYS_SOCKET_INVALID = platform_specific |
Value of type SysSocketType which is returned by the socket() system call in case of failure. | |
constexpr int | ts::SYS_SOCKET_SHUT_RD = platform_specific |
Name of the option for the shutdown() system call which means "close on receive side". | |
constexpr int | ts::SYS_SOCKET_SHUT_RDWR = platform_specific |
Name of the option for the shutdown() system call which means "close on both directions". | |
constexpr int | ts::SYS_SOCKET_SHUT_WR = platform_specific |
Name of the option for the shutdown() system call which means "close on send side". | |
Networking features.
using ts::SysSocketLengthType = typedef platform_specific |
Integer data type which receives the length of a struct sockaddr.
Example:
using ts::SysSocketSignedSizeType = typedef platform_specific |
Integer data type for a "signed size" returned from send() or recv() system calls.
Example:
using ts::SysSocketTTLType = typedef platform_specific |
Integer data type for the Time To Live (TTL) socket option.
Example:
using ts::SysSocketMulticastTTLType = typedef platform_specific |
Integer data type for the multicast Time To Live (TTL) socket option.
Example:
using ts::SysSocketMulticastLoopType = typedef platform_specific |
Integer data type for the IPv4 multicast loop socket option.
Example:
using ts::SysSocketMulticastLoopType6 = typedef platform_specific |
Integer data type for the IPv6 multicast loop socket option.
Example:
using ts::SysSocketPktInfoType = typedef platform_specific |
Integer data type for the IP_PKTINFO socket option.
Example:
using ts::SysSocketLingerType = typedef platform_specific |
Integer data type for the field l_linger in the struct linger socket option.
All systems do not use the same type size and this may generate some warnings. Example:
using ts::SysSockOptPointer = typedef platform_specific |
Pointer type for the address of a socket option value.
The "standard" parameter type is void*
but some systems use other exotic values. Example:
using ts::SysRecvBufferPointer = typedef platform_specific |
Pointer type for the address of the data buffer for a recv() system call.
The "standard" parameter type is void*
but some systems use other exotic values. Example:
using ts::SysSendBufferPointer = typedef platform_specific |
Pointer type for the address of the data buffer for a send() system call.
The "standard" parameter type is void*
but some systems use other exotic values. Example:
|
strong |
enum ts::PcapNgBlockType : uint32_t |
List of pcap-ng block types.
Enumerator | |
---|---|
PCAPNG_SECTION_HEADER | Section header block. |
PCAPNG_INTERFACE_DESC | Interface description block. |
PCAPNG_OBSOLETE_PACKET | Obsolete packet block. |
PCAPNG_SIMPLE_PACKET | Enhanced packet block. |
PCAPNG_NAME_RES | Name resolution block. |
PCAPNG_INTERFACE_STAT | Interface statistics block. |
PCAPNG_ENHANCED_PACKET | Simple packet block. |
PCAPNG_SYSTEMD_JOURNAL | Systemd journal block. |
PCAPNG_DECRYPT_SECRETS | Decryption secrets block. |
PCAPNG_CUSTOM | Custom block, can be copied. |
PCAPNG_CUSTOM_NOCOPY | Custom block, cannot be copied. |
enum ts::PcapLinkType : uint16_t |
List of pcap LINKTYPE values.
Enumerator | |
---|---|
LINKTYPE_NULL | BSD loopback encapsulation. |
LINKTYPE_ETHERNET | IEEE 802.3 Ethernet (10Mb, 100Mb, 1000Mb, and up). |
LINKTYPE_AX25 | AX.25 packet, with nothing preceding it. |
LINKTYPE_IEEE802_5 | IEEE 802.5 Token Ring. |
LINKTYPE_ARCNET_BSD | ARCNET Data Packets, as described by 878.1-1999. |
LINKTYPE_SLIP | SLIP, encapsulated with a LINKTYPE_SLIP header. |
LINKTYPE_PPP | PPP, as per RFC 1661 and RFC 1662. |
LINKTYPE_FDDI | FDDI, as specified by ANSI INCITS 239-1994. |
LINKTYPE_PPP_HDLC | PPP in HDLC-like framing, as per RFC 1662, or Cisco PPP with HDLC framing. |
LINKTYPE_PPP_ETHER | PPPoE; the packet begins with a PPPoE header, as per RFC 2516. |
LINKTYPE_ATM_RFC1483 | RFC 1483 LLC/SNAP-encapsulated ATM. |
LINKTYPE_RAW | Raw IP; the packet begins with an IPv4 or IPv6 header. |
LINKTYPE_C_HDLC | Cisco PPP with HDLC framing, as per section 4.3.1 of RFC 1547. |
LINKTYPE_IEEE802_11 | IEEE 802.11 wireless LAN. |
LINKTYPE_FRELAY | Frame Relay LAPF frames. |
LINKTYPE_LOOP | OpenBSD loopback encapsulation. |
LINKTYPE_LINUX_SLL | Linux "cooked" capture encapsulation. |
LINKTYPE_LTALK | Apple LocalTalk. |
LINKTYPE_PFLOG | OpenBSD pflog. |
LINKTYPE_IEEE802_11_PRISM | Prism monitor mode information followed by an 802.11 header. |
LINKTYPE_IP_OVER_FC | RFC 2625 IP-over-Fibre Channel. |
LINKTYPE_SUNATM | ATM traffic, encapsulated as per the scheme used by SunATM devices. |
LINKTYPE_IEEE802_11_RADIOTAP | Radiotap link-layer information followed by an 802.11 header. |
LINKTYPE_ARCNET_LINUX | ARCNET Data Packets. |
LINKTYPE_APPLE_IP_OVER_IEEE1394 | Apple IP-over-IEEE 1394 cooked header. |
LINKTYPE_MTP2_WITH_PHDR | Signaling System 7 Message Transfer Part Level 2, ITU-T Q.703, preceded by a pseudo-header. |
LINKTYPE_MTP2 | Signaling System 7 Message Transfer Part Level 2, ITU-T Q.703. |
LINKTYPE_MTP3 | Signaling System 7 Message Transfer Part Level 3, ITU-T Q.704. |
LINKTYPE_SCCP | Signaling System 7 Signalling Connection Control Part, ITU-T Q.711. |
LINKTYPE_DOCSIS | DOCSIS MAC frames. |
LINKTYPE_LINUX_IRDA | Linux-IrDA packets. |
LINKTYPE_USER0 | Reserved for private use. |
LINKTYPE_USER15 | Reserved for private use. |
LINKTYPE_IEEE802_11_AVS | AVS monitor mode information followed by an 802.11 header. |
LINKTYPE_BACNET_MS_TP | BACnet MS/TP frames. |
LINKTYPE_PPP_PPPD | PPP in HDLC-like encapsulation. |
LINKTYPE_GPRS_LLC | General Packet Radio Service Logical Link Control. |
LINKTYPE_GPF_T | Transparent-mapped generic framing procedure, ITU-T G.7041/Y.1303. |
LINKTYPE_GPF_F | Frame-mapped generic framing procedure, ITU-T G.7041/Y.1303. |
LINKTYPE_LINUX_LAPD | Link Access Procedures on the D Channel (LAPD) frames. |
LINKTYPE_MFR | FRF.16.1 Multi-Link Frame Relay frames. |
LINKTYPE_BLUETOOTH_HCI_H4 | Bluetooth HCI UART transport layer. |
LINKTYPE_USB_LINUX | USB packets, beginning with a Linux USB header. |
LINKTYPE_PPI | Per-Packet Information information. |
LINKTYPE_IEEE802_15_4_WITHFCS | IEEE 802.15.4 Low-Rate Wireless Networks. |
LINKTYPE_SITA | Various link-layer types, with a pseudo-header, for SITA. |
LINKTYPE_ERF | Various link-layer types, with a pseudo-header, for Endace DAG cards. |
LINKTYPE_BLUETOOTH_HCI_H4_WITH_PHDR | Bluetooth HCI UART transport layer. |
LINKTYPE_AX25_KISS | AX.25 packet, with a 1-byte KISS header containing a type indicator. |
LINKTYPE_LAPD | Link Access Procedures on the D Channel (LAPD) frames, ITU-T Q.920 and Q.921. |
LINKTYPE_PPP_WITH_DIR | PPP, as per RFC 1661 and RFC 1662. |
LINKTYPE_C_HDLC_WITH_DIR | Cisco PPP with HDLC framing. |
LINKTYPE_FRELAY_WITH_DIR | Frame Relay LAPF frames. |
LINKTYPE_LAPB_WITH_DIR | Link Access Procedure, Balanced (LAPB). |
LINKTYPE_IPMB_LINUX | IPMB over an I2C circuit. |
LINKTYPE_FLEXRAY | FlexRay automotive bus frames. |
LINKTYPE_IEEE802_15_4_NONASK_PHY | IEEE 802.15.4 Low-Rate Wireless Networks. |
LINKTYPE_USB_LINUX_MMAPPED | USB packets, beginning with a Linux USB header. |
LINKTYPE_FC_2 | Fibre Channel FC-2 frames, beginning with a Frame_Header. |
LINKTYPE_FC_2_WITH_FRAME_DELIMS | Fibre Channel FC-2 frames. |
LINKTYPE_IPNET | Solaris ipnet pseudo-header. |
LINKTYPE_CAN_SOCKETCAN | CAN (Controller Area Network) frames, with a pseudo-header followed by the frame payload. |
LINKTYPE_IPV4 | Raw IPv4; the packet begins with an IPv4 header. |
LINKTYPE_IPV6 | Raw IPv6; the packet begins with an IPv6 header. |
LINKTYPE_IEEE802_15_4_NOFCS | IEEE 802.15.4 Low-Rate Wireless Network. |
LINKTYPE_DBUS | Raw D-Bus messages. |
LINKTYPE_DVB_CI | DVB-CI. |
LINKTYPE_MUX27010 | Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but not the same as, 27.010). |
LINKTYPE_STANAG_5066_D_PDU | D_PDUs as described by NATO standard STANAG 5066. |
LINKTYPE_NFLOG | Linux netlink NETLINK NFLOG socket log messages. |
LINKTYPE_NETANALYZER | Pseudo-header for Hilscher Gesellschaft für Systemautomation mbH netANALYZER devices. |
LINKTYPE_NETANALYZER_TRANSPARENT | Pseudo-header for Hilscher Gesellschaft für Systemautomation mbH netANALYZER devices. |
LINKTYPE_IPOIB | IP-over-InfiniBand. |
LINKTYPE_MPEG_2_TS | MPEG-2 Transport Stream transport packets, ISO 13818-1. |
LINKTYPE_NG40 | Pseudo-header for ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format. |
LINKTYPE_NFC_LLCP | Pseudo-header for NFC LLCP packet captures. |
LINKTYPE_INFINIBAND | Raw InfiniBand frames. |
LINKTYPE_SCTP | SCTP packets, RFC 4960. |
LINKTYPE_USBPCAP | USB packets, beginning with a USBPcap header. |
LINKTYPE_RTAC_SERIAL | Serial-line packet header for the Schweitzer Engineering Laboratories "RTAC" product. |
LINKTYPE_BLUETOOTH_LE_LL | Bluetooth Low Energy air interface Link Layer packets. |
LINKTYPE_NETLINK | Linux Netlink capture encapsulation. |
LINKTYPE_BLUETOOTH_LINUX_MONITOR | Bluetooth Linux Monitor encapsulation of traffic for the BlueZ stack. |
LINKTYPE_BLUETOOTH_BREDR_BB | Bluetooth Basic Rate and Enhanced Data Rate baseband packets. |
LINKTYPE_BLUETOOTH_LE_LL_WITH_PHDR | Bluetooth Low Energy link-layer packets. |
LINKTYPE_PROFIBUS_DL | PROFIBUS data link layer packets. |
LINKTYPE_PKTAP | Apple PKTAP capture encapsulation. |
LINKTYPE_EPON | Ethernet-over-passive-optical-network packets. |
LINKTYPE_IPMI_HPM_2 | IPMI trace packets. |
LINKTYPE_ZWAVE_R1_R2 | Z-Wave RF profile R1 and R2 packets. |
LINKTYPE_ZWAVE_R3 | Z-Wave RF profile R3 packets. |
LINKTYPE_WATTSTOPPER_DLM | Formats for WattStopper Digital Lighting Management (DLM). |
LINKTYPE_ISO_14443 | Messages between ISO 14443 contactless smartcards. |
LINKTYPE_RDS | Radio data system (RDS) groups, IEC 62106. |
LINKTYPE_USB_DARWIN | USB packets, beginning with a Darwin (macOS, etc.) USB header. |
LINKTYPE_SDLC | SDLC packets. |
LINKTYPE_LORATAP | LoRaTap pseudo-header, followed by the payload. |
LINKTYPE_VSOCK | Protocol host/guest in VMware and KVM hypervisors. |
LINKTYPE_NORDIC_BLE | Messages to and from a Nordic Semiconductor nRF Sniffer for Bluetooth LE packets. |
LINKTYPE_DOCSIS31_XRA31 | DOCSIS packets and bursts. |
LINKTYPE_ETHERNET_MPACKET | mPackets, as specified by IEEE 802.3br Figure 99-4. |
LINKTYPE_DISPLAYPORT_AUX | DisplayPort AUX channel monitoring. |
LINKTYPE_LINUX_SLL2 | Linux "cooked" capture encapsulation v2. |
LINKTYPE_OPENVIZSLA | Openvizsla FPGA-based USB sniffer. |
LINKTYPE_EBHSCR | Elektrobit High Speed Capture and Replay (EBHSCR) format. |
LINKTYPE_VPP_DISPATCH | Records in traces from the http://!<fd.io VPP graph dispatch tracer. |
LINKTYPE_DSA_TAG_BRCM | Ethernet frames, with a switch tag. |
LINKTYPE_DSA_TAG_BRCM_PREPEND | Ethernet frames, with a switch tag. |
LINKTYPE_IEEE802_15_4_TAP | IEEE 802.15.4 Low-Rate Wireless Networks. |
LINKTYPE_DSA_TAG_DSA | Ethernet frames, with a switch tag. |
LINKTYPE_DSA_TAG_EDSA | Ethernet frames, with a programmable Ethernet type switch tag. |
LINKTYPE_ELEE | Payload of lawful intercept packets using the ELEE protocol. |
LINKTYPE_Z_WAVE_SERIAL | Serial between host and Z-Wave chip over an RS-232 or USB serial connection. |
LINKTYPE_USB_2_0 | USB 2.0, 1.1, or 1.0 packet. |
LINKTYPE_ATSC_ALP | ATSC Link-Layer Protocol frames. |
LINKTYPE_ETW | Event Tracing for Windows messages. |
LINKTYPE_UNKNOWN | Placeholder for unknown link type. |
enum ts::PcapBsdProtocols : uint32_t |
Protocol types for LINKTYPE_NULL and LINKTYPE_LOOP (BSD loopback encapsulation).
enum ts::PcapNgOptionCode : uint32_t |
List of pcap-ng option codes.
Enumerator | |
---|---|
PCAPNG_OPT_ENDOFOPT | End of option list. |
PCAPNG_OPT_COMMENT | Comment. |
PCAPNG_SHB_HARDWARE | System hardware. |
PCAPNG_SHB_OS | System operating system. |
PCAPNG_SHB_USERAPPL | User application. |
PCAPNG_IF_NAME | Interface name. |
PCAPNG_IF_DESCRIPTION | Interface description. |
PCAPNG_IF_IPV4ADDR | Interface IPv4 address. |
PCAPNG_IF_IPV6ADDR | Interface IPv6 address. |
PCAPNG_IF_MACADDR | Interface MAC address. |
PCAPNG_IF_EUIADDR | Interface EUI address. |
PCAPNG_IF_SPEED | Interface speed in b/s. |
PCAPNG_IF_TSRESOL | Time resolution. |
PCAPNG_IF_TZONE | Time zone. |
PCAPNG_IF_FILTER | Canpture filter. |
PCAPNG_IF_OS | Interface operating system. |
PCAPNG_IF_FCSLEN | Frame Check Sequence length. |
PCAPNG_IF_TSOFFSET | Timestamps offset. |
PCAPNG_IF_HARDWARE | Interface hardware. |
PCAPNG_IF_TXSPEED | Interface transmission speed. |
PCAPNG_IF_RXSPEED | Interface reception speed. |
UString ts::IPProtocolName | ( | uint8_t | protocol, |
bool | long_format = false |
||
) |
Get the name of an IP protocol (UDP, TCP, etc).
[in] | protocol | Protocol identifier, as set in IP header. |
[in] | long_format | If false (the default), return a simple acronym. When true, return a full description string. |
bool ts::TCPOrderedSequence | ( | uint32_t | seq1, |
uint32_t | seq2 | ||
) |
Check if two TCP sequence numbers are ordered, including wrapping back at 0xFFFFFFFF.
[in] | seq1 | First TCP sequence number. |
[in] | seq2 | Second TCP sequence number. |
uint32_t ts::TCPSequenceDiff | ( | uint32_t | seq1, |
uint32_t | seq2 | ||
) |
Compute the difference between two TCP sequence numbers, including wrapping back at 0xFFFFFFFF.
[in] | seq1 | First TCP sequence number. |
[in] | seq2 | Second TCP sequence number which must logically follow seq1. |
bool ts::IPInitialize | ( | Report & | = (ts::CerrReport::Instance()) | ) |
Initialize the IP libraries in the current process.
On some systems (UNIX), there is no need to initialize IP. On other systems (Windows), using IP and socket without initialization fails. This method is a portable way to ensure that IP is properly initialized. It shall be called at least once before using IP in the application.
const std::error_category & ts::getaddrinfo_category | ( | ) |
Get the std::error_category for getaddrinfo() error code (Unix only).
|
inline |
The close() system call which applies to socket devices.
The "standard" name is close
but some systems use other exotic names.
[in] | sock | System socket descriptor. |
|
constexpr |
Value of type SysSocketType which is returned by the socket() system call in case of failure.
Example:
|
constexpr |
Name of the option for the shutdown() system call which means "close on both directions".
Example:
|
constexpr |
Name of the option for the shutdown() system call which means "close on receive side".
Example:
|
constexpr |
Name of the option for the shutdown() system call which means "close on send side".
Example: