Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

I/O Types

This chapter describes the most common NSPR types, enumerations, and structures used with the functions described in I/O Functions and Network Addresses. These include the types used for system access, normal file I/O, and socket (network) I/O.

Types unique to a particular function are described with the function itself.

For sample code that illustrates basic I/O operations, see Introduction to NSPR.

Directory Type

File Descriptor Types

NSPR represents I/O objects, such as open files and sockets, by file descriptors of type PRFileDesc. This section introduces PRFileDesc and related types.

Note that the NSPR documentation follows the Unix convention of using the termfiles to refer to many kinds of I/O objects. To refer specifically to the files in a file system (that is, disk files), this documentation uses the termnormal files.

PRFileDesc has an object-oriented flavor. An I/O function on a PRFileDesc structure is carried out by invoking the corresponding "method" in the I/O methods table (a structure of type PRIOMethods) of the PRFileDesc structure (the "object"). Different kinds of I/O objects (such as files and sockets) have different I/O methods tables, thus implementing different behavior in response to the same I/O function call.

NSPR supports the implementation of layered I/O. Each layer is represented by a PRFileDesc structure, and the PRFileDesc structures for the layers are chained together. Each PRFileDesc structure has a field (of type PRDescIdentity) to identify itself in the layers. For example, the Netscape implementation of the Secure Sockets Layer (SSL) protocol is implemented as an I/O layer on top of NSPR's socket layer.

File Info Types

Network Address Types

Types Used with Socket Options Functions

Type Used with Memory-Mapped I/O

Offset Interpretation for Seek Functions

Document Tags and Contributors

 Contributors to this page: teoli, Sheppy, trevorh, Rappo
 Last updated by: teoli,