FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18687&edit=1

ID: 18687
Comment by: [email protected]
Reported By: koyama at hoge dot org
Summary: support RFC5952 compatible format
Status: Open
Type: Feature/Change Request
Package: Net_IPv6
Operating System: CentOS
Package Version: 1.2.1
PHP Version: 5.3.6
Roadmap Versions:
New Comment:

Uploading a patch is not working. paste here.

--- IPv6.php 2011-07-26 20:38:19.000000000 +0900
+++ IPv6.php.new 2011-07-26 20:37:46.000000000 +0900
@@ -748,6 +748,32 @@
}

// }}}
+ // {{{ recommendedFormat()
+ /**
+ * represent IPv6 address in RFC5952 format.
+ *
+ * @param String $ip a valid IPv6-adress (hex format)
+ *
+ * @return String the recommended representation of IPv6-adress
(hex format)
+ * @access public
+ * @see compress()
+ * @static
+ * @author koyama at hoge dot org
+ */
+ function recommendedFormat($ip)
+ {
+ $compressed = self::compress($ip, true);
+ // RFC5952 4.2.2
+ // The symbol "::" MUST NOT be used to shorten just one
+ // 16-bit 0 field.
+ if ((substr_count($compressed, ':') == 7) &&
+ (strpos($compressed, '::') !== false)) {
+ $compressed = str_replace('::', ':0:', $compressed);
+ }
+ return $compressed;
+ }
+
+ // }}}
// {{{ isCompressible()

/**


Previous Comments:
------------------------------------------------------------------------

[2011-07-26 13:55:17] koyama

Description:
------------
The new RFC5952, has established a recommended text representation of
IPv6 address. The compress () output will conform to it almost a little
different.

In RFC5952 4.2.2, "The symbol "::" MUST NOT be used to shorten just one
16-bit 0 field." I wrote new method for it.

------------------------------------------------------------------------

Search Discussions

  • Alexander Merz at Jul 26, 2011 at 12:09 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18687&edit=1

    ID: 18687
    Updated by: [email protected]
    Reported By: koyama at hoge dot org
    Summary: support RFC5952 compatible format
    Status: Open
    Type: Feature/Change Request
    Package: Net_IPv6
    Operating System: CentOS
    Package Version: 1.2.1
    PHP Version: 5.3.6
    -Assigned To:
    +Assigned To: alexmerz
    Roadmap Versions:
    New Comment:

    -Assigned To:
    +Assigned To: alexmerz



    Previous Comments:
    ------------------------------------------------------------------------

    [2011-07-26 13:58:28] koyama

    Uploading a patch is not working. paste here.

    --- IPv6.php 2011-07-26 20:38:19.000000000 +0900
    +++ IPv6.php.new 2011-07-26 20:37:46.000000000 +0900
    @@ -748,6 +748,32 @@
    }

    // }}}
    + // {{{ recommendedFormat()
    + /**
    + * represent IPv6 address in RFC5952 format.
    + *
    + * @param String $ip a valid IPv6-adress (hex format)
    + *
    + * @return String the recommended representation of IPv6-adress
    (hex format)
    + * @access public
    + * @see compress()
    + * @static
    + * @author koyama at hoge dot org
    + */
    + function recommendedFormat($ip)
    + {
    + $compressed = self::compress($ip, true);
    + // RFC5952 4.2.2
    + // The symbol "::" MUST NOT be used to shorten just one
    + // 16-bit 0 field.
    + if ((substr_count($compressed, ':') == 7) &&
    + (strpos($compressed, '::') !== false)) {
    + $compressed = str_replace('::', ':0:', $compressed);
    + }
    + return $compressed;
    + }
    +
    + // }}}
    // {{{ isCompressible()

    /**

    ------------------------------------------------------------------------

    [2011-07-26 13:55:17] koyama

    Description:
    ------------
    The new RFC5952, has established a recommended text representation of
    IPv6 address. The compress () output will conform to it almost a little
    different.

    In RFC5952 4.2.2, "The symbol "::" MUST NOT be used to shorten just one
    16-bit 0 field." I wrote new method for it.

    ------------------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJul 26, '11 at 11:58a
activeJul 26, '11 at 12:09p
posts2
users2
websitepear.php.net

2 users in discussion

Alexander Merz: 1 post Koyama: 1 post

People

Translate

site design / logo © 2023 Grokbase