📄 prio.h
字号:
* Sync any buffered data for a fd to its backing device (disk).
* INPUTS:
* PRFileDesc *fd
* Pointer to a PRFileDesc object that refers to a file or
* socket
* OUTPUTS:
* None
* RETURN: PRStatus
* PR_SUCCESS is returned if the requested access is permitted.
* Otherwise, PR_FAILURE is returned.
************************************************************************
*/
NSPR_API(PRStatus) PR_Sync(PRFileDesc *fd);
/************************************************************************/
struct PRDirEntry {
const char *name; /* name of entry, relative to directory name */
};
#ifdef MOZ_UNICODE
struct PRDirEntryUTF16 {
const PRUnichar *name; /* name of entry in UTF16, relative to
* directory name */
};
#endif /* MOZ_UNICODE */
#if !defined(NO_NSPR_10_SUPPORT)
#define PR_DirName(dirEntry) (dirEntry->name)
#endif
/*
*************************************************************************
* FUNCTION: PR_OpenDir
* DESCRIPTION:
* Open the directory by the given name
* INPUTS:
* const char *name
* path name of the directory to be opened
* OUTPUTS:
* None
* RETURN: PRDir *
* If the directory is sucessfully opened, a PRDir object is
* dynamically allocated and a pointer to it is returned.
* If the directory cannot be opened, a NULL pointer is returned.
* MEMORY:
* Upon successful completion, the return value points to
* dynamically allocated memory.
*************************************************************************
*/
NSPR_API(PRDir*) PR_OpenDir(const char *name);
#ifdef MOZ_UNICODE
/*
* EXPERIMENTAL: This function may be removed in a future release.
*/
NSPR_API(PRDirUTF16*) PR_OpenDirUTF16(const PRUnichar *name);
#endif /* MOZ_UNICODE */
/*
*************************************************************************
* FUNCTION: PR_ReadDir
* DESCRIPTION:
* INPUTS:
* PRDir *dir
* pointer to a PRDir object that designates an open directory
* PRDirFlags flags
* PR_SKIP_NONE Do not skip any files
* PR_SKIP_DOT Skip the directory entry "." that
* represents the current directory
* PR_SKIP_DOT_DOT Skip the directory entry ".." that
* represents the parent directory.
* PR_SKIP_BOTH Skip both '.' and '..'
* PR_SKIP_HIDDEN Skip hidden files
* OUTPUTS:
* RETURN: PRDirEntry*
* Returns a pointer to the next entry in the directory. Returns
* a NULL pointer upon reaching the end of the directory or when an
* error occurs. The actual reason can be retrieved via PR_GetError().
*************************************************************************
*/
typedef enum PRDirFlags {
PR_SKIP_NONE = 0x0,
PR_SKIP_DOT = 0x1,
PR_SKIP_DOT_DOT = 0x2,
PR_SKIP_BOTH = 0x3,
PR_SKIP_HIDDEN = 0x4
} PRDirFlags;
NSPR_API(PRDirEntry*) PR_ReadDir(PRDir *dir, PRDirFlags flags);
#ifdef MOZ_UNICODE
/*
* EXPERIMENTAL: This function may be removed in a future release.
*/
NSPR_API(PRDirEntryUTF16*) PR_ReadDirUTF16(PRDirUTF16 *dir, PRDirFlags flags);
#endif /* MOZ_UNICODE */
/*
*************************************************************************
* FUNCTION: PR_CloseDir
* DESCRIPTION:
* Close the specified directory.
* INPUTS:
* PRDir *dir
* The directory to be closed.
* OUTPUTS:
* None
* RETURN: PRStatus
* If successful, will return a status of PR_SUCCESS. Otherwise
* a value of PR_FAILURE. The reason for the failure may be re-
* trieved using PR_GetError().
*************************************************************************
*/
NSPR_API(PRStatus) PR_CloseDir(PRDir *dir);
#ifdef MOZ_UNICODE
/*
* EXPERIMENTAL: This function may be removed in a future release.
*/
NSPR_API(PRStatus) PR_CloseDirUTF16(PRDirUTF16 *dir);
#endif /* MOZ_UNICODE */
/*
*************************************************************************
* FUNCTION: PR_MkDir
* DESCRIPTION:
* Create a new directory with the given name and access mode.
* INPUTS:
* const char *name
* The name of the directory to be created. All the path components
* up to but not including the leaf component must already exist.
* PRIntn mode
* See 'mode' definiton in PR_Open().
* OUTPUTS:
* None
* RETURN: PRStatus
* If successful, will return a status of PR_SUCCESS. Otherwise
* a value of PR_FAILURE. The reason for the failure may be re-
* trieved using PR_GetError().
*************************************************************************
*/
NSPR_API(PRStatus) PR_MkDir(const char *name, PRIntn mode);
/*
*************************************************************************
* FUNCTION: PR_MakeDir
* DESCRIPTION:
* Create a new directory with the given name and access mode.
* PR_MakeDir has the same prototype as PR_MkDir but implements
* the specified access mode where possible.
*************************************************************************
*/
NSPR_API(PRStatus) PR_MakeDir(const char *name, PRIntn mode);
/*
*************************************************************************
* FUNCTION: PR_RmDir
* DESCRIPTION:
* Remove a directory by the given name.
* INPUTS:
* const char *name
* The name of the directory to be removed. All the path components
* must already exist. Only the leaf component will be removed.
* OUTPUTS:
* None
* RETURN: PRStatus
* If successful, will return a status of PR_SUCCESS. Otherwise
* a value of PR_FAILURE. The reason for the failure may be re-
* trieved using PR_GetError().
**************************************************************************
*/
NSPR_API(PRStatus) PR_RmDir(const char *name);
/*
*************************************************************************
* FUNCTION: PR_NewUDPSocket
* DESCRIPTION:
* Create a new UDP socket.
* INPUTS:
* None
* OUTPUTS:
* None
* RETURN: PRFileDesc*
* Upon successful completion, PR_NewUDPSocket returns a pointer
* to the PRFileDesc created for the newly opened UDP socket.
* Returns a NULL pointer if the creation of a new UDP socket failed.
*
**************************************************************************
*/
NSPR_API(PRFileDesc*) PR_NewUDPSocket(void);
/*
*************************************************************************
* FUNCTION: PR_NewTCPSocket
* DESCRIPTION:
* Create a new TCP socket.
* INPUTS:
* None
* OUTPUTS:
* None
* RETURN: PRFileDesc*
* Upon successful completion, PR_NewTCPSocket returns a pointer
* to the PRFileDesc created for the newly opened TCP socket.
* Returns a NULL pointer if the creation of a new TCP socket failed.
*
**************************************************************************
*/
NSPR_API(PRFileDesc*) PR_NewTCPSocket(void);
/*
*************************************************************************
* FUNCTION: PR_OpenUDPSocket
* DESCRIPTION:
* Create a new UDP socket of the specified address family.
* INPUTS:
* PRIntn af
* Address family
* OUTPUTS:
* None
* RETURN: PRFileDesc*
* Upon successful completion, PR_OpenUDPSocket returns a pointer
* to the PRFileDesc created for the newly opened UDP socket.
* Returns a NULL pointer if the creation of a new UDP socket failed.
*
**************************************************************************
*/
NSPR_API(PRFileDesc*) PR_OpenUDPSocket(PRIntn af);
/*
*************************************************************************
* FUNCTION: PR_OpenTCPSocket
* DESCRIPTION:
* Create a new TCP socket of the specified address family.
* INPUTS:
* PRIntn af
* Address family
* OUTPUTS:
* None
* RETURN: PRFileDesc*
* Upon successful completion, PR_NewTCPSocket returns a pointer
* to the PRFileDesc created for the newly opened TCP socket.
* Returns a NULL pointer if the creation of a new TCP socket failed.
*
**************************************************************************
*/
NSPR_API(PRFileDesc*) PR_OpenTCPSocket(PRIntn af);
/*
*************************************************************************
* FUNCTION: PR_Connect
* DESCRIPTION:
* Initiate a connection on a socket.
* INPUTS:
* PRFileDesc *fd
* Points to a PRFileDesc object representing a socket
* PRNetAddr *addr
* Specifies the address of the socket in its own communication
* space.
* PRIntervalTime timeout
* Time limit for completion of the connect operation.
* OUTPUTS:
* None
* RETURN: PRStatus
* Upon successful completion of connection initiation, PR_Connect
* returns PR_SUCCESS. Otherwise, it returns PR_FAILURE. Further
* failure information can be obtained by calling PR_GetError().
**************************************************************************
*/
NSPR_API(PRStatus) PR_Connect(
PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout);
/*
*************************************************************************
* FUNCTION: PR_ConnectContinue
* DESCRIPTION:
* Continue a nonblocking connect. After a nonblocking connect
* is initiated with PR_Connect() (which fails with
* PR_IN_PROGRESS_ERROR), one should call PR_Poll() on the socket,
* with the in_flags PR_POLL_WRITE | PR_POLL_EXCEPT. When
* PR_Poll() returns, one calls PR_ConnectContinue() on the
* socket to determine whether the nonblocking connect has
* completed or is still in progress. Repeat the PR_Poll(),
* PR_ConnectContinue() sequence until the nonblocking connect
* has completed.
* INPUTS:
* PRFileDesc *fd
* the file descriptor representing a socket
* PRInt16 out_flags
* the out_flags field of the poll descriptor returned by
* PR_Poll()
* RETURN: PRStatus
* If the nonblocking connect has successfully completed,
* PR_ConnectContinue returns PR_SUCCESS. If PR_ConnectContinue()
* returns PR_FAILURE, call PR_GetError():
* - PR_IN_PROGRESS_ERROR: the nonblocking connect is still in
* progress and has not completed yet. The caller should poll
* on the file descriptor for the in_flags
* PR_POLL_WRITE|PR_POLL_EXCEPT and retry PR_ConnectContinue
* later when PR_Poll() returns.
* - Other errors: the nonblocking connect has failed with this
* error code.
*/
NSPR_API(PRStatus) PR_ConnectContinue(PRFileDesc *fd, PRInt16 out_flags);
/*
*************************************************************************
* THIS FUNCTION IS DEPRECATED. USE PR_ConnectContinue INSTEAD.
*
* FUNCTION: PR_GetConnectStatus
* DESCRIPTION:
* Get the completion status of a nonblocking connect. After
* a nonblocking connect is initiated with PR_Connect() (which
* fails with PR_IN_PROGRESS_ERROR), one should call PR_Poll()
* on the socket, with the in_flags PR_POLL_WRITE | PR_POLL_EXCEPT.
* When PR_Poll() returns, one calls PR_GetConnectStatus on the
* PRPollDesc structure to determine whether the nonblocking
* connect has succeeded or failed.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -