7.2. Data Definitions for libnspr4

This section defines global identifiers and their values that are associated with interfaces contained in libnspr4. These definitions are organized into groups that correspond to system headers. This convention is used as a convenience for the reader, and does not imply the existence of these headers, or their content. Where an interface is defined as requiring a particular system header file all of the data definitions for that system header file presented here shall be in effect.

This section gives data definitions to promote binary application portability, not to repeat source interface definitions available elsewhere. System providers and application developers should use this ABI to supplement - not to replace - source interface definition specifications.

This specification uses the ISO C (1999) C Language as the reference programming language, and data definitions are specified in ISO C format. The C language is used here as a convenient notation. Using a C language description of these data objects does not preclude their use by other programming languages.

7.2.1. nspr4/nspr.h


#define nspr_h___

7.2.2. nspr4/plarena.h


#define plarena_h___

typedef struct PLArenaPool {
    struct PLArena first;
    struct PLArena *current;
    PRUint32 arenasize;
    PRUword mask;
} PLArenaPool;
struct PLArena {
    struct PLArena *next;
    PRUword base;
    PRUword limit;
    PRUword avail;
};

7.2.3. nspr4/plhash.h


#define plhash_h___

typedef PRUint32 PLHashNumber;
typedef PRIntn(*PLHashComparator) (const void *, const void *);
typedef struct PLHashAllocOps {
    void *(*allocTable) (void *, PRSize);
    void (*freeTable) (void *, void *);
    struct PLHashEntry *(*allocEntry) (void *, const void *);
    void (*freeEntry) (void *, struct PLHashEntry *, PRUintn);
} PLHashAllocOps;
typedef PLHashNumber(*PLHashFunction) (const void *);
struct PLHashEntry {
    struct PLHashEntry *next;
    PLHashNumber keyHash;
    const void *key;
    void *value;
};
struct PLHashTable {
    struct PLHashEntry **buckets;
    PRUint32 nentries;
    PRUint32 shift;
    PLHashFunction keyHash;
    PLHashComparator keyCompare;
    PLHashComparator valueCompare;
    const PLHashAllocOps *allocOps;
    void *allocPriv;
};

7.2.4. nspr4/prclist.h


#define prclist_h___

typedef struct PRCListStr {
    PRCList *next;
    PRCList *prev;
} PRCList;

7.2.5. nspr4/prerror.h


#define prerror_h___

typedef PRInt32 PRErrorCode;
extern PRErrorCode PR_GetError(void);
extern void PR_SetError(PRErrorCode errorCode, PRInt32 oserr);

7.2.6. nspr4/prinit.h


#define prinit_h___

extern PRStatus PR_Cleanup(void);

7.2.7. nspr4/prinrval.h


#define prinrval_h

typedef PRUint32 PRIntervalTime;
extern PRIntervalTime PR_MillisecondsToInterval(PRUint32 milli);
extern PRIntervalTime PR_SecondsToInterval(PRUint32 seconds);

7.2.8. nspr4/prio.h


#define prio_h___

