VirtualBox

Ignore:
Timestamp:
Nov 10, 2023 2:01:03 PM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom: Remove more now unused code from nsprpub, bugref:10545

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/prio.h

    r101935 r102063  
    441441/*
    442442 **************************************************************************
    443  * FUNCTION: PR_GetSpecialFD
    444  * DESCRIPTION: Get the file descriptor that represents the standard input,
    445  *              output, or error stream.
    446  * INPUTS:
    447  *     PRSpecialFD id
    448  *         A value indicating the type of stream desired:
    449  *             PR_StandardInput: standard input
    450  *             PR_StandardOuput: standard output
    451  *             PR_StandardError: standard error
    452  * OUTPUTS: none
    453  * RETURNS: PRFileDesc *
    454  *     If the argument is valid, PR_GetSpecialFD returns a file descriptor
    455  *     that represents the corresponding standard I/O stream.  Otherwise,
    456  *     PR_GetSpecialFD returns NULL and sets error PR_INVALID_ARGUMENT_ERROR.
    457  **************************************************************************
    458  */
    459 
    460 typedef enum PRSpecialFD
    461 {
    462     PR_StandardInput,          /* standard input */
    463     PR_StandardOutput,         /* standard output */
    464     PR_StandardError           /* standard error */
    465 } PRSpecialFD;
    466 
    467 NSPR_API(PRFileDesc*) PR_GetSpecialFD(PRSpecialFD id);
    468 
    469 #define PR_STDIN        PR_GetSpecialFD(PR_StandardInput)
    470 #define PR_STDOUT       PR_GetSpecialFD(PR_StandardOutput)
    471 #define PR_STDERR       PR_GetSpecialFD(PR_StandardError)
    472 
    473 /*
    474  **************************************************************************
    475  * Layering file descriptors
    476  *
    477  * File descriptors may be layered. Each layer has it's own identity.
    478  * Identities are allocated by the runtime and are to be associated
    479  * (by the layer implementor) with all layers that are of that type.
    480  * It is then possible to scan the chain of layers and find a layer
    481  * that one recongizes and therefore predict that it will implement
    482  * a desired protocol.
    483  *
    484  * There are three well-known identities:
    485  *      PR_INVALID_IO_LAYER => an invalid layer identity, for error return
    486  *      PR_TOP_IO_LAYER     => the identity of the top of the stack
    487  *      PR_NSPR_IO_LAYER    => the identity used by NSPR proper
    488  * PR_TOP_IO_LAYER may be used as a shorthand for identifying the topmost
    489  * layer of an existing stack. Ie., the following two constructs are
    490  * equivalent.
    491  *
    492  *      rv = PR_PushIOLayer(stack, PR_TOP_IO_LAYER, my_layer);
    493  *      rv = PR_PushIOLayer(stack, PR_GetLayersIdentity(stack), my_layer)
    494  *
    495  * A string may be associated with the creation of the identity. It
    496  * will be copied by the runtime. If queried the runtime will return
    497  * a reference to that copied string (not yet another copy). There
    498  * is no facility for deleting an identity.
    499  **************************************************************************
    500  */
    501 
    502 #define PR_IO_LAYER_HEAD (PRDescIdentity)-3
    503 #define PR_INVALID_IO_LAYER (PRDescIdentity)-1
    504 #define PR_TOP_IO_LAYER (PRDescIdentity)-2
    505 #define PR_NSPR_IO_LAYER (PRDescIdentity)0
    506 
    507 NSPR_API(PRDescIdentity) PR_GetUniqueIdentity(const char *layer_name);
    508 NSPR_API(const char*) PR_GetNameForIdentity(PRDescIdentity ident);
    509 NSPR_API(PRDescIdentity) PR_GetLayersIdentity(PRFileDesc* fd);
    510 NSPR_API(PRFileDesc*) PR_GetIdentitiesLayer(PRFileDesc* fd_stack, PRDescIdentity id);
    511 
    512 /*
    513  **************************************************************************
    514  * PR_GetDefaultIOMethods: Accessing the default methods table.
    515  * You may get a pointer to the default methods table by calling this function.
    516  * You may then select any elements from that table with which to build your
    517  * layer's methods table. You may NOT modify the table directly.
    518  **************************************************************************
    519  */
    520 NSPR_API(const PRIOMethods *) PR_GetDefaultIOMethods(void);
    521 
    522 /*
    523  **************************************************************************
    524  * Creating a layer
    525  *
    526  * A new layer may be allocated by calling PR_CreateIOLayerStub(). The
    527  * file descriptor returned will contain the pointer to the methods table
    528  * provided. The runtime will not modify the table nor test its correctness.
    529  **************************************************************************
    530  */
    531 NSPR_API(PRFileDesc*) PR_CreateIOLayerStub(
    532     PRDescIdentity ident, const PRIOMethods *methods);
    533 
    534 /*
    535  **************************************************************************
    536  * Creating a layer
    537  *
    538  * A new stack may be created by calling PR_CreateIOLayer(). The
    539  * file descriptor returned will point to the top of the stack, which has
    540  * the layer 'fd' as the topmost layer.
    541  *
    542  * NOTE: This function creates a new style stack, which has a fixed, dummy
    543  * header. The old style stack, created by a call to PR_PushIOLayer,
    544  * results in modifying contents of the top layer of the stack, when
    545  * pushing and popping layers of the stack.
    546  **************************************************************************
    547  */
    548 NSPR_API(PRFileDesc*) PR_CreateIOLayer(PRFileDesc* fd);
    549 
    550 /*
    551  **************************************************************************
    552  * Pushing a layer
    553  *
    554  * A file descriptor (perhaps allocated using PR_CreateIOLayerStub()) may
    555  * be pushed into an existing stack of file descriptors at any point the
    556  * caller deems appropriate. The new layer will be inserted into the stack
    557  * just above the layer with the indicated identity.
    558  *
    559  * Note: Even if the identity parameter indicates the top-most layer of
    560  * the stack, the value of the file descriptor describing the original
    561  * stack will not change.
    562  **************************************************************************
    563  */
    564 NSPR_API(PRStatus) PR_PushIOLayer(
    565     PRFileDesc *fd_stack, PRDescIdentity id, PRFileDesc *layer);
    566 
    567 /*
    568  **************************************************************************
    569  * Popping a layer
    570  *
    571  * A layer may be popped from a stack by indicating the identity of the
    572  * layer to be removed. If found, a pointer to the removed object will
    573  * be returned to the caller. The object then becomes the responsibility
    574  * of the caller.
    575  *
    576  * Note: Even if the identity indicates the top layer of the stack, the
    577  * reference returned will not be the file descriptor for the stack and
    578  * that file descriptor will remain valid.
    579  **************************************************************************
    580  */
    581 NSPR_API(PRFileDesc*) PR_PopIOLayer(PRFileDesc *fd_stack, PRDescIdentity id);
    582 
    583 /*
    584  **************************************************************************
    585443 * FUNCTION:    PR_Open
    586444 * DESCRIPTION:    Open a file for reading, writing, or both.
     
    763621NSPR_API(PRInt32) PR_Write(PRFileDesc *fd,const void *buf,PRInt32 amount);
    764622
    765 /*
    766  ***************************************************************************
    767  * FUNCTION: PR_Writev
    768  * DESCRIPTION:
    769  *     Write data to a socket.  The data is organized in a PRIOVec array. The
    770  *     operation will block until all the data is written or the operation
    771  *     fails.
    772  * INPUTS:
    773  *     PRFileDesc *fd
    774  *         Pointer that points to a PRFileDesc object for a socket.
    775  *     const PRIOVec *iov
    776  *         An array of PRIOVec.  PRIOVec is a struct with the following
    777  *         two fields:
    778  *             char *iov_base;
    779  *             int iov_len;
    780  *     PRInt32 iov_size
    781  *         Number of elements in the iov array. The value of this
    782  *         argument must not be greater than PR_MAX_IOVECTOR_SIZE.
    783  *         If it is, the method will fail (PR_BUFFER_OVERFLOW_ERROR).
    784  *     PRIntervalTime timeout
    785  *       Time limit for completion of the entire write operation.
    786  * OUTPUTS:
    787  *     None
    788  * RETURN:
    789  *     A positive number indicates the number of bytes successfully written.
    790  *     A -1 is an indication that the operation failed. The reason
    791  *     for the failure is obtained by calling PR_GetError().
    792  ***************************************************************************
    793  */
    794 
    795 #define PR_MAX_IOVECTOR_SIZE 16   /* 'iov_size' must be <= */
    796 
    797 NSPR_API(PRInt32) PR_Writev(
    798     PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size,
    799     PRIntervalTime timeout);
    800 
    801 /*
    802  ***************************************************************************
    803  * FUNCTION: PR_Delete
    804  * DESCRIPTION:
    805  *     Delete a file from the filesystem. The operation may fail if the
    806  *     file is open.
    807  * INPUTS:
    808  *     const char *name
    809  *         Path name of the file to be deleted.
    810  * OUTPUTS:
    811  *     None.
    812  * RETURN: PRStatus
    813  *     The function returns PR_SUCCESS if the file is successfully
    814  *     deleted, otherwise it returns PR_FAILURE.
    815  ***************************************************************************
    816  */
    817 
    818 NSPR_API(PRStatus) PR_Delete(const char *name);
    819 
    820623/**************************************************************************/
    821624
     
    861664NSPR_API(PRStatus) PR_GetFileInfo(const char *fn, PRFileInfo *info);
    862665NSPR_API(PRStatus) PR_GetFileInfo64(const char *fn, PRFileInfo64 *info);
    863 
    864 /*
    865  **************************************************************************
    866  * FUNCTION: PR_GetOpenFileInfo, PR_GetOpenFileInfo64
    867  * DESCRIPTION:
    868  *     Get information about an open file referred to by the
    869  *     given PRFileDesc object.
    870  * INPUTS:
    871  *     const PRFileDesc *fd
    872  *          A reference to a valid, open file.
    873  * OUTPUTS:
    874  *     Same as PR_GetFileInfo, PR_GetFileInfo64
    875  * RETURN: PRStatus
    876  *     PR_GetFileInfo returns PR_SUCCESS if file information is successfully
    877  *     obtained, otherwise it returns PR_FAILURE.
    878  ***************************************************************************
    879  */
    880 
    881 NSPR_API(PRStatus) PR_GetOpenFileInfo(PRFileDesc *fd, PRFileInfo *info);
    882 NSPR_API(PRStatus) PR_GetOpenFileInfo64(PRFileDesc *fd, PRFileInfo64 *info);
    883666
    884667/*
     
    918701NSPR_API(PROffset64) PR_Seek64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence);
    919702
    920 /*
    921  ************************************************************************
    922  * FUNCTION: PR_Available
    923  * DESCRIPTION:
    924  *     Determine the amount of data in bytes available for reading
    925  *     in the given file or socket.
    926  * INPUTS:
    927  *     PRFileDesc *fd
    928  *         Pointer to a PRFileDesc object that refers to a file or
    929  *         socket.
    930  * OUTPUTS:
    931  *     None
    932  * RETURN: PRInt32, PRInt64
    933  *     Upon successful completion, PR_Available returns the number of
    934  *     bytes beyond the current read pointer that is available for
    935  *     reading.  Otherwise, it returns a -1 and the reason for the
    936  *     failure can be retrieved via PR_GetError().
    937  ************************************************************************
    938  */
    939 
    940 NSPR_API(PRInt32) PR_Available(PRFileDesc *fd);
    941 
    942 /*
    943  ************************************************************************
    944  * FUNCTION: PR_Sync
    945  * DESCRIPTION:
    946  *     Sync any buffered data for a fd to its backing device (disk).
    947  * INPUTS:
    948  *     PRFileDesc *fd
    949  *         Pointer to a PRFileDesc object that refers to a file or
    950  *         socket
    951  * OUTPUTS:
    952  *     None
    953  * RETURN: PRStatus
    954  *     PR_SUCCESS is returned if the requested access is permitted.
    955  *     Otherwise, PR_FAILURE is returned.
    956  ************************************************************************
    957  */
    958 
    959 NSPR_API(PRStatus)      PR_Sync(PRFileDesc *fd);
    960 
    961 /*
    962  *************************************************************************
    963  * FUNCTION: PR_OpenTCPSocket
    964  * DESCRIPTION:
    965  *     Create a new TCP socket of the specified address family.
    966  * INPUTS:
    967  *     PRIntn af
    968  *       Address family
    969  * OUTPUTS:
    970  *     None
    971  * RETURN: PRFileDesc*
    972  *     Upon successful completion, PR_NewTCPSocket returns a pointer
    973  *     to the PRFileDesc created for the newly opened TCP socket.
    974  *     Returns a NULL pointer if the creation of a new TCP socket failed.
    975  *
    976  **************************************************************************
    977  */
    978 
    979 NSPR_API(PRFileDesc*)    PR_OpenTCPSocket(PRIntn af);
    980 
    981 /*
    982  *************************************************************************
    983  * FUNCTION: PR_Connect
    984  * DESCRIPTION:
    985  *     Initiate a connection on a socket.
    986  * INPUTS:
    987  *     PRFileDesc *fd
    988  *       Points to a PRFileDesc object representing a socket
    989  *     PRNetAddr *addr
    990  *       Specifies the address of the socket in its own communication
    991  *       space.
    992  *     PRIntervalTime timeout
    993  *       Time limit for completion of the connect operation.
    994  * OUTPUTS:
    995  *     None
    996  * RETURN: PRStatus
    997  *     Upon successful completion of connection initiation, PR_Connect
    998  *     returns PR_SUCCESS.  Otherwise, it returns PR_FAILURE.  Further
    999  *     failure information can be obtained by calling PR_GetError().
    1000  **************************************************************************
    1001  */
    1002 
    1003 NSPR_API(PRStatus) PR_Connect(
    1004     PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout);
    1005 
    1006 /*
    1007  *************************************************************************
    1008  * FUNCTION: PR_ConnectContinue
    1009  * DESCRIPTION:
    1010  *     Continue a nonblocking connect.  After a nonblocking connect
    1011  *     is initiated with PR_Connect() (which fails with
    1012  *     PR_IN_PROGRESS_ERROR), one should call PR_Poll() on the socket,
    1013  *     with the in_flags PR_POLL_WRITE | PR_POLL_EXCEPT.  When
    1014  *     PR_Poll() returns, one calls PR_ConnectContinue() on the
    1015  *     socket to determine whether the nonblocking connect has
    1016  *     completed or is still in progress.  Repeat the PR_Poll(),
    1017  *     PR_ConnectContinue() sequence until the nonblocking connect
    1018  *     has completed.
    1019  * INPUTS:
    1020  *     PRFileDesc *fd
    1021  *         the file descriptor representing a socket
    1022  *     PRInt16 out_flags
    1023  *         the out_flags field of the poll descriptor returned by
    1024  *         PR_Poll()
    1025  * RETURN: PRStatus
    1026  *     If the nonblocking connect has successfully completed,
    1027  *     PR_ConnectContinue returns PR_SUCCESS.  If PR_ConnectContinue()
    1028  *     returns PR_FAILURE, call PR_GetError():
    1029  *     - PR_IN_PROGRESS_ERROR: the nonblocking connect is still in
    1030  *       progress and has not completed yet.  The caller should poll
    1031  *       on the file descriptor for the in_flags
    1032  *       PR_POLL_WRITE|PR_POLL_EXCEPT and retry PR_ConnectContinue
    1033  *       later when PR_Poll() returns.
    1034  *     - Other errors: the nonblocking connect has failed with this
    1035  *       error code.
    1036  */
    1037 
    1038 NSPR_API(PRStatus)    PR_ConnectContinue(PRFileDesc *fd, PRInt16 out_flags);
    1039 
    1040 /*
    1041  *************************************************************************
    1042  * THIS FUNCTION IS DEPRECATED.  USE PR_ConnectContinue INSTEAD.
    1043  *
    1044  * FUNCTION: PR_GetConnectStatus
    1045  * DESCRIPTION:
    1046  *     Get the completion status of a nonblocking connect.  After
    1047  *     a nonblocking connect is initiated with PR_Connect() (which
    1048  *     fails with PR_IN_PROGRESS_ERROR), one should call PR_Poll()
    1049  *     on the socket, with the in_flags PR_POLL_WRITE | PR_POLL_EXCEPT.
    1050  *     When PR_Poll() returns, one calls PR_GetConnectStatus on the
    1051  *     PRPollDesc structure to determine whether the nonblocking
    1052  *     connect has succeeded or failed.
    1053  * INPUTS:
    1054  *     const PRPollDesc *pd
    1055  *         Pointer to a PRPollDesc whose fd member is the socket,
    1056  *         and in_flags must contain PR_POLL_WRITE and PR_POLL_EXCEPT.
    1057  *         PR_Poll() should have been called and set the out_flags.
    1058  * RETURN: PRStatus
    1059  *     If the nonblocking connect has successfully completed,
    1060  *     PR_GetConnectStatus returns PR_SUCCESS.  If PR_GetConnectStatus()
    1061  *     returns PR_FAILURE, call PR_GetError():
    1062  *     - PR_IN_PROGRESS_ERROR: the nonblocking connect is still in
    1063  *       progress and has not completed yet.
    1064  *     - Other errors: the nonblocking connect has failed with this
    1065  *       error code.
    1066  */
    1067 
    1068 NSPR_API(PRStatus)    PR_GetConnectStatus(const PRPollDesc *pd);
    1069 
    1070 /*
    1071  *************************************************************************
    1072  * FUNCTION: PR_Accept
    1073  * DESCRIPTION:
    1074  *     Accept a connection on a socket.
    1075  * INPUTS:
    1076  *     PRFileDesc *fd
    1077  *       Points to a PRFileDesc object representing the rendezvous socket
    1078  *       on which the caller is willing to accept new connections.
    1079  *     PRIntervalTime timeout
    1080  *       Time limit for completion of the accept operation.
    1081  * OUTPUTS:
    1082  *     PRNetAddr *addr
    1083  *       Returns the address of the connecting entity in its own
    1084  *       communication space. It may be NULL.
    1085  * RETURN: PRFileDesc*
    1086  *     Upon successful acceptance of a connection, PR_Accept
    1087  *     returns a valid file descriptor. Otherwise, it returns NULL.
    1088  *     Further failure information can be obtained by calling PR_GetError().
    1089  **************************************************************************
    1090  */
    1091 
    1092 NSPR_API(PRFileDesc*) PR_Accept(
    1093     PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout);
    1094 
    1095 /*
    1096  *************************************************************************
    1097  * FUNCTION: PR_Bind
    1098  * DESCRIPTION:
    1099  *    Bind an address to a socket.
    1100  * INPUTS:
    1101  *     PRFileDesc *fd
    1102  *       Points to a PRFileDesc object representing a socket.
    1103  *     PRNetAddr *addr
    1104  *       Specifies the address to which the socket will be bound.
    1105  * OUTPUTS:
    1106  *     None
    1107  * RETURN: PRStatus
    1108  *     Upon successful binding of an address to a socket, PR_Bind
    1109  *     returns PR_SUCCESS.  Otherwise, it returns PR_FAILURE.  Further
    1110  *     failure information can be obtained by calling PR_GetError().
    1111  **************************************************************************
    1112  */
    1113 
    1114 NSPR_API(PRStatus) PR_Bind(PRFileDesc *fd, const PRNetAddr *addr);
    1115 
    1116 /*
    1117  *************************************************************************
    1118  * FUNCTION: PR_Listen
    1119  * DESCRIPTION:
    1120  *    Listen for connections on a socket.
    1121  * INPUTS:
    1122  *     PRFileDesc *fd
    1123  *       Points to a PRFileDesc object representing a socket that will be
    1124  *       used to listen for new connections.
    1125  *     PRIntn backlog
    1126  *       Specifies the maximum length of the queue of pending connections.
    1127  * OUTPUTS:
    1128  *     None
    1129  * RETURN: PRStatus
    1130  *     Upon successful completion of listen request, PR_Listen
    1131  *     returns PR_SUCCESS.  Otherwise, it returns PR_FAILURE.  Further
    1132  *     failure information can be obtained by calling PR_GetError().
    1133  **************************************************************************
    1134  */
    1135 
    1136 NSPR_API(PRStatus) PR_Listen(PRFileDesc *fd, PRIntn backlog);
    1137 
    1138 /*
    1139  *************************************************************************
    1140  * FUNCTION: PR_Shutdown
    1141  * DESCRIPTION:
    1142  *    Shut down part of a full-duplex connection on a socket.
    1143  * INPUTS:
    1144  *     PRFileDesc *fd
    1145  *       Points to a PRFileDesc object representing a connected socket.
    1146  *     PRIntn how
    1147  *       Specifies the kind of disallowed operations on the socket.
    1148  *           PR_SHUTDOWN_RCV - Further receives will be disallowed
    1149  *           PR_SHUTDOWN_SEND - Further sends will be disallowed
    1150  *           PR_SHUTDOWN_BOTH - Further sends and receives will be disallowed
    1151  * OUTPUTS:
    1152  *     None
    1153  * RETURN: PRStatus
    1154  *     Upon successful completion of shutdown request, PR_Shutdown
    1155  *     returns PR_SUCCESS.  Otherwise, it returns PR_FAILURE.  Further
    1156  *     failure information can be obtained by calling PR_GetError().
    1157  **************************************************************************
    1158  */
    1159 
    1160 typedef enum PRShutdownHow
    1161 {
    1162     PR_SHUTDOWN_RCV = 0,      /* disallow further receives */
    1163     PR_SHUTDOWN_SEND = 1,     /* disallow further sends */
    1164     PR_SHUTDOWN_BOTH = 2      /* disallow further receives and sends */
    1165 } PRShutdownHow;
    1166 
    1167 NSPR_API(PRStatus)    PR_Shutdown(PRFileDesc *fd, PRShutdownHow how);
    1168 
    1169 /*
    1170  *************************************************************************
    1171  * FUNCTION: PR_Recv
    1172  * DESCRIPTION:
    1173  *    Receive a specified number of bytes from a connected socket.
    1174  *     The operation will block until some positive number of bytes are
    1175  *     transferred, a time out has occurred, or there is an error.
    1176  *     No more than 'amount' bytes will be transferred.
    1177  * INPUTS:
    1178  *     PRFileDesc *fd
    1179  *       points to a PRFileDesc object representing a socket.
    1180  *     void *buf
    1181  *       pointer to a buffer to hold the data received.
    1182  *     PRInt32 amount
    1183  *       the size of 'buf' (in bytes)
    1184  *     PRIntn flags
    1185  *       must be zero or PR_MSG_PEEK.
    1186  *     PRIntervalTime timeout
    1187  *       Time limit for completion of the receive operation.
    1188  * OUTPUTS:
    1189  *     None
    1190  * RETURN: PRInt32
    1191  *         a positive number indicates the number of bytes actually received.
    1192  *         0 means the network connection is closed.
    1193  *         -1 indicates a failure. The reason for the failure is obtained
    1194  *         by calling PR_GetError().
    1195  **************************************************************************
    1196  */
    1197 
    1198 #define PR_MSG_PEEK 0x2
    1199 
    1200 NSPR_API(PRInt32)    PR_Recv(PRFileDesc *fd, void *buf, PRInt32 amount,
    1201                 PRIntn flags, PRIntervalTime timeout);
    1202 
    1203 /*
    1204  *************************************************************************
    1205  * FUNCTION: PR_Send
    1206  * DESCRIPTION:
    1207  *    Send a specified number of bytes from a connected socket.
    1208  *     The operation will block until all bytes are
    1209  *     processed, a time out has occurred, or there is an error.
    1210  * INPUTS:
    1211  *     PRFileDesc *fd
    1212  *       points to a PRFileDesc object representing a socket.
    1213  *     void *buf
    1214  *       pointer to a buffer from where the data is sent.
    1215  *     PRInt32 amount
    1216  *       the size of 'buf' (in bytes)
    1217  *     PRIntn flags
    1218  *        (OBSOLETE - must always be zero)
    1219  *     PRIntervalTime timeout
    1220  *       Time limit for completion of the send operation.
    1221  * OUTPUTS:
    1222  *     None
    1223  * RETURN: PRInt32
    1224  *     A positive number indicates the number of bytes successfully processed.
    1225  *     This number must always equal 'amount'. A -1 is an indication that the
    1226  *     operation failed. The reason for the failure is obtained by calling
    1227  *     PR_GetError().
    1228  **************************************************************************
    1229  */
    1230 
    1231 NSPR_API(PRInt32)    PR_Send(PRFileDesc *fd, const void *buf, PRInt32 amount,
    1232                                 PRIntn flags, PRIntervalTime timeout);
    1233 
    1234 /*
    1235 *************************************************************************
    1236 ** FUNCTION: PR_GetSockName
    1237 ** DESCRIPTION:
    1238 **    Get socket name.  Return the network address for this socket.
    1239 **
    1240 ** INPUTS:
    1241 **     PRFileDesc *fd
    1242 **       Points to a PRFileDesc object representing the socket.
    1243 ** OUTPUTS:
    1244 **     PRNetAddr *addr
    1245 **       Returns the address of the socket in its own communication space.
    1246 ** RETURN: PRStatus
    1247 **     Upon successful completion, PR_GetSockName returns PR_SUCCESS. 
    1248 **     Otherwise, it returns PR_FAILURE.  Further failure information can
    1249 **     be obtained by calling PR_GetError().
    1250 **************************************************************************
    1251 **/
    1252 NSPR_API(PRStatus)      PR_GetSockName(PRFileDesc *fd, PRNetAddr *addr);
    1253 
    1254 /*
    1255 *************************************************************************
    1256 ** FUNCTION: PR_GetPeerName
    1257 ** DESCRIPTION:
    1258 **    Get name of the connected peer.  Return the network address for the
    1259 **    connected peer socket.
    1260 **
    1261 ** INPUTS:
    1262 **     PRFileDesc *fd
    1263 **       Points to a PRFileDesc object representing the connected peer.
    1264 ** OUTPUTS:
    1265 **     PRNetAddr *addr
    1266 **       Returns the address of the connected peer in its own communication
    1267 **       space.
    1268 ** RETURN: PRStatus
    1269 **     Upon successful completion, PR_GetPeerName returns PR_SUCCESS. 
    1270 **     Otherwise, it returns PR_FAILURE.  Further failure information can
    1271 **     be obtained by calling PR_GetError().
    1272 **************************************************************************
    1273 **/
    1274 NSPR_API(PRStatus)      PR_GetPeerName(PRFileDesc *fd, PRNetAddr *addr);
    1275 
    1276 NSPR_API(PRStatus)      PR_GetSocketOption(
    1277     PRFileDesc *fd, PRSocketOptionData *data);
    1278 
    1279 NSPR_API(PRStatus)      PR_SetSocketOption(
    1280     PRFileDesc *fd, const PRSocketOptionData *data);
    1281 
    1282 /*
    1283  *********************************************************************
    1284  *
    1285  * File descriptor inheritance
    1286  *
    1287  *********************************************************************
    1288  */
    1289 
    1290 /*
    1291  ************************************************************************
    1292  * FUNCTION: PR_SetFDInheritable
    1293  * DESCRIPTION:
    1294  *    Set the inheritance attribute of a file descriptor.
    1295  *
    1296  * INPUTS:
    1297  *     PRFileDesc *fd
    1298  *       Points to a PRFileDesc object.
    1299  *     PRBool inheritable
    1300  *       If PR_TRUE, the file descriptor fd is set to be inheritable
    1301  *       by a child process.  If PR_FALSE, the file descriptor is set
    1302  *       to be not inheritable by a child process.
    1303  * RETURN: PRStatus
    1304  *     Upon successful completion, PR_SetFDInheritable returns PR_SUCCESS. 
    1305  *     Otherwise, it returns PR_FAILURE.  Further failure information can
    1306  *     be obtained by calling PR_GetError().
    1307  *************************************************************************
    1308  */
    1309 NSPR_API(PRStatus) PR_SetFDInheritable(
    1310     PRFileDesc *fd,
    1311     PRBool inheritable);
    1312 
    1313 /*
    1314  ************************************************************************
    1315  * FUNCTION: PR_GetInheritedFD
    1316  * DESCRIPTION:
    1317  *    Get an inherited file descriptor with the specified name.
    1318  *
    1319  * INPUTS:
    1320  *     const char *name
    1321  *       The name of the inherited file descriptor.
    1322  * RETURN: PRFileDesc *
    1323  *     Upon successful completion, PR_GetInheritedFD returns the
    1324  *     inherited file descriptor with the specified name.  Otherwise, 
    1325  *     it returns NULL.  Further failure information can be obtained
    1326  *     by calling PR_GetError().
    1327  *************************************************************************
    1328  */
    1329 NSPR_API(PRFileDesc *) PR_GetInheritedFD(const char *name);
    1330 
    1331 /*
    1332  ******************************************************************
    1333  *
    1334  * Interprocess communication
    1335  *
    1336  ******************************************************************
    1337  */
    1338 
    1339 /*
    1340  * Creates an anonymous pipe and returns file descriptors for the
    1341  * read and write ends of the pipe.
    1342  */
    1343 
    1344 NSPR_API(PRStatus) PR_CreatePipe(
    1345     PRFileDesc **readPipe,
    1346     PRFileDesc **writePipe
    1347 );
    1348 
    1349 /************************************************************************/
    1350 /************** The following definitions are for poll ******************/
    1351 /************************************************************************/
    1352 
    1353 struct PRPollDesc {
    1354     PRFileDesc* fd;
    1355     PRInt16 in_flags;
    1356     PRInt16 out_flags;
    1357 };
    1358 
    1359 /*
    1360 ** Bit values for PRPollDesc.in_flags or PRPollDesc.out_flags. Binary-or
    1361 ** these together to produce the desired poll request.
    1362 */
    1363 
    1364 #if defined(_PR_POLL_BACKCOMPAT)
    1365 
    1366 #include <poll.h>
    1367 #define PR_POLL_READ    POLLIN
    1368 #define PR_POLL_WRITE   POLLOUT
    1369 #define PR_POLL_EXCEPT  POLLPRI
    1370 #define PR_POLL_ERR     POLLERR     /* only in out_flags */
    1371 #define PR_POLL_NVAL    POLLNVAL    /* only in out_flags when fd is bad */
    1372 #define PR_POLL_HUP     POLLHUP     /* only in out_flags */
    1373 
    1374 #else  /* _PR_POLL_BACKCOMPAT */
    1375 
    1376 #define PR_POLL_READ    0x1
    1377 #define PR_POLL_WRITE   0x2
    1378 #define PR_POLL_EXCEPT  0x4
    1379 #define PR_POLL_ERR     0x8         /* only in out_flags */
    1380 #define PR_POLL_NVAL    0x10        /* only in out_flags when fd is bad */
    1381 #define PR_POLL_HUP     0x20        /* only in out_flags */
    1382 
    1383 #endif  /* _PR_POLL_BACKCOMPAT */
    1384 
    1385 /*
    1386 *************************************************************************
    1387 ** FUNCTION:    PR_Poll
    1388 ** DESCRIPTION:
    1389 **
    1390 ** The call returns as soon as I/O is ready on one or more of the underlying
    1391 ** socket objects. A count of the number of ready descriptors is
    1392 ** returned unless a timeout occurs in which case zero is returned.
    1393 **
    1394 ** PRPollDesc.fd should be set to a pointer to a PRFileDesc object
    1395 ** representing a socket. This field can be set to NULL to indicate to
    1396 ** PR_Poll that this PRFileDesc object should be ignored.
    1397 ** PRPollDesc.in_flags should be set to the desired request
    1398 ** (read/write/except or some combination). Upon successful return from
    1399 ** this call PRPollDesc.out_flags will be set to indicate what kind of
    1400 ** i/o can be performed on the respective descriptor. PR_Poll() uses the
    1401 ** out_flags fields as scratch variables during the call. If PR_Poll()
    1402 ** returns 0 or -1, the out_flags fields do not contain meaningful values
    1403 ** and must not be used.
    1404 **
    1405 ** INPUTS:
    1406 **      PRPollDesc *pds         A pointer to an array of PRPollDesc
    1407 **
    1408 **      PRIntn npds             The number of elements in the array
    1409 **                              If this argument is zero PR_Poll is
    1410 **                              equivalent to a PR_Sleep(timeout).
    1411 **
    1412 **      PRIntervalTime timeout  Amount of time the call will block waiting
    1413 **                              for I/O to become ready. If this time expires
    1414 **                              w/o any I/O becoming ready, the result will
    1415 **                              be zero.
    1416 **
    1417 ** OUTPUTS:    None
    1418 ** RETURN:
    1419 **      PRInt32                 Number of PRPollDesc's with events or zero
    1420 **                              if the function timed out or -1 on failure.
    1421 **                              The reason for the failure is obtained by
    1422 **                              calling PR_GetError().
    1423 **************************************************************************
    1424 */
    1425 NSPR_API(PRInt32) PR_Poll(
    1426     PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout);
    1427 
    1428703PR_END_EXTERN_C
    1429704
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette