Tcl Library Source Code

Check-in [ea88434604]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ticket [2186ff86b7]. dns, package 'ip' - Fixed toInteger wrap-around. Bumped version to 1.2.2. Extended testsuite.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ea88434604adfae5691d5b86ecde668b08ac131e
User & Date: andreask 2014-02-04 20:31:17.281
References
2014-02-04
21:16
Followup on [ea88434604]. Restrict to 32bits. check-in: cfd881b6f8 user: aku tags: trunk
Context
2014-02-04
20:53
Ticket [659631d1f4]. dns, package 'ip' - Fixed nextNet issue with its count argument. Extended testsuite. Fix by Matthew Jefferson. check-in: 27f9dbf374 user: andreask tags: trunk
20:31
Ticket [2186ff86b7]. dns, package 'ip' - Fixed toInteger wrap-around. Bumped version to 1.2.2. Extended testsuite. check-in: ea88434604 user: andreask tags: trunk
2014-01-30
20:05
Solving two tickets regarding the math::geometry package check-in: ffa444f6ab user: markus tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to modules/dns/ip.tcl.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# $Id: ip.tcl,v 1.14 2010/08/16 17:35:18 andreas_kupries Exp $

# @mdgen EXCLUDE: ipMoreC.tcl

package require Tcl 8.2;                # tcl minimum version

namespace eval ip {
    variable version 1.2.1
    variable rcsid {$Id: ip.tcl,v 1.14 2010/08/16 17:35:18 andreas_kupries Exp $}

    namespace export is version normalize equal type contract mask collapse subtract
    #catch {namespace ensemble create}

    variable IPv4Ranges
    if {![info exists IPv4Ranges]} {







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# $Id: ip.tcl,v 1.14 2010/08/16 17:35:18 andreas_kupries Exp $

# @mdgen EXCLUDE: ipMoreC.tcl

package require Tcl 8.2;                # tcl minimum version

namespace eval ip {
    variable version 1.2.2
    variable rcsid {$Id: ip.tcl,v 1.14 2010/08/16 17:35:18 andreas_kupries Exp $}

    namespace export is version normalize equal type contract mask collapse subtract
    #catch {namespace ensemble create}

    variable IPv4Ranges
    if {![info exists IPv4Ranges]} {
Changes to modules/dns/ip.test.
223
224
225
226
227
228
229



















230
231
232
233
234
235
236
    3 255.0.0.0        8   8 0xff000000  8
    4 0.0.0.0          0   9 0x00000000  0
} {
    test ip-11.$i "maskToLength, $m" {
        ip::maskToLength $m
    } $e
}




















# -------------------------------------------------------------------------

testsuiteCleanup

# Local Variables:
#  mode: tcl







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
    3 255.0.0.0        8   8 0xff000000  8
    4 0.0.0.0          0   9 0x00000000  0
} {
    test ip-11.$i "maskToLength, $m" {
        ip::maskToLength $m
    } $e
}

# -------------------------------------------------------------------------

foreach {i ip e} {
    0 0.0.0.0                  0
    1 0.0.0.1                  1
    2 0.0.1.0                256
    3 0.1.0.0              65536
    4 1.0.0.0           16777216
    5 0.0.0.255              255
    6 0.0.255.0            65280
    7 0.255.0.0         16711680
    8 255.0.0.0       4278190080
    9 255.255.255.255 4294967295
} {
    test ip-12.$i "toInteger $ip" {
        ip::toInteger $ip
    } $e
}

# -------------------------------------------------------------------------

testsuiteCleanup

# Local Variables:
#  mode: tcl
Changes to modules/dns/ipMore.tcl.
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#
# See Also:
#
# End of Header

proc ::ip::toInteger {ip} {
    binary scan [ip::Normalize4 $ip] I out
    return $out
}

##Procedure Header
# Copyright (c) 2004 Cisco Systems, Inc.
#
# Name:
#       ::ip::toHex







|







308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#
# See Also:
#
# End of Header

proc ::ip::toInteger {ip} {
    binary scan [ip::Normalize4 $ip] I out
    return [format %u $out]
}

##Procedure Header
# Copyright (c) 2004 Cisco Systems, Inc.
#
# Name:
#       ::ip::toHex
Changes to modules/dns/pkgIndex.tcl.
1
2
3
4
5
6
7
8
9
# pkgIndex.tcl -
#
# $Id: pkgIndex.tcl,v 1.21 2010/08/16 17:35:18 andreas_kupries Exp $

if {![package vsatisfies [package provide Tcl] 8.2]} {return}
package ifneeded dns    1.3.3 [list source [file join $dir dns.tcl]]
package ifneeded resolv 1.0.3 [list source [file join $dir resolv.tcl]]
package ifneeded ip     1.2.1 [list source [file join $dir ip.tcl]]
package ifneeded spf    1.1.1 [list source [file join $dir spf.tcl]]







|

1
2
3
4
5
6
7
8
9
# pkgIndex.tcl -
#
# $Id: pkgIndex.tcl,v 1.21 2010/08/16 17:35:18 andreas_kupries Exp $

if {![package vsatisfies [package provide Tcl] 8.2]} {return}
package ifneeded dns    1.3.3 [list source [file join $dir dns.tcl]]
package ifneeded resolv 1.0.3 [list source [file join $dir resolv.tcl]]
package ifneeded ip     1.2.2 [list source [file join $dir ip.tcl]]
package ifneeded spf    1.1.1 [list source [file join $dir spf.tcl]]
Changes to modules/dns/tcllib_ip.man.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

[manpage_begin tcllib_ip n 1.2.1]
[see_also inet(3)]
[see_also ip(7)]
[see_also ipv6(7)]
[keywords {internet address}]
[keywords ip]
[keywords ipv4]
[keywords ipv6]
[keywords {rfc 3513}]
[copyright {2004, Pat Thoyts}]
[copyright {2005 Aamer Akhter <[email protected]>}]
[moddesc   {Domain Name Service}]
[titledesc {IPv4 and IPv6 address manipulation}]
[category  Networking]
[require Tcl 8.2]
[require ip [opt 1.2.1]]
[description]
[para]

This package provides a set of commands to help in parsing, displaying
and comparing internet addresses. The package can handle both IPv4 (1)
and IPv6 (2) address types.

>
|














|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[vset IP_VERSION 1.2.2]
[manpage_begin tcllib_ip n [vset IP_VERSION]]
[see_also inet(3)]
[see_also ip(7)]
[see_also ipv6(7)]
[keywords {internet address}]
[keywords ip]
[keywords ipv4]
[keywords ipv6]
[keywords {rfc 3513}]
[copyright {2004, Pat Thoyts}]
[copyright {2005 Aamer Akhter <[email protected]>}]
[moddesc   {Domain Name Service}]
[titledesc {IPv4 and IPv6 address manipulation}]
[category  Networking]
[require Tcl 8.2]
[require ip [opt [vset IP_VERSION]]]
[description]
[para]

This package provides a set of commands to help in parsing, displaying
and comparing internet addresses. The package can handle both IPv4 (1)
and IPv6 (2) address types.