GW2FileSessionStatus
    • PDF

    GW2FileSessionStatus

    • PDF

    Article summary

    The GW2FileSessionStatus function provides a string that describes, at a high level, the processing carried out on the last document processed by Glasswall.

    Synopsis

    #include "glasswall.core2.api.h"
    
    // For session  **session**  the  **GW2FileSessionStatus**  function places
    // in the object pointed to by  **statusMsgBuffer**  a pointer to a
    // string that describes, at a high level, the processing carried out on the
    // last document processed by Glasswall.
    
    int GW2FileSessionStatus(
        Session session,
        int *glasswallSessionStatus,
        char **statusMsgBuffer,
        size_t *statusBufferLength);

    Returns

    If session is invalid, it will return -1 and glasswallSessionStatus, statusMsgBuffer and statusBufferLength will be undefined. If session is valid, the function returns 0 and glasswallSessionStatus, statusMsgBuffer and statusBufferLength will be populated.

    Synopsis

    /// <param name="session">Current open Glasswall session</param>
    /// <param name="gwSessionStatus">Session status value</param>
    /// <param name="outputBuffer">String that describes, at a high level, the processing carried out on the last document </param>
    /// <param name="bufferLength">Size of the outputBuffer</param>
    public  int FileSessionStatus(
        int session,
        out IntPtr gwSessionStatus,
        out IntPtr outputBuffer,
        ref UIntPtr bufferLength)

    Returns

    If session is invalid, it will return -1. If session is valid, the function returns 0 and gwSessionStatus, outputBuffer and bufferLength will be populated.

    Synopsis

    import com.glasswall.core2javabridge.*;
    
    public FileSessionStatus GW2FileSessionStatusResult(int session) throws GlasswallException

    Note:

    This functionality previously required three separate function calls to retrieve the ID data. This has now been streamlined to return the settings as a FileSessionStatus object. The three original functions have been deprecated.

    Returns

    The GW2FileSessionStatusResult function returns a FileSessionStatus object containing the session summary status, and the session summary description.

    The FileSessionStatus object contains two variables that describe the status of session at the time the function is called. These are:

    VariableDescription
    int summaryStatus
    Status indicating the overall work carried out
    String summaryDescription
    Description of the overall work carried out

    A GlasswallException exception will be thrown if session is invalid, or if the session status information could not be retrieved.

    Synopsis - Deprecated Functions

    import com.glasswall.core2javabridge.*;
    
    (Deprecated)
    public int GW2FileSessionStatus(int session) throws GlasswallException
    public int GetFileSessionStatusInt(int session) throws GlasswallException
    public byte[] GetStatusBuffer(int session) throws GlasswallException
    Description

    The GW2FileSessionStatus function returns a status indicating whether the session status information could be retrieved for the session specified by session.

    Retrieve the session summary status through use of the GetFileSessionStatusInt function. 

    Retrieve the session summary status data through use of the GetStatusBuffer function. 

    Returns - Deprecated Functions

    The GW2FileSessionStatus function returns a GW2_RetStatus enumeration converted to int. The value will be negative if an error occurred. 0 indicates success. Please refer to API Overview for Return Types and their details.

    The GetStatusBuffer function returns a byte array buffer containing a summary description about the given session. This will be null if GW2FileSessionStatus has not been called.

    The GetFileSessionStatusInt function returns a status indicating the overall work carried out.

    A GlasswallException exception will be thrown if session is invalid, or if session status information could not be retrieved.

    Synopsis

    Retrieves the Glasswall session status message. Gives a high level indication of the processing that was carried out.

    def file_session_status_message(self, session: int, raise_unsupported: bool = True) -> str:
        """ Retrieves the Glasswall session status message. Gives a high level indication of the processing that was carried out.
    
        Args:
            session (int): The session integer.
            raise_unsupported (bool, optional): Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
    
        Returns:
            result.message (str):The file session status message.
        """

    Returns

    A file session status message as a string.

    Synopsis

    /**
    * This function retrieves the Glasswall Session Status. This status gives a high level indication of the processing
    * that was carried out on the last document processed by the library
    */
    
    GW2FileSessionStatus(session,
        glasswallSessionStatus,
        statusMsgBuffer,
        statusBufferLength)

    Returns

    If session is invalid, it will return -1 and glasswallSessionStatus, statusMsgBuffer and statusBufferLength will be undefined. If session is valid, the function returns 0 and glasswallSessionStatus, statusMsgBuffer and statusBufferLength will be populated.

    Example

    function getFileSessionStatus(session_id, gw) {
        /*
            Glasswall API signature:
            int GW2FileSessionStatus(
                Session session,
                int *glasswallSessionStatus,
                char **statusMsgBuffer,
                size_t *statusBufferLength
            );
        */
    
        // allocate space to store the session status; use .deref() to extract it
        let glasswallSessionStatus = ref.alloc('int');
    
        let CString_ptr = ref.refType(ref.types.CString);
        let statusMsgBuffer = ref.alloc(CString_ptr);
    
        // allocate space to store the buffer length; use .deref() to extract it
        let statusBufferLength = ref.alloc('size_t');
    
        let rv = gw.GW2FileSessionStatus(session_id, glasswallSessionStatus, statusMsgBuffer, statusBufferLength);
    
        arr_buf = buffer_to_array(statusMsgBuffer, statusBufferLength)
        // console.log(arr_buf.toString());
    
        let message = `\n  GW2FileSessionStatus:return=${rv}`;
        message += "\n    glasswallSessionStatus = " + glasswallSessionStatus.deref();
        message += "\n    statusMsgBuffer = \"" + arr_buf.toString() + '"';
        message += "\n    statusBufferLength = " + statusBufferLength.deref();
    
        return message;
    }

    Was this article helpful?