Class PR

java.lang.Object
org.mozilla.jss.nss.PR

public class PR extends Object
This class provides static access to raw NSPS calls with the PR prefix, and handles the usage of NativeProxy objects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Return value on failure from NSPR functions.
    static final int
    Shut down both sides of the TCP connection.
    static final int
    Shut down the receiving side of the TCP connection.
    static final int
    Shut down the sending side of the TCP connection.
    static final int
    Return value on success from NSPR functions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PR()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Close an existing PRFDProxy, clearing the pointer if successful.
    static int
    Close(PRFDProxy fd, boolean clear)
    Close an existing PRFDProxy with an option to clear the pointer.
    static int
    Close an existing SSLFDProxy.
    static String
    ErrorToName(int code)
    Get the constant name of the current PR error.
    private static byte[]
     
    static int
    Get the value of the current PR error.
    static String
    Get the error text of the current PR error.
    private static byte[]
     
    private static int
     
    private static int
     
    private static int
     
    private static int
     
    private static int
     
    static PRFDProxy
    NewBufferPRFD(BufferProxy read_buf, BufferProxy write_buf, byte[] peer_info)
    Create a new j_buffer backed PRFileDesc, mimicing a TCP socket with the specified peer_info.
    static PRFDProxy
    Open a new TCP Socket and create a new PRFDProxy for that socket.
    static PRFDProxy
    Open(String name, int flags, int mode)
    Open the file at name (with the specified flags and mode) and create a new PRFDProxy (to a NSPR PRFileDesc *) for that file.
    static byte[]
    Read(PRFDProxy fd, int amount)
    Read up to amount bytes from a PRFDProxy.
    static byte[]
    Recv(PRFDProxy fd, int amount, int flags, long timeout)
    Recv up to amount bytes from a PRFDProxy, given the specified receive flags and timeout value.
    static int
    Send(PRFDProxy fd, byte[] buf, int flags, long timeout)
    Send the specified bytes via the PRFDProxy, given the specified send flags and timeout value.
    static int
    Shutdown(PRFDProxy fd, int how)
    Shutdown an existing PRFDProxy.
    static int
    Write(PRFDProxy fd, byte[] buf)
    Write the specified bytes to the PRFDProxy.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SHUTDOWN_RCV

      public static final int SHUTDOWN_RCV
      Shut down the receiving side of the TCP connection. See also: Shutdown
    • SHUTDOWN_SEND

      public static final int SHUTDOWN_SEND
      Shut down the sending side of the TCP connection. See also: Shutdown
    • SHUTDOWN_BOTH

      public static final int SHUTDOWN_BOTH
      Shut down both sides of the TCP connection. See also: Shutdown
    • SUCCESS

      public static final int SUCCESS
      Return value on success from NSPR functions. See also: PR_SUCCESS in /usr/include/nspr4/prtypes.h
    • FAILURE

      public static final int FAILURE
      Return value on failure from NSPR functions. See also: PR_FAILURE in /usr/include/nspr4/prtypes.h
  • Constructor Details

    • PR

      public PR()
  • Method Details

    • Open

      public static PRFDProxy Open(String name, int flags, int mode)
      Open the file at name (with the specified flags and mode) and create a new PRFDProxy (to a NSPR PRFileDesc *) for that file. See also: PR_Open in /usr/include/nspr4/prio.h
    • NewTCPSocket

      public static PRFDProxy NewTCPSocket()
      Open a new TCP Socket and create a new PRFDProxy for that socket. See also: PR_NewTCPSocket in /usr/include/nspr4/prio.h
    • NewBufferPRFD

      public static PRFDProxy NewBufferPRFD(BufferProxy read_buf, BufferProxy write_buf, byte[] peer_info)
      Create a new j_buffer backed PRFileDesc, mimicing a TCP socket with the specified peer_info. See also: newBufferPRFileDesc in org/mozilla/jss/ssl/javax/BufferPRFD.h
    • Close

      public static int Close(PRFDProxy fd)
      Close an existing PRFDProxy, clearing the pointer if successful. See also: PR_Close in /usr/include/nspr4/prio.h
    • Close

      public static int Close(PRFDProxy fd, boolean clear)
      Close an existing PRFDProxy with an option to clear the pointer. See also: PR_Close in /usr/include/nspr4/prio.h
    • Close

      public static int Close(SSLFDProxy fd) throws Exception
      Close an existing SSLFDProxy. See also: org.mozilla.jss.nss.PR.Close org.mozilla.jss.nss.SSLFDProxy.releaseNativeResources
      Throws:
      Exception
    • Shutdown

      public static int Shutdown(PRFDProxy fd, int how)
      Shutdown an existing PRFDProxy. This is usually used with TCP modes. See also: PR_Shutdown in /usr/include/nspr4/prio.h
    • Read

      public static byte[] Read(PRFDProxy fd, int amount)
      Read up to amount bytes from a PRFDProxy. See also: PR_Read in /usr/include/nspr4/prio.h
    • Recv

      public static byte[] Recv(PRFDProxy fd, int amount, int flags, long timeout)
      Recv up to amount bytes from a PRFDProxy, given the specified receive flags and timeout value. See also: PR_Recv in /usr/include/nspr4/prio.h
    • Write

      public static int Write(PRFDProxy fd, byte[] buf)
      Write the specified bytes to the PRFDProxy. Note: Unlike PR_Write, this method assumes the entire buffer is being written. See also: PR_Write in /usr/include/nspr4/prio.h
    • Send

      public static int Send(PRFDProxy fd, byte[] buf, int flags, long timeout)
      Send the specified bytes via the PRFDProxy, given the specified send flags and timeout value. See also: PR_Send in /usr/include/nspr4/prio.h
    • GetError

      public static int GetError()
      Get the value of the current PR error. This is cleared on each NSPR call. See also: PR_GetError in /usr/include/nspr4/prio.h
    • GetErrorText

      public static String GetErrorText()
      Get the error text of the current PR error. This is cleared on each NSPR call. See also: PR_GetErrorText in /usr/include/nspr4/prio.h
    • GetErrorTextNative

      private static byte[] GetErrorTextNative()
    • ErrorToName

      public static String ErrorToName(int code)
      Get the constant name of the current PR error. This is cleared on each NSPR call. See also: PR_ErrorToName in /usr/include/nspr4/prio.h
    • ErrorToNameNative

      private static byte[] ErrorToNameNative(int code)
    • getPRShutdownRcv

      private static int getPRShutdownRcv()
    • getPRShutdownSend

      private static int getPRShutdownSend()
    • getPRShutdownBoth

      private static int getPRShutdownBoth()
    • getPRSuccess

      private static int getPRSuccess()
    • getPRFailure

      private static int getPRFailure()