typedef enum PRDescType {
    PR_DESC_FILE = 1,
    PR_DESC_SOCKET_TCP = 2,
    PR_DESC_SOCKET_UDP = 3,
    PR_DESC_LAYERED = 4,
    PR_DESC_PIPE = 5
} PRDescType;
typedef struct PRIPv6Addr {
    union {
	PRUint8 _S6_u8[15];
	PRUint16 _S6_u16[7];
	PRUint32 _S6_u32[3];
	PRUint64 _S6_u64[1];
    } _S6_un;
} PRIPv6Addr;
typedef enum PRTransmitFileFlags {
    PR_TRANSMITFILE_KEEP_OPEN,
    PR_TRANSMITFILE_CLOSE_SOCKET = 1
} PRTransmitFileFlags;
typedef struct PRLinger {
    PRBool polarity;
    PRIntervalTime linger;
} PRLinger;
typedef struct PRFilePrivate PRFilePrivate;
typedef struct PRFileDesc {
    const struct PRIOMethods *methods;
    PRFilePrivate *secret;
    PRFileDesc *lower;
    PRFileDesc *higher;
    void (*dtor) (PRFileDesc *);
    PRDescIdentity identity;
} PRFileDesc;
typedef union PRNetAddr {
    struct {
	PRUint16 family;
	char data[14];
    } raw;
    struct {
	PRUint16 family;
	PRUint16 port;
	PRUint32 ip;
	char pad[7];
    } inet;
    struct {
	PRUint16 family;
	PRUint16 port;
	PRUint32 flowinfo;
	PRIPv6Addr ip;
	PRUint32 scope_id;
    } ipv6;
    struct {
	PRUint16 family;
	char path[103];
    } local;
} PRNetAddr;
typedef struct PRMcastRequest {
    union PRNetAddr mcaddr;
    union PRNetAddr ifaddr;
} PRMcastRequest;
typedef struct PRIOVec {
    char *iov_base;
    int iov_len;
} PRIOVec;
typedef struct PRSocketOptionData {
    PRSockOption option;
    union {
	PRUintn ip_ttl;
	PRUintn mcast_ttl;
	PRUintn tos;
	PRBool non_blocking;
	PRBool reuse_addr;
	PRBool keep_alive;
	PRBool mcast_loopback;
	PRBool no_delay;
	PRBool broadcast;
	PRSize max_segment;
	PRSize recv_buffer_size;
	PRSize send_buffer_size;
	PRLinger linger;
	PRMcastRequest add_member;
	PRMcastRequest drop_member;
	union PRNetAddr mcast_if;
    } value;
} PRSocketOptionData;
typedef PRStatus(*PRFsyncFN) (PRFileDesc *);
typedef PRStatus(*PRListenFN) (PRFileDesc *, PRIntn);
typedef enum PRSeekWhence {
    PR_SEEK_SET,
    PR_SEEK_CUR = 1,
    PR_SEEK_END = 2
} PRSeekWhence;
typedef PRInt32(*PRAcceptreadFN) (PRFileDesc *, PRFileDesc * *,
				  PRNetAddr * *, void *, PRInt32,
				  PRIntervalTime);
typedef PRStatus(*PRCloseFN) (PRFileDesc *);
typedef PRInt32(*PRTransmitfileFN) (PRFileDesc *, PRFileDesc *,
				    const void *, PRInt32,
				    PRTransmitFileFlags, PRIntervalTime);
typedef enum PRSockOption {
    PR_SockOpt_Nonblocking,
    PR_SockOpt_Linger = 1,
    PR_SockOpt_Reuseaddr = 2,
    PR_SockOpt_Keepalive = 3,
    PR_SockOpt_RecvBufferSize = 4,
    PR_SockOpt_SendBufferSize = 5,
    PR_SockOpt_IpTimeToLive = 6,
    PR_SockOpt_IpTypeOfService = 7,
    PR_SockOpt_AddMember = 8,
    PR_SockOpt_DropMember = 9,
    PR_SockOpt_McastInterface = 10,
    PR_SockOpt_McastTimeToLive = 11,
    PR_SockOpt_McastLoopback = 12,
    PR_SockOpt_NoDelay = 13,
    PR_SockOpt_MaxSegment = 14,
    PR_SockOpt_Broadcast = 15,
    PR_SockOpt_Last = 16
} PRSockOption;
typedef PRFileDesc *(*PRAcceptFN) (PRFileDesc *, PRNetAddr *,
				   PRIntervalTime);
typedef PRStatus(*PRConnectcontinueFN) (PRFileDesc *, PRInt16);
typedef PRInt32(*PRReadFN) (PRFileDesc *, void *, PRInt32);
typedef struct PRFileInfo64 {
    PRFileType type;
    PROffset64 size;
    PRTime creationTime;
    PRTime modifyTime;
} PRFileInfo64;
typedef PRStatus(*PRGetsocketoptionFN) (PRFileDesc *,
					PRSocketOptionData *);
typedef PRInt32(*PRSendtoFN) (PRFileDesc *, const void *, PRInt32, PRIntn,
			      const PRNetAddr *, PRIntervalTime);
typedef PRStatus(*PRGetsocknameFN) (PRFileDesc *, PRNetAddr *);
typedef PRInt32(*PRSendFN) (PRFileDesc *, const void *, PRInt32, PRIntn,
			    PRIntervalTime);
typedef PROffset32(*PRSeekFN) (PRFileDesc *, PROffset32, PRSeekWhence);
typedef PRInt64(*PRAvailable64FN) (PRFileDesc *);
typedef PRInt32(*PRAvailableFN) (PRFileDesc *);
typedef struct PRFileInfo {
    PRFileType type;
    PROffset32 size;
    PRTime creationTime;
    PRTime modifyTime;
} PRFileInfo;
typedef PROffset64(*PRSeek64FN) (PRFileDesc *, PROffset64, PRSeekWhence);
typedef PRStatus(*PRSetsocketoptionFN) (PRFileDesc *,
					const PRSocketOptionData *);
typedef PRInt32(*PRRecvFN) (PRFileDesc *, void *, PRInt32, PRIntn,
			    PRIntervalTime);
typedef struct PRSendFileData {
    PRFileDesc *fd;
    PRUint32 file_offset;
    PRSize file_nbytes;
    const void *header;
    PRInt32 hlen;
    const void *trailer;
    PRInt32 tlen;
} PRSendFileData;
typedef PRIntn PRDescIdentity;
typedef PRStatus(*PRConnectFN) (PRFileDesc *, const PRNetAddr *,
				PRIntervalTime);
typedef PRInt32(*PRSendfileFN) (PRFileDesc *, PRSendFileData *,
				PRTransmitFileFlags, PRIntervalTime);
typedef PRInt32(*PRRecvfromFN) (PRFileDesc *, void *, PRInt32, PRIntn,
				PRNetAddr *, PRIntervalTime);
typedef struct PRPollDesc {
    PRFileDesc *fd;
    PRInt16 in_flags;
    PRInt16 out_flags;
} PRPollDesc;
typedef PRInt32(*PRWriteFN) (PRFileDesc *, const void *, PRInt32);
typedef PRStatus(*PRFileInfo64FN) (PRFileDesc *, PRFileInfo64 *);
typedef PRStatus(*PRShutdownFN) (PRFileDesc *, PRIntn);
typedef PRIntn(*PRReservedFN) (PRFileDesc *);
typedef PRStatus(*PRFileInfoFN) (PRFileDesc *, PRFileInfo *);
typedef PRInt32(*PRWritevFN) (PRFileDesc *, const PRIOVec *, PRInt32,
			      PRIntervalTime);
typedef enum PRFileType {
    PR_FILE_FILE = 1,
    PR_FILE_DIRECTORY = 2,
    PR_FILE_OTHER = 3
} PRFileType;
typedef PRStatus(*PRBindFN) (PRFileDesc *, const PRNetAddr *);
typedef PRInt16(*PRPollFN) (PRFileDesc *, PRInt16, PRInt16 *);
struct PRIOMethods {
    PRDescType file_type;
    PRCloseFN close;
    PRReadFN read;
    PRWriteFN write;
    PRAvailableFN available;
    PRAvailable64FN available64;
    PRFsyncFN fsync;
    PRSeekFN seek;
    PRSeek64FN seek64;
    PRFileInfoFN fileInfo;
    PRFileInfo64FN fileInfo64;
    PRWritevFN writev;
    PRConnectFN connect;
    PRAcceptFN accept;
    PRBindFN bind;
    PRListenFN listen;
    PRShutdownFN shutdown;
    PRRecvFN recv;
    PRSendFN send;
    PRRecvfromFN recvfrom;
    PRSendtoFN sendto;
    PRPollFN poll;
    PRAcceptreadFN acceptread;
    PRTransmitfileFN transmitfile;
    PRGetsocknameFN getsockname;
    PRGetpeernameFN getpeername;
    PRReservedFN reserved_fn_6;
    PRReservedFN reserved_fn_5;
    PRGetsocketoptionFN getsocketoption;
    PRSetsocketoptionFN setsocketoption;
    PRSendfileFN sendfile;
    PRConnectcontinueFN connectcontinue;
    PRReservedFN reserved_fn_3;
    PRReservedFN reserved_fn_2;
    PRReservedFN reserved_fn_1;
    PRReservedFN reserved_fn_0;
};
typedef PRStatus(*PRGetpeernameFN) (PRFileDesc *, PRNetAddr *);
typedef enum PRShutdownHow {
    PR_SHUTDOWN_RCV,
    PR_SHUTDOWN_SEND = 1,
    PR_SHUTDOWN_BOTH = 2
} PRShutdownHow;
extern PRFileDesc *PR_Accept(PRFileDesc * fd, PRNetAddr * addr,
			     PRIntervalTime timeout);
extern PRStatus PR_Bind(PRFileDesc * fd, const PRNetAddr * addr);
extern PRStatus PR_Close(PRFileDesc * fd);
extern PRStatus PR_Connect(PRFileDesc * fd, const PRNetAddr * addr,
			   PRIntervalTime timeout);
extern PRFileDesc *PR_CreateIOLayerStub(PRDescIdentity ident,
					const struct PRIOMethods *methods);
