1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is the Netscape Portable Runtime (NSPR).
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998-2000
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | *
|
---|
24 | * Alternatively, the contents of this file may be used under the terms of
|
---|
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
28 | * of those above. If you wish to allow use of your version of this file only
|
---|
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
30 | * use your version of this file under the terms of the MPL, indicate your
|
---|
31 | * decision by deleting the provisions above and replace them with the notice
|
---|
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
33 | * the provisions above, a recipient may use your version of this file under
|
---|
34 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | /*
|
---|
39 | ** File: pprio.h
|
---|
40 | **
|
---|
41 | ** Description: Private definitions for I/O related structures
|
---|
42 | */
|
---|
43 |
|
---|
44 | #ifndef pprio_h___
|
---|
45 | #define pprio_h___
|
---|
46 |
|
---|
47 | #include "prtypes.h"
|
---|
48 | #include "prio.h"
|
---|
49 |
|
---|
50 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
51 | #define PR_GetFileMethods VBoxNsprPR_GetFileMethods
|
---|
52 | #define PR_GetTCPMethods VBoxNsprPR_GetTCPMethods
|
---|
53 | #define PR_GetUDPMethods VBoxNsprPR_GetUDPMethods
|
---|
54 | #define PR_GetPipeMethods VBoxNsprPR_GetPipeMethods
|
---|
55 | #define PR_FileDesc2NativeHandle VBoxNsprPR_FileDesc2NativeHandle
|
---|
56 | #define PR_ChangeFileDescNativeHandle VBoxNsprPR_ChangeFileDescNativeHandle
|
---|
57 | #define PR_AllocFileDesc VBoxNsprPR_AllocFileDesc
|
---|
58 | #define PR_FreeFileDesc VBoxNsprPR_FreeFileDesc
|
---|
59 | #define PR_ImportFile VBoxNsprPR_ImportFile
|
---|
60 | #define PR_ImportPipe VBoxNsprPR_ImportPipe
|
---|
61 | #define PR_ImportTCPSocket VBoxNsprPR_ImportTCPSocket
|
---|
62 | #define PR_ImportUDPSocket VBoxNsprPR_ImportUDPSocket
|
---|
63 | #define PR_CreateSocketPollFd VBoxNsprPR_CreateSocketPollFd
|
---|
64 | #define PR_DestroySocketPollFd VBoxNsprPR_DestroySocketPollFd
|
---|
65 | #define PR_Socket VBoxNsprPR_Socket
|
---|
66 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
67 |
|
---|
68 | PR_BEGIN_EXTERN_C
|
---|
69 |
|
---|
70 | /************************************************************************/
|
---|
71 | /************************************************************************/
|
---|
72 |
|
---|
73 | /* Return the method tables for files, tcp sockets and udp sockets */
|
---|
74 | NSPR_API(const PRIOMethods*) PR_GetFileMethods(void);
|
---|
75 | NSPR_API(const PRIOMethods*) PR_GetTCPMethods(void);
|
---|
76 | NSPR_API(const PRIOMethods*) PR_GetUDPMethods(void);
|
---|
77 | NSPR_API(const PRIOMethods*) PR_GetPipeMethods(void);
|
---|
78 |
|
---|
79 | /*
|
---|
80 | ** Convert a NSPR Socket Handle to a Native Socket handle.
|
---|
81 | ** This function will be obsoleted with the next release; avoid using it.
|
---|
82 | */
|
---|
83 | NSPR_API(PRInt32) PR_FileDesc2NativeHandle(PRFileDesc *);
|
---|
84 | NSPR_API(void) PR_ChangeFileDescNativeHandle(PRFileDesc *, PRInt32);
|
---|
85 | NSPR_API(PRFileDesc*) PR_AllocFileDesc(PRInt32 osfd,
|
---|
86 | const PRIOMethods *methods);
|
---|
87 | NSPR_API(void) PR_FreeFileDesc(PRFileDesc *fd);
|
---|
88 | /*
|
---|
89 | ** Import an existing OS file to NSPR.
|
---|
90 | */
|
---|
91 | NSPR_API(PRFileDesc*) PR_ImportFile(PRInt32 osfd);
|
---|
92 | NSPR_API(PRFileDesc*) PR_ImportPipe(PRInt32 osfd);
|
---|
93 | NSPR_API(PRFileDesc*) PR_ImportTCPSocket(PRInt32 osfd);
|
---|
94 | NSPR_API(PRFileDesc*) PR_ImportUDPSocket(PRInt32 osfd);
|
---|
95 |
|
---|
96 |
|
---|
97 | /*
|
---|
98 | *************************************************************************
|
---|
99 | * FUNCTION: PR_CreateSocketPollFd
|
---|
100 | * DESCRIPTION:
|
---|
101 | * Create a PRFileDesc wrapper for a native socket handle, for use with
|
---|
102 | * PR_Poll only
|
---|
103 | * INPUTS:
|
---|
104 | * None
|
---|
105 | * OUTPUTS:
|
---|
106 | * None
|
---|
107 | * RETURN: PRFileDesc*
|
---|
108 | * Upon successful completion, PR_CreateSocketPollFd returns a pointer
|
---|
109 | * to the PRFileDesc created for the native socket handle
|
---|
110 | * Returns a NULL pointer if the create of a new PRFileDesc failed
|
---|
111 | *
|
---|
112 | **************************************************************************
|
---|
113 | */
|
---|
114 |
|
---|
115 | NSPR_API(PRFileDesc*) PR_CreateSocketPollFd(PRInt32 osfd);
|
---|
116 |
|
---|
117 | /*
|
---|
118 | *************************************************************************
|
---|
119 | * FUNCTION: PR_DestroySocketPollFd
|
---|
120 | * DESCRIPTION:
|
---|
121 | * Destroy the PRFileDesc wrapper created by PR_CreateSocketPollFd
|
---|
122 | * INPUTS:
|
---|
123 | * None
|
---|
124 | * OUTPUTS:
|
---|
125 | * None
|
---|
126 | * RETURN: PRFileDesc*
|
---|
127 | * Upon successful completion, PR_DestroySocketPollFd returns
|
---|
128 | * PR_SUCCESS, else PR_FAILURE
|
---|
129 | *
|
---|
130 | **************************************************************************
|
---|
131 | */
|
---|
132 |
|
---|
133 | NSPR_API(PRStatus) PR_DestroySocketPollFd(PRFileDesc *fd);
|
---|
134 |
|
---|
135 |
|
---|
136 | /*
|
---|
137 | ** Macros for PR_Socket
|
---|
138 | **
|
---|
139 | ** Socket types: PR_SOCK_STREAM, PR_SOCK_DGRAM
|
---|
140 | */
|
---|
141 |
|
---|
142 | #define PR_SOCK_STREAM SOCK_STREAM
|
---|
143 | #define PR_SOCK_DGRAM SOCK_DGRAM
|
---|
144 |
|
---|
145 | /*
|
---|
146 | ** Create a new Socket; this function is obsolete.
|
---|
147 | */
|
---|
148 | NSPR_API(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto);
|
---|
149 |
|
---|
150 | PR_END_EXTERN_C
|
---|
151 |
|
---|
152 | #endif /* pprio_h___ */
|
---|