Address
4 days ago
Range
4 days ago
Service
4 days ago
Factory.php
4 days ago
ParseStringFlag.php
1 year ago
ParseStringFlag.php
76 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\IPLib; |
| 4 | |
| 5 | /** |
| 6 | * Flags for the parseString() methods. |
| 7 | * |
| 8 | * @since 1.17.0 |
| 9 | * @internal |
| 10 | */ |
| 11 | class ParseStringFlag |
| 12 | { |
| 13 | /** |
| 14 | * Use this flag if the input string may include the port. |
| 15 | * |
| 16 | * @var int |
| 17 | */ |
| 18 | const MAY_INCLUDE_PORT = 1; |
| 19 | /** |
| 20 | * Use this flag if the input string may include a zone ID. |
| 21 | * |
| 22 | * @var int |
| 23 | */ |
| 24 | const MAY_INCLUDE_ZONEID = 2; |
| 25 | /** |
| 26 | * Use this flag if IPv4 addresses may be in decimal/octal/hexadecimal format. |
| 27 | * This notation is accepted by the implementation of inet_aton and inet_addr of the libc implementation of GNU, Windows and Mac (but not Musl), but not by inet_pton and ip2long. |
| 28 | * |
| 29 | * @var int |
| 30 | * |
| 31 | * @example 1.08.0x10.0 => 5.0.0.1 |
| 32 | * @example 5.256 => 5.0.1.0 |
| 33 | * @example 5.0.256 => 5.0.1.0 |
| 34 | * @example 123456789 => 7.91.205.21 |
| 35 | */ |
| 36 | const IPV4_MAYBE_NON_DECIMAL = 4; |
| 37 | /** |
| 38 | * Use this flag if IPv4 subnet ranges may be in compact form. |
| 39 | * |
| 40 | * @example 127/24 => 127.0.0.0/24 |
| 41 | * @example 10/8 => 10.0.0.0/8 |
| 42 | * @example 10/24 => 10.0.0.0/24 |
| 43 | * @example 10.10.10/24 => 10.10.10.0/24 |
| 44 | * |
| 45 | * @var int |
| 46 | */ |
| 47 | const IPV4SUBNET_MAYBE_COMPACT = 8; |
| 48 | /** |
| 49 | * Use this flag if IPv4 addresses may be in non quad-dotted notation. |
| 50 | * This notation is accepted by the implementation of inet_aton and inet_addr of the libc implementation of GNU, Windows and Mac (but not Musl), but not by inet_pton and ip2long. |
| 51 | * |
| 52 | * @var int |
| 53 | * |
| 54 | * @example 5.1 => 5.0.0.1 |
| 55 | * @example 5.256 => 5.0.1.0 |
| 56 | * @example 5.0.256 => 5.0.1.0 |
| 57 | * @example 123456789 => 7.91.205.21 |
| 58 | * |
| 59 | * @see https://man7.org/linux/man-pages/man3/inet_addr.3.html#DESCRIPTION |
| 60 | * @see https://www.freebsd.org/cgi/man.cgi?query=inet_net&sektion=3&apropos=0&manpath=FreeBSD+12.2-RELEASE+and+Ports#end |
| 61 | * @see http://git.musl-libc.org/cgit/musl/tree/src/network/inet_aton.c?h=v1.2.2 |
| 62 | */ |
| 63 | const IPV4ADDRESS_MAYBE_NON_QUAD_DOTTED = 16; |
| 64 | /** |
| 65 | * Use this flag if you want to accept parsing IPv4/IPv6 addresses in Reverse DNS Lookup Address format. |
| 66 | * |
| 67 | * @var int |
| 68 | * |
| 69 | * @since 1.18.0 |
| 70 | * |
| 71 | * @example 140.13.12.10.in-addr.arpa => 10.12.13.140 |
| 72 | * @example b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.0.0.0.0.1.2.3.4.ip6.arpa => 4321:0:1:2:3:4:567:89ab |
| 73 | */ |
| 74 | const ADDRESS_MAYBE_RDNS = 32; |
| 75 | } |
| 76 |