ip(3)

SYNOPSIS

ip.h2a hostname

ip.a2h address

ip.{src,dst} address

ip.cksum pkt offset len [initial]

popen ip id interface ether-src ether-dst [protocol [src-addr [dst-addr]]]

pclose ip id

pinit ip pkt [len]

pfree pkt

pget ip pkt field-name

pset ip pkt field-name value

plist pkt ip

id.send pkt

id.recv pkt

DESCRIPTION

ip.h2a hostname
    Translate hostname into a numeric IP address. It returns it as a integer in host byte order.

ip.a2h address
    Take the numeric form of address and return the hostname for that address. Numeric values are in host byte order.

ip.src address
    Take the hostname, dotted quad, or host byte order integer form of an IP address, and set that IP address as the default source address when packets are initialized.

ip.dst address
    Same as ip.src, but set destination address.

ip.cksum pkt offset len [initial]
    Allow access to raw ip checksum routine. In the specified packet pkt beginning at byte offset offset from the beginning and extending for len bytes compute the Internet checksum. The command returns the sum as a hexadecimal number. If initial is supplied, it is used instead of zero as the initial checksum total.

popen ip id interface ether-src ether-dst [protocol [
    src-addr [dst-addr]]]

Opens the network interface corresponding to path, and attached it to the end point named id. Also specify the initial ethernet source address ether-src and destination address ether-dst. In some cases, where the programmer is not concerned with the interface and link layer ("ether") addresses used, these arguments can be set to "-" and the implentation will choose "appropriate" defaults.

The src-addr and dst-addr are both formatted as an IP address or host name, followed by an optional /port. Different OSes may only support some combinations of protocol, source IP address, source port, destination IP address, and destination port.

pclose ip id
    Close a previously popen'ed ip end-point.

pinit ip pkt [maxlength [length]]
    Initialize an ip packet variable. The initialization sets the IP header length to 5, the version to 5, type of service to 0, the id field to a monotonically increasing value, offset to zero, time-to-live to 40, protocol to TCP(6), and the source and destination addresses to zero. If a different value is supplied with ip.src or ip.dst, that value is used instead of zero. For more information on the maxlength and length parameters, see the psh(1) manual page.

pfree pkt
    Free the indicated packet buffer named pkt.

pget pkt ip field-name
    Fetch the indicated field field-name from the indicated packet pkt. Note that src and dst are returned as dotted quads, where as srch and dsth are returned as hex integers. Regardless of the endian-ness of the host, the most significant bit of the address will be in the most significant bit of the integer.

    The valid fields are the following: dst, src, dsth, srch, proto, len, sum, hlv, tos, id, off, ttl.

    Refer to RFC791 for an explanation of the fields.

pset pkt ip field-name value
    Set the indicated field field-name from the indicated packet pkt to the value value. Similar to the above.

plist pkt ip
    Summarize an ip packet.

id.send pkt
    Send the indicated IP packet pkt through the indicated end-point name id.

id.recv pkt
    Receive a packet pkt through the indicated end-point name id.

FILES

/opt/psh/lib/ip
    Dynamically linked library protocol for IP.

SEE ALSO
xpsh(1), psh(1), protolib(3).