MediaWiki  REL1_31
UDPTransport Class Reference

A generic class to send a message over UDP. More...

Public Member Functions

 __construct ( $host, $port, $domain, $prefix=false)
 
 emit ( $text)
 

Static Public Member Functions

static newFromString ( $info)
 

Public Attributes

 $domain
 
 $port
 
 $prefix
 

Private Attributes

 $host
 

Detailed Description

A generic class to send a message over UDP.

If a message prefix is provided to the constructor or via UDPTransport::newFromString(), the payload of the UDP datagrams emitted will be formatted with the prefix and a single space at the start of each line. This is the payload format expected by the udp2log service.

Since
1.25

Definition at line 31 of file UDPTransport.php.

Constructor & Destructor Documentation

◆ __construct()

UDPTransport::__construct (   $host,
  $port,
  $domain,
  $prefix = false 
)
Parameters
string$hostIP address to send to
int$portport number
int$domainAF_INET or AF_INET6 constant
string | bool$prefixPrefix to use, false for no prefix

Definition at line 40 of file UDPTransport.php.

References $domain, $host, $port, $prefix, and port().

Member Function Documentation

◆ emit()

UDPTransport::emit (   $text)
Parameters
string$text

Definition at line 77 of file UDPTransport.php.

References port().

◆ newFromString()

static UDPTransport::newFromString (   $info)
static
Parameters
string$infoIn the format of "udp://host:port/prefix"
Returns
UDPTransport
Exceptions
InvalidArgumentException

Definition at line 52 of file UDPTransport.php.

References $domain, $host, $port, $prefix, and IP\isIPv4().

Referenced by MediaWiki\Logger\LegacyLogger\emit(), and UDPRCFeedEngine\send().

Member Data Documentation

◆ $domain

UDPTransport::$domain

Definition at line 32 of file UDPTransport.php.

Referenced by __construct(), and newFromString().

◆ $host

UDPTransport::$host
private

Definition at line 32 of file UDPTransport.php.

Referenced by __construct(), and newFromString().

◆ $port

UDPTransport::$port

Definition at line 32 of file UDPTransport.php.

Referenced by __construct(), and newFromString().

◆ $prefix

UDPTransport::$prefix

Definition at line 32 of file UDPTransport.php.

Referenced by __construct(), and newFromString().


The documentation for this class was generated from the following file: