HOME

TheInfoList



OR:

The Netscape Portable Runtime, or NSPR, is a cross-platform
abstraction layer In computing, an abstraction layer or abstraction level is a way of hiding the working details of a subsystem. Examples of software models that use layers of abstraction include the OSI model for network protocols, OpenGL, and other graphics libra ...
library for the
C programming language C (''pronounced'' '' – like the letter c'') is a general-purpose programming language. It was created in the 1970s by Dennis Ritchie and remains very widely used and influential. By design, C's features cleanly reflect the capabilities of ...
. It provides a uniform
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
for various operating system functions.


History

NSPR was originally designed to provide a base for the
Java virtual machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally descr ...
in Netscape 5. Over time it was extended to allow support for additional functionality used for Netscape's server and client software. NSPR continues to be used today by Firefox as well as many of Oracle and Red Hat's server products.


Features


Threads

NSPR provides a thread API. It uses the OS's threading capabilities where possible. It also provides support for sharing memory between threads, as well as creating and using thread pools. Locks, atomics, semaphores, and both cached and uncached monitors are provided.


I/O

NSPR provides functions for working with files, directories, anonymous pipes and network sockets.


Network addresses

NSPR defines an IP-centric network address object. Functions are provided to translate
ASCII ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
strings ( DNS names) into NSPR's network address structures, regardless of whether the addressing technology uses IPv4 or IPv6.


Time

NSPR makes timing facilities available in two forms: interval timing and calendar functions. Interval timers are based on a free running 32-bit resolution timer. Their
epoch In chronology and periodization, an epoch or reference epoch is an instant in time chosen as the origin of a particular calendar era. The "epoch" serves as a reference point from which time is measured. The moment of epoch is usually decided b ...
and interval can be set as needed. Calendar times are represented using 64-bit signed
Unix time Unix time is a date and time representation widely used in computing. It measures time by the number of non-leap seconds that have elapsed since 00:00:00 Coordinated Universal Time, UTC on 1 January 1970, the Unix Epoch (computing), epoc ...
. NSPR provides functions for manipulating and converting timestamps.


Memory management

NSPR provides API to perform the basic
malloc C dynamic memory allocation refers to performing manual memory management for dynamic memory allocation in the C programming language via a group of functions in the C standard library, namely , , , and . The C++ programming language includ ...
, calloc, realloc and free functions. Depending on the platform, the functions may be implemented almost entirely in the NSPR runtime or simply shims that call immediately into the host operating system's offerings.


Linking

Support for linking (
shared library In computing, a library is a collection of System resource, resources that can be leveraged during software development to implement a computer program. Commonly, a library consists of executable code such as compiled function (computer scienc ...
loading and unloading) forms part of NSPR's feature set. In most cases this is simply a smoothing over of the facilities offered by the various platform providers.


Data structures

NSPR provides implementations of a circular linked list and a
hash table In computer science, a hash table is a data structure that implements an associative array, also called a dictionary or simply map; an associative array is an abstract data type that maps Unique key, keys to Value (computer science), values. ...
.


See also

* Apache Portable Runtime * Adaptive Communication Environment * Cross-platform support middleware


References


External links


Official website

NSPR source code
{{Mozilla projects Application programming interfaces Mozilla Netscape