diff options
Diffstat (limited to 'nsprpub/pr/include/prio.h')
-rw-r--r-- | nsprpub/pr/include/prio.h | 196 |
1 files changed, 94 insertions, 102 deletions
diff --git a/nsprpub/pr/include/prio.h b/nsprpub/pr/include/prio.h index 18504e5cb..d5cff257b 100644 --- a/nsprpub/pr/include/prio.h +++ b/nsprpub/pr/include/prio.h @@ -54,7 +54,7 @@ struct PRFileDesc { PRFilePrivate *secret; /* layer dependent data */ PRFileDesc *lower, *higher; /* pointers to adjacent layers */ void (PR_CALLBACK *dtor)(PRFileDesc *fd); - /* A destructor function for layer */ + /* A destructor function for layer */ PRDescIdentity identity; /* Identity of this particular layer */ }; @@ -128,38 +128,30 @@ typedef enum PRTransmitFileFlags { *************************************************************************/ struct PRIPv6Addr { - union { - PRUint8 _S6_u8[16]; - PRUint16 _S6_u16[8]; - PRUint32 _S6_u32[4]; - PRUint64 _S6_u64[2]; - } _S6_un; + union { + PRUint8 _S6_u8[16]; + PRUint16 _S6_u16[8]; + PRUint32 _S6_u32[4]; + PRUint64 _S6_u64[2]; + } _S6_un; }; -#define pr_s6_addr _S6_un._S6_u8 -#define pr_s6_addr16 _S6_un._S6_u16 -#define pr_s6_addr32 _S6_un._S6_u32 -#define pr_s6_addr64 _S6_un._S6_u64 +#define pr_s6_addr _S6_un._S6_u8 +#define pr_s6_addr16 _S6_un._S6_u16 +#define pr_s6_addr32 _S6_un._S6_u32 +#define pr_s6_addr64 _S6_un._S6_u64 typedef struct PRIPv6Addr PRIPv6Addr; union PRNetAddr { struct { PRUint16 family; /* address family (0x00ff maskable) */ -#ifdef XP_BEOS - char data[10]; /* Be has a smaller structure */ -#else char data[14]; /* raw address data */ -#endif } raw; struct { PRUint16 family; /* address family (AF_INET) */ PRUint16 port; /* port number */ PRUint32 ip; /* The actual 32 bits of address */ -#ifdef XP_BEOS - char pad[4]; /* Be has a smaller structure */ -#else char pad[8]; -#endif } inet; struct { PRUint16 family; /* address family (AF_INET6) */ @@ -173,7 +165,7 @@ union PRNetAddr { PRUint16 family; /* address family (AF_UNIX) */ #ifdef XP_OS2 char path[108]; /* null-terminated pathname */ - /* bind fails if size is not 108. */ + /* bind fails if size is not 108. */ #else char path[104]; /* null-terminated pathname */ #endif @@ -217,13 +209,13 @@ typedef enum PRSockOption } PRSockOption; typedef struct PRLinger { - PRBool polarity; /* Polarity of the option's setting */ - PRIntervalTime linger; /* Time to linger before closing */ + PRBool polarity; /* Polarity of the option's setting */ + PRIntervalTime linger; /* Time to linger before closing */ } PRLinger; typedef struct PRMcastRequest { - PRNetAddr mcaddr; /* IP multicast address of group */ - PRNetAddr ifaddr; /* local IP address of interface */ + PRNetAddr mcaddr; /* IP multicast address of group */ + PRNetAddr ifaddr; /* local IP address of interface */ } PRMcastRequest; typedef struct PRSocketOptionData @@ -341,8 +333,8 @@ typedef PRInt32 (PR_CALLBACK *PRAcceptreadFN)( PRFileDesc *sd, PRFileDesc **nd, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime t); typedef PRInt32 (PR_CALLBACK *PRTransmitfileFN)( - PRFileDesc *sd, PRFileDesc *fd, const void *headers, - PRInt32 hlen, PRTransmitFileFlags flags, PRIntervalTime t); + PRFileDesc *sd, PRFileDesc *fd, const void *headers, + PRInt32 hlen, PRTransmitFileFlags flags, PRIntervalTime t); typedef PRStatus (PR_CALLBACK *PRGetsocknameFN)(PRFileDesc *fd, PRNetAddr *addr); typedef PRStatus (PR_CALLBACK *PRGetpeernameFN)(PRFileDesc *fd, PRNetAddr *addr); typedef PRStatus (PR_CALLBACK *PRGetsocketoptionFN)( @@ -350,8 +342,8 @@ typedef PRStatus (PR_CALLBACK *PRGetsocketoptionFN)( typedef PRStatus (PR_CALLBACK *PRSetsocketoptionFN)( PRFileDesc *fd, const PRSocketOptionData *data); typedef PRInt32 (PR_CALLBACK *PRSendfileFN)( - PRFileDesc *networkSocket, PRSendFileData *sendData, - PRTransmitFileFlags flags, PRIntervalTime timeout); + PRFileDesc *networkSocket, PRSendFileData *sendData, + PRTransmitFileFlags flags, PRIntervalTime timeout); typedef PRStatus (PR_CALLBACK *PRConnectcontinueFN)( PRFileDesc *fd, PRInt16 out_flags); typedef PRIntn (PR_CALLBACK *PRReservedFN)(PRFileDesc *fd); @@ -386,16 +378,16 @@ struct PRIOMethods { PRReservedFN reserved_fn_6; /* reserved for future use */ PRReservedFN reserved_fn_5; /* reserved for future use */ PRGetsocketoptionFN getsocketoption; - /* Get current setting of specified option */ + /* Get current setting of specified option */ PRSetsocketoptionFN setsocketoption; - /* Set value of specified option */ - PRSendfileFN sendfile; /* Send a (partial) file with header/trailer*/ + /* Set value of specified option */ + PRSendfileFN sendfile; /* Send a (partial) file with header/trailer*/ PRConnectcontinueFN connectcontinue; - /* Continue a nonblocking connect */ - PRReservedFN reserved_fn_3; /* reserved for future use */ - PRReservedFN reserved_fn_2; /* reserved for future use */ - PRReservedFN reserved_fn_1; /* reserved for future use */ - PRReservedFN reserved_fn_0; /* reserved for future use */ + /* Continue a nonblocking connect */ + PRReservedFN reserved_fn_3; /* reserved for future use */ + PRReservedFN reserved_fn_2; /* reserved for future use */ + PRReservedFN reserved_fn_1; /* reserved for future use */ + PRReservedFN reserved_fn_0; /* reserved for future use */ }; /* @@ -426,9 +418,9 @@ typedef enum PRSpecialFD NSPR_API(PRFileDesc*) PR_GetSpecialFD(PRSpecialFD id); -#define PR_STDIN PR_GetSpecialFD(PR_StandardInput) -#define PR_STDOUT PR_GetSpecialFD(PR_StandardOutput) -#define PR_STDERR PR_GetSpecialFD(PR_StandardError) +#define PR_STDIN PR_GetSpecialFD(PR_StandardInput) +#define PR_STDOUT PR_GetSpecialFD(PR_StandardOutput) +#define PR_STDERR PR_GetSpecialFD(PR_StandardError) /* ************************************************************************** @@ -498,7 +490,7 @@ NSPR_API(PRFileDesc*) PR_CreateIOLayerStub( * A new stack may be created by calling PR_CreateIOLayer(). The * file descriptor returned will point to the top of the stack, which has * the layer 'fd' as the topmost layer. - * + * * NOTE: This function creates a new style stack, which has a fixed, dummy * header. The old style stack, created by a call to PR_PushIOLayer, * results in modifying contents of the top layer of the stack, when @@ -551,18 +543,18 @@ NSPR_API(PRFileDesc*) PR_PopIOLayer(PRFileDesc *fd_stack, PRDescIdentity id); * The file status flags. * It is a bitwise OR of the following bit flags (only one of * the first three flags below may be used): - * PR_RDONLY Open for reading only. - * PR_WRONLY Open for writing only. - * PR_RDWR Open for reading and writing. - * PR_CREATE_FILE If the file does not exist, the file is created + * PR_RDONLY Open for reading only. + * PR_WRONLY Open for writing only. + * PR_RDWR Open for reading and writing. + * PR_CREATE_FILE If the file does not exist, the file is created * If the file exists, this flag has no effect. * PR_SYNC If set, each write will wait for both the file data * and file status to be physically updated. - * PR_APPEND The file pointer is set to the end of + * PR_APPEND The file pointer is set to the end of * the file prior to each write. - * PR_TRUNCATE If the file exists, its length is truncated to 0. + * PR_TRUNCATE If the file exists, its length is truncated to 0. * PR_EXCL With PR_CREATE_FILE, if the file does not exist, - * the file is created. If the file already + * the file is created. If the file already * exists, no action and NULL is returned * * PRIntn mode @@ -982,7 +974,7 @@ NSPR_API(PRInt64) PR_Available64(PRFileDesc *fd); ************************************************************************ */ -NSPR_API(PRStatus) PR_Sync(PRFileDesc *fd); +NSPR_API(PRStatus) PR_Sync(PRFileDesc *fd); /************************************************************************/ @@ -998,7 +990,7 @@ struct PRDirEntryUTF16 { #endif /* MOZ_UNICODE */ #if !defined(NO_NSPR_10_SUPPORT) -#define PR_DirName(dirEntry) (dirEntry->name) +#define PR_DirName(dirEntry) (dirEntry->name) #endif /* @@ -1425,8 +1417,8 @@ NSPR_API(PRStatus) PR_Shutdown(PRFileDesc *fd, PRShutdownHow how); * FUNCTION: PR_Recv * DESCRIPTION: * Receive a specified number of bytes from a connected socket. - * The operation will block until some positive number of bytes are - * transferred, a time out has occurred, or there is an error. + * The operation will block until some positive number of bytes are + * transferred, a time out has occurred, or there is an error. * No more than 'amount' bytes will be transferred. * INPUTS: * PRFileDesc *fd @@ -1452,15 +1444,15 @@ NSPR_API(PRStatus) PR_Shutdown(PRFileDesc *fd, PRShutdownHow how); #define PR_MSG_PEEK 0x2 NSPR_API(PRInt32) PR_Recv(PRFileDesc *fd, void *buf, PRInt32 amount, - PRIntn flags, PRIntervalTime timeout); + PRIntn flags, PRIntervalTime timeout); /* ************************************************************************* * FUNCTION: PR_Send * DESCRIPTION: * Send a specified number of bytes from a connected socket. - * The operation will block until all bytes are - * processed, a time out has occurred, or there is an error. + * The operation will block until all bytes are + * processed, a time out has occurred, or there is an error. * INPUTS: * PRFileDesc *fd * points to a PRFileDesc object representing a socket. @@ -1483,7 +1475,7 @@ NSPR_API(PRInt32) PR_Recv(PRFileDesc *fd, void *buf, PRInt32 amount, */ NSPR_API(PRInt32) PR_Send(PRFileDesc *fd, const void *buf, PRInt32 amount, - PRIntn flags, PRIntervalTime timeout); + PRIntn flags, PRIntervalTime timeout); /* ************************************************************************* @@ -1491,8 +1483,8 @@ NSPR_API(PRInt32) PR_Send(PRFileDesc *fd, const void *buf, PRInt32 amount, * DESCRIPTION: * Receive up to a specified number of bytes from socket which may * or may not be connected. - * The operation will block until one or more bytes are - * transferred, a time out has occurred, or there is an error. + * The operation will block until one or more bytes are + * transferred, a time out has occurred, or there is an error. * No more than 'amount' bytes will be transferred. * INPUTS: * PRFileDesc *fd @@ -1526,8 +1518,8 @@ NSPR_API(PRInt32) PR_RecvFrom( * FUNCTION: PR_SendTo * DESCRIPTION: * Send a specified number of bytes from an unconnected socket. - * The operation will block until all bytes are - * sent, a time out has occurred, or there is an error. + * The operation will block until all bytes are + * sent, a time out has occurred, or there is an error. * INPUTS: * PRFileDesc *fd * points to a PRFileDesc object representing an unconnected socket. @@ -1558,10 +1550,10 @@ NSPR_API(PRInt32) PR_SendTo( ************************************************************************* ** FUNCTION: PR_TransmitFile ** DESCRIPTION: -** Transmitfile sends a complete file (sourceFile) across a socket +** Transmitfile sends a complete file (sourceFile) across a socket ** (networkSocket). If headers is non-NULL, the headers will be sent across ** the socket prior to sending the file. -** +** ** Optionally, the PR_TRANSMITFILE_CLOSE_SOCKET flag may be passed to ** transmitfile. This flag specifies that transmitfile should close the ** socket after sending the data. @@ -1578,7 +1570,7 @@ NSPR_API(PRInt32) PR_SendTo( ** PRTransmitFileFlags flags ** If the flags indicate that the connection should be closed, ** it will be done immediately after transferring the file, unless -** the operation is unsuccessful. +** the operation is unsuccessful. .* PRIntervalTime timeout * Time limit for completion of the transmit operation. ** @@ -1599,12 +1591,12 @@ NSPR_API(PRInt32) PR_TransmitFile( ************************************************************************* ** FUNCTION: PR_SendFile ** DESCRIPTION: -** PR_SendFile sends data from a file (sendData->fd) across a socket +** PR_SendFile sends data from a file (sendData->fd) across a socket ** (networkSocket). If specified, a header and/or trailer buffer are sent -** before and after the file, respectively. The file offset, number of bytes -** of file data to send, the header and trailer buffers are specified in the -** sendData argument. -** +** before and after the file, respectively. The file offset, number of bytes +** of file data to send, the header and trailer buffers are specified in the +** sendData argument. +** ** Optionally, if the PR_TRANSMITFILE_CLOSE_SOCKET flag is passed, the ** socket is closed after successfully sending the data. ** @@ -1613,11 +1605,11 @@ NSPR_API(PRInt32) PR_TransmitFile( ** The socket to send data over ** PRSendFileData *sendData ** Contains the FD, file offset and length, header and trailer -** buffer specifications. +** buffer specifications. ** PRTransmitFileFlags flags ** If the flags indicate that the connection should be closed, ** it will be done immediately after transferring the file, unless -** the operation is unsuccessful. +** the operation is unsuccessful. .* PRIntervalTime timeout * Time limit for completion of the send operation. ** @@ -1630,21 +1622,21 @@ NSPR_API(PRInt32) PR_TransmitFile( */ struct PRSendFileData { - PRFileDesc *fd; /* file to send */ - PRUint32 file_offset; /* file offset */ - PRSize file_nbytes; /* number of bytes of file data to send */ - /* if 0, send data from file_offset to */ - /* end-of-file. */ - const void *header; /* header buffer */ - PRInt32 hlen; /* header len */ - const void *trailer; /* trailer buffer */ - PRInt32 tlen; /* trailer len */ + PRFileDesc *fd; /* file to send */ + PRUint32 file_offset; /* file offset */ + PRSize file_nbytes; /* number of bytes of file data to send */ + /* if 0, send data from file_offset to */ + /* end-of-file. */ + const void *header; /* header buffer */ + PRInt32 hlen; /* header len */ + const void *trailer; /* trailer buffer */ + PRInt32 tlen; /* trailer len */ }; NSPR_API(PRInt32) PR_SendFile( PRFileDesc *networkSocket, PRSendFileData *sendData, - PRTransmitFileFlags flags, PRIntervalTime timeout); + PRTransmitFileFlags flags, PRIntervalTime timeout); /* ************************************************************************* @@ -1652,15 +1644,15 @@ NSPR_API(PRInt32) PR_SendFile( ** DESCRIPTION: ** AcceptRead accepts a new connection, returns the newly created ** socket's descriptor and also returns the connecting peer's address. -** AcceptRead, as its name suggests, also receives the first block of data +** AcceptRead, as its name suggests, also receives the first block of data ** sent by the peer. ** ** INPUTS: ** PRFileDesc *listenSock -** A socket descriptor that has been called with the PR_Listen() +** A socket descriptor that has been called with the PR_Listen() ** function, also known as the rendezvous socket. ** void *buf -** A pointer to a buffer to receive data sent by the client. This +** A pointer to a buffer to receive data sent by the client. This ** buffer must be large enough to receive <amount> bytes of data ** and two PRNetAddr structures, plus an extra 32 bytes. See: ** PR_ACCEPT_READ_BUF_OVERHEAD. @@ -1669,9 +1661,9 @@ NSPR_API(PRInt32) PR_SendFile( ** the size of the PRNetAddr structures. If 0, no data will be read ** from the client. ** PRIntervalTime timeout -** The timeout interval only applies to the read portion of the -** operation. PR_AcceptRead will block indefinitely until the -** connection is accepted; the read will timeout after the timeout +** The timeout interval only applies to the read portion of the +** operation. PR_AcceptRead will block indefinitely until the +** connection is accepted; the read will timeout after the timeout ** interval elapses. ** OUTPUTS: ** PRFileDesc **acceptedSock @@ -1681,13 +1673,13 @@ NSPR_API(PRInt32) PR_SendFile( ** The address of the remote socket. This parameter will only be ** valid if the function return does not indicate failure. The ** returned address is not guaranteed to be properly aligned. -** +** ** RETURNS: -** The number of bytes read from the client or -1 on failure. The reason +** The number of bytes read from the client or -1 on failure. The reason ** for the failure is obtained by calling PR_GetError(). ************************************************************************** -**/ -/* define buffer overhead constant. Add this value to the user's +**/ +/* define buffer overhead constant. Add this value to the user's ** data length when allocating a buffer to accept data. ** Example: ** #define USER_DATA_SIZE 10 @@ -1714,7 +1706,7 @@ NSPR_API(PRInt32) PR_AcceptRead( ** PRFileDesc *fds[2] ** The file descriptor pair for the newly created TCP sockets. ** RETURN: PRStatus -** Upon successful completion of TCP socket pair, PR_NewTCPSocketPair +** Upon successful completion of TCP socket pair, PR_NewTCPSocketPair ** returns PR_SUCCESS. Otherwise, it returns PR_FAILURE. Further ** failure information can be obtained by calling PR_GetError(). ** XXX can we implement this on windoze and mac? @@ -1735,18 +1727,18 @@ NSPR_API(PRStatus) PR_NewTCPSocketPair(PRFileDesc *fds[2]); ** PRNetAddr *addr ** Returns the address of the socket in its own communication space. ** RETURN: PRStatus -** Upon successful completion, PR_GetSockName returns PR_SUCCESS. -** Otherwise, it returns PR_FAILURE. Further failure information can +** Upon successful completion, PR_GetSockName returns PR_SUCCESS. +** Otherwise, it returns PR_FAILURE. Further failure information can ** be obtained by calling PR_GetError(). ************************************************************************** **/ -NSPR_API(PRStatus) PR_GetSockName(PRFileDesc *fd, PRNetAddr *addr); +NSPR_API(PRStatus) PR_GetSockName(PRFileDesc *fd, PRNetAddr *addr); /* ************************************************************************* ** FUNCTION: PR_GetPeerName ** DESCRIPTION: -** Get name of the connected peer. Return the network address for the +** Get name of the connected peer. Return the network address for the ** connected peer socket. ** ** INPUTS: @@ -1757,17 +1749,17 @@ NSPR_API(PRStatus) PR_GetSockName(PRFileDesc *fd, PRNetAddr *addr); ** Returns the address of the connected peer in its own communication ** space. ** RETURN: PRStatus -** Upon successful completion, PR_GetPeerName returns PR_SUCCESS. -** Otherwise, it returns PR_FAILURE. Further failure information can +** Upon successful completion, PR_GetPeerName returns PR_SUCCESS. +** Otherwise, it returns PR_FAILURE. Further failure information can ** be obtained by calling PR_GetError(). ************************************************************************** **/ -NSPR_API(PRStatus) PR_GetPeerName(PRFileDesc *fd, PRNetAddr *addr); +NSPR_API(PRStatus) PR_GetPeerName(PRFileDesc *fd, PRNetAddr *addr); -NSPR_API(PRStatus) PR_GetSocketOption( +NSPR_API(PRStatus) PR_GetSocketOption( PRFileDesc *fd, PRSocketOptionData *data); -NSPR_API(PRStatus) PR_SetSocketOption( +NSPR_API(PRStatus) PR_SetSocketOption( PRFileDesc *fd, const PRSocketOptionData *data); /* @@ -1792,8 +1784,8 @@ NSPR_API(PRStatus) PR_SetSocketOption( * by a child process. If PR_FALSE, the file descriptor is set * to be not inheritable by a child process. * RETURN: PRStatus - * Upon successful completion, PR_SetFDInheritable returns PR_SUCCESS. - * Otherwise, it returns PR_FAILURE. Further failure information can + * Upon successful completion, PR_SetFDInheritable returns PR_SUCCESS. + * Otherwise, it returns PR_FAILURE. Further failure information can * be obtained by calling PR_GetError(). ************************************************************************* */ @@ -1812,7 +1804,7 @@ NSPR_API(PRStatus) PR_SetFDInheritable( * The name of the inherited file descriptor. * RETURN: PRFileDesc * * Upon successful completion, PR_GetInheritedFD returns the - * inherited file descriptor with the specified name. Otherwise, + * inherited file descriptor with the specified name. Otherwise, * it returns NULL. Further failure information can be obtained * by calling PR_GetError(). ************************************************************************* |