file(3)

SYNOPSIS

popen file id filename [r|w|wtcpdump]

pclose file fd

fd.read pkt

fd.write pkt

pget file pkt field-name

plist pkt file

DESCRIPTION

popen file fd filename [r|w|wtcpdump]
    Open the specified filename as a snoop or tcpdump capture file. If the optional last argument is the letter 'r', the file is opened for reading, which is the default. Either snoop or tcpdump format capture files may be read. Choosing 'w' indicates this file is opened for writing, and previous contents should be truncated. When opening for write files are in snoop capture file format by default. If the option wtcpdump is given, the file will be written in the tcpdump format.

pclose file fd
    Close the capture file corresponding to the file descriptor fd provided.

fd.read pkt
    Read the next file entry into the specified packet. It returns the string "eof" when the end of file is reached.

fd.write pkt
    Write the indicated packet into the capture file.

The file protocol supports a variety of fields found in the capture file via the pget command. Their names are plen, clen, rlen, drops, time, and date. These fields are, respectively the packet length, the captured length, number of packets dropped between the previous packet and this one, the time (relatively to the time of the first packet in the capture file) and the date of the packet. (The date is a simplified form of the ctime(3) of the stored timeval.)

Currently setting these elements are not permitted.

FILES

/opt/psh/lib/file
    Dynamically linked library protocol for file.

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

See RFC-1761 for the snoop capture file format.

See the libpcap source for more information on the tcpdump capture file format. Libpcap can be obtained from ftp://ftp.ee.lbl.gov/.

NOTES
Currently if you do not explicitly pclose a file you are writing, it may not be saved on disk properly, and none of its contents will be readable.