PHP 클래스 PHPDaemon\Utils\Binary

저자: Vasily Zorin ([email protected])
상속: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog
파일 보기 프로젝트 열기: kakserpom/phpdaemon 1 사용 예제들

공개 메소드들

메소드 설명
LV ( string $str, integer $len = 1, boolean $lrev = false ) : string Build length-value binary snippet
LVnull ( string $str ) : string Build nul-terminated string, with 2-byte of length
b2i ( string $str, boolean $l = false ) : integer Convert bytes into integer
bitmap2bytes ( string $bitmap, integer $check_len ) : string | false Convert bitmap into bytes
byte ( integer $int ) : string Build byte
bytes2int ( string $str, boolean $l = false ) : integer Convert bytes into integer
dword ( integer $int ) : string Build double word (4 bytes) big-endian
dwordl ( integer $int ) : string Build double word (4 bytes) little endian
flags2bitarray ( array $flags, integer $len = 4 ) : string Convert array of flags into bit array
getByte ( &$p ) : integer Parse byte, and remove it
getChar ( &$p ) : string Get single-byte character
getDWord ( &$p, boolean $l = false ) : integer Get double word (4 bytes)
getLV ( &$p, integer $l = 1, boolean $nul = false, boolean $lrev = false ) : string Parse length-value structure
getQword ( &$p, boolean $l = false ) : integer Parse quadro word (8 bytes)
getStrQWord ( &$p, boolean $l = false ) : string Get quadro word (8 bytes)
getStrWord ( &$p, boolean $l = false ) : string Get word (2 bytes)
getString ( &$str ) : string Parse nul-terminated string
getWord ( &$p, boolean $l = false ) : integer Parse word (2 bytes)
getbitmap ( integer $byte ) : string Get bitmap
i2b ( integer $len, integer $int, boolean $l = false ) : string Converts integer to binary string
int2bytes ( integer $len, integer $int, boolean $l = false ) : string Converts integer to binary string
labels ( string $q ) : string Build structure of labels
parseLabels ( &$data, string $orig = null ) : string Parse structure of labels
qword ( integer $int ) : string Build quadro word (8 bytes) big endian
qwordl ( integer $int ) : string Build quadro word (8 bytes) little endian
word ( integer $int ) : string Build word (2 bytes) big-endian
wordl ( integer $int ) : string Build word (2 bytes) little-endian

메소드 상세

LV() 공개 정적인 메소드

Build length-value binary snippet
public static LV ( string $str, integer $len = 1, boolean $lrev = false ) : string
$str string Data
$len integer Number of bytes to encode length. Default is 1
$lrev boolean Reverse?
리턴 string

LVnull() 공개 정적인 메소드

Build nul-terminated string, with 2-byte of length
public static LVnull ( string $str ) : string
$str string Data
리턴 string

b2i() 공개 정적인 메소드

Convert bytes into integer
public static b2i ( string $str, boolean $l = false ) : integer
$str string Bytes
$l boolean Little endian? Default is false
리턴 integer

bitmap2bytes() 공개 정적인 메소드

Convert bitmap into bytes
public static bitmap2bytes ( string $bitmap, integer $check_len ) : string | false
$bitmap string Bitmap
$check_len integer Check length?
리턴 string | false

byte() 공개 정적인 메소드

Build byte
public static byte ( integer $int ) : string
$int integer Byte number
리턴 string

bytes2int() 공개 정적인 메소드

Convert bytes into integer
public static bytes2int ( string $str, boolean $l = false ) : integer
$str string Bytes
$l boolean Little endian? Default is false
리턴 integer

dword() 공개 정적인 메소드

Build double word (4 bytes) big-endian
public static dword ( integer $int ) : string
$int integer Integer
리턴 string

dwordl() 공개 정적인 메소드

Build double word (4 bytes) little endian
public static dwordl ( integer $int ) : string
$int integer Integer
리턴 string

flags2bitarray() 공개 정적인 메소드

Convert array of flags into bit array
public static flags2bitarray ( array $flags, integer $len = 4 ) : string
$flags array Flags
$len integer Length. Default is 4
리턴 string

getByte() 공개 정적인 메소드

Parse byte, and remove it
public static getByte ( &$p ) : integer
리턴 integer

getChar() 공개 정적인 메소드

Get single-byte character
public static getChar ( &$p ) : string
리턴 string

getDWord() 공개 정적인 메소드

Get double word (4 bytes)
public static getDWord ( &$p, boolean $l = false ) : integer
$l boolean Little endian?
리턴 integer

getLV() 공개 정적인 메소드

Parse length-value structure
public static getLV ( &$p, integer $l = 1, boolean $nul = false, boolean $lrev = false ) : string
$l integer Number of length bytes
$nul boolean Nul-terminated? Default is false
$lrev boolean Length is little endian?
리턴 string

getQword() 공개 정적인 메소드

Parse quadro word (8 bytes)
public static getQword ( &$p, boolean $l = false ) : integer
$l boolean Little endian?
리턴 integer

getStrQWord() 공개 정적인 메소드

Get quadro word (8 bytes)
public static getStrQWord ( &$p, boolean $l = false ) : string
$l boolean Little endian?
리턴 string

getStrWord() 공개 정적인 메소드

Get word (2 bytes)
public static getStrWord ( &$p, boolean $l = false ) : string
$l boolean Little endian?
리턴 string

getString() 공개 정적인 메소드

Parse nul-terminated string
public static getString ( &$str ) : string
리턴 string

getWord() 공개 정적인 메소드

Parse word (2 bytes)
public static getWord ( &$p, boolean $l = false ) : integer
$l boolean Little endian?
리턴 integer

getbitmap() 공개 정적인 메소드

Get bitmap
public static getbitmap ( integer $byte ) : string
$byte integer Byte
리턴 string

i2b() 공개 정적인 메소드

Converts integer to binary string
public static i2b ( integer $len, integer $int, boolean $l = false ) : string
$len integer Length
$int integer Integer
$l boolean Optional. Little endian. Default value - false
리턴 string Resulting binary string

int2bytes() 공개 정적인 메소드

Converts integer to binary string
public static int2bytes ( integer $len, integer $int, boolean $l = false ) : string
$len integer Length
$int integer Integer
$l boolean Optional. Little endian. Default value - false
리턴 string Resulting binary string

labels() 공개 정적인 메소드

Build structure of labels
public static labels ( string $q ) : string
$q string Dot-separated labels list
리턴 string

parseLabels() 공개 정적인 메소드

Parse structure of labels
public static parseLabels ( &$data, string $orig = null ) : string
$orig string Original packet
리턴 string Dot-separated labels list

qword() 공개 정적인 메소드

Build quadro word (8 bytes) big endian
public static qword ( integer $int ) : string
$int integer Integer
리턴 string

qwordl() 공개 정적인 메소드

Build quadro word (8 bytes) little endian
public static qwordl ( integer $int ) : string
$int integer Integer
리턴 string

word() 공개 정적인 메소드

Build word (2 bytes) big-endian
public static word ( integer $int ) : string
$int integer Integer
리턴 string

wordl() 공개 정적인 메소드

Build word (2 bytes) little-endian
public static wordl ( integer $int ) : string
$int integer Integer
리턴 string