extern const struct PRIOMethods *PR_GetDefaultIOMethods(void);
extern PRDescIdentity PR_GetLayersIdentity(PRFileDesc * fd);
extern PRStatus PR_GetSocketOption(PRFileDesc * fd,
				   PRSocketOptionData * data);
extern PRDescIdentity PR_GetUniqueIdentity(const char *layer_name);
extern PRStatus PR_Listen(PRFileDesc * fd, PRIntn backlog);
extern PRFileDesc *PR_OpenTCPSocket(PRIntn af);
extern PRFileDesc *PR_OpenUDPSocket(PRIntn af);
extern PRInt32 PR_Poll(PRPollDesc * pds, PRIntn npds,
		       PRIntervalTime timeout);
extern PRFileDesc *PR_PopIOLayer(PRFileDesc * fd_stack, PRDescIdentity id);
extern PRStatus PR_PushIOLayer(PRFileDesc * fd_stack, PRDescIdentity id,
			       PRFileDesc * layer);
extern PRInt32 PR_Read(PRFileDesc * fd, void *buf, PRInt32 amount);
extern PRInt32 PR_Recv(PRFileDesc * fd, void *buf, PRInt32 amount,
		       PRIntn flags, PRIntervalTime timeout);
extern PRInt32 PR_RecvFrom(PRFileDesc * fd, void *buf, PRInt32 amount,
			   PRIntn flags, PRNetAddr * addr,
			   PRIntervalTime timeout);
extern PRInt32 PR_Send(PRFileDesc * fd, const void *buf, PRInt32 amount,
		       PRIntn flags, PRIntervalTime timeout);
extern PRInt32 PR_SendTo(PRFileDesc * fd, const void *buf, PRInt32 amount,
			 PRIntn flags, const PRNetAddr * addr,
			 PRIntervalTime timeout);
extern PRStatus PR_SetSocketOption(PRFileDesc * fd,
				   const PRSocketOptionData * data);
extern PRStatus PR_Shutdown(PRFileDesc * fd, PRShutdownHow how);
extern PRInt32 PR_Write(PRFileDesc * fd, const void *buf, PRInt32 amount);

7.2.9. nspr4/private/pprio.h


#define pprio_h___

typedef PRInt32 PROsfd;
extern PRFileDesc *PR_ImportTCPSocket(PROsfd osfd);

7.2.10. nspr4/prlock.h


#define prlock_h___

typedef struct PRLock PRLock;

7.2.11. nspr4/prmon.h


#define prmon_h___

typedef struct PRMonitor PRMonitor;

7.2.12. nspr4/prnetdb.h


#define prnetdb_h___

typedef struct PRHostEnt {
    char *h_name;
    char **h_aliases;
    PRInt32 h_addrtype;
    PRInt32 h_length;
    char **h_addr_list;
} PRHostEnt;
typedef struct PRAddrInfo PRAddrInfo;
extern void *PR_EnumerateAddrInfo(void *enumPtr,
				  const PRAddrInfo * addrInfo,
				  PRUint16 port, PRNetAddr * result);
extern void PR_FreeAddrInfo(PRAddrInfo * addrInfo);
extern PRAddrInfo *PR_GetAddrInfoByName(const char *hostname, PRUint16 af,
					PRIntn flags);
extern PRStatus PR_NetAddrToString(const PRNetAddr * addr, char *string,
				   PRUint32 size);
extern PRStatus PR_StringToNetAddr(const char *string, PRNetAddr * addr);

7.2.13. nspr4/prthread.h


#define prthread_h___

typedef struct PRThread PRThread;
extern PRStatus PR_Interrupt(PRThread * thread);

7.2.14. nspr4/prtime.h


#define prtime_h___

typedef PRInt64 PRTime;
extern PRTime PR_Now(void);

7.2.15. nspr4/prtypes.h


#define prtypes_h___

typedef int PRInt32;
typedef unsigned long int PRUword;
typedef int PRIntn;
typedef unsigned long int PRUint64;
typedef unsigned char PRUint8;
typedef short int PRInt16;
typedef long int PRInt64;
typedef PRIntn PRBool;
typedef unsigned short PRUint16;
typedef unsigned int PRUint32;
typedef size_t PRSize;
typedef unsigned int PRUintn;
typedef PRInt64 PROffset64;
typedef PRInt32 PROffset32;
typedef enum {
    PR_FAILURE = -1,
    PR_SUCCESS
} PRStatus;