Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Pike Module Reference:

module version 0.2, prepared

  MODULE IP
Modules
v4

  MODULE IP.v4
Classes
Address
Prefix
Protocol
Tuple
helpers

  CLASS IP.v4.Address
Methods
cast()
create()
Description

This module describes an IP.v4 address. You can use this module by simply casting to an int or string.


Inherit

  • "helpers"

  • Method create

    void IP.v4.Address()->create(int|string _ip)

    Description

    Close the IP.v4.Address module.

    Parameter _ip

    An IP address.


    Method cast

    void|int|string IP.v4.Address()->cast(string type)

      CLASS IP.v4.Prefix
    Methods
    broadcast()
    contains()
    create()
    length()
    netmask()
    network()
    Description

    This module describes an IP prefix, ie a network/netmask pair.


    Inherit

  • "helpers"

  • Method create

    void IP.v4.Prefix()->create(string prefix)

    Description

    Clone the IP.v4.Prefix module.

    Parameter prefix

    The IP prefix in the CIDR format (ie x.x.x.x/m)


    Method network

    object(IP.v4.Address) IP.v4.Prefix()->network()

    Description

    Get the network address of this prefix.


    Method broadcast

    object(IP.v4.Address) IP.v4.Prefix()->broadcast()

    Description

    Get the broadcast address of this prefix.


    Method netmask

    object(IP.v4.Address) IP.v4.Prefix()->netmask()

    Description

    Get the netmask of this prefix.


    Method length

    int(0..32) IP.v4.Prefix()->length()

    Description

    Get the length of this prefix (ie, number of "on" bits in the mask).


    Method contains

    int(0..1) IP.v4.Prefix()->contains(object(IP.v4.Address) _ip)

    Description

    Test if an IP address is inside this prefix. Returns 1 if true, 0 otherwise.

    Parameter _ip

    The IP address to test.

      CLASS IP.v4.Protocol
    Methods
    create()
    Description

    This module describes an IP protocol. You should use this module by casting it to a string or int.


    Method create

    void IP.v4.Protocol()->create(int|string proto)

    Description

    Clone an instance of IP.v4.Protocol.

    Parameter proto

    The IP protocol number or name.

      CLASS IP.v4.Tuple
    Methods
    create()
    Description

    This module defines a connection between two machines, for example a TCP socket, or a UDP datagram.


    Variable _local_addr

    object(IP.v4.Address) IP.v4.Tuple()->_local_addr

    Description

    The local address of the datagram or stream.


    Variable _remote_addr

    object(IP.v4.Address) IP.v4.Tuple()->_remote_addr

    Description

    The remote address of the datagram or stream.


    Variable _local_port

    int IP.v4.Tuple()->_local_port

    Description

    The local port of the datagram or streamm if applicable.


    Variable _remote_port

    int IP.v4.Tuple()->_remote_port

    Description

    The remote port of the datagram or stream, if applicable.


    Variable _protocol

    object(IP.v4.Protocol) IP.v4.Tuple()->_protocol

    Description

    The IP protocol used for this datagram or stream.


    Method create

    void IP.v4.Tuple()->create(object(Stdio.File)|object(IP.v4.Address) l_addr, void|int l_port, void|object(IP.v4.Address) r_addr, void|int r_port, void|object(IP.v4.Protocol) proto)

    Description

    Clone the IP.v4.Tuple class.

    Parameter l_addr

    The local address.

    Parameter l_port

    The local port, if applicable.

    Parameter r_addr

    The remote address.

    Parameter r_port

    The remote port.

    Parameter proto

    The IP protocol.

      CLASS IP.v4.helpers
    Methods
    broadcast()
    inttoip()
    iptoint()
    lengthtoint()
    masktolength()
    network()
    Description

    This module provides handy helpers to the IP.v4 modules.


    Method iptoint

    int IP.v4.helpers()->iptoint(string _ip)

    Description

    Convert an IP address to a 32 bit integer.

    Parameter _ip

    The IP address to convert.


    Method inttoip

    string IP.v4.helpers()->inttoip(int _ip)

    Description

    Convert a 32 bit integer to an IP address.

    Parameter _ip

    The IP address to convert.


    Method network

    int IP.v4.helpers()->network(int ip, int mask)

    Description

    Find the network address for the given address and mask.

    Parameter ip

    An IP address.

    Parameter mask

    A netmask.


    Method broadcast

    int IP.v4.helpers()->broadcast(int ip, int mask)

    Description

    Find the broadcast address for the given address and mask.

    Parameter ip

    An IP address.

    Parameter mask

    A netmask.


    Method lengthtoint

    int IP.v4.helpers()->lengthtoint(int length)

    Description

    Convert a prefix length into an integer mask.

    Parameter length

    A prefix length.


    Method masktolength

    int IP.v4.helpers()->masktolength(int|object mask)

    Description

    Convert a mask to a prefix length.

    Parameter mask

    The netmask.

    gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University