The GW2RegisterInputMemory function registers the input file which is stored in memory to a session.
Synopsis
The GW2RegisterInputMemory function registers the file which is stored in the buffer pointed to by inputFileBuffer of size inputLength bytes, with the session denoted by session.
#include "glasswall.core2.api.h"
int GW2RegisterInputMemory(Session session, const char *inputFileBuffer, size_t inputLength);Returns
Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.
Example
#include "glasswall.core2.api.h"
...
HANDLE session = GW2OpenSession();
if (!session)
/* deal with error */
else
{
/* ... load file contents into buffer 'buf' and log the file size in 'size' ... */
if (GW2RegisterInputMemory(session, buf, size))
/* deal with error */
else
/* continue processing */
...
}
/* later */
if (GW2CloseSession(session))
/* error closing session */Synopsis
public int RegisterInputMemory(
int session,
byte[] inputFileBuffer)
Returns
Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.
Synopsis
import com.glasswall.core2javabridge.*;
public int GW2RegisterInputMemory(int session, byte[] inputFileBuffer) throws GlasswallException, NullPointerException
public int GW2RegisterInputMemory(int session, byte[] inputFileBuffer, int length) throws GlasswallException, NullPointerExceptionNote:
The length of the inputFileBuffer may optionally be specified.
Returns
The GW2RegisterInputMemory 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.
A GlasswallException exception will be thrown if session is invalid, or if the input buffer could not be retrieved.
A NullPointerException exception will be thrown if inputFileBuffer buffer is null or empty.
Synopsis
Register an input file or bytes for the given session.
def register_input(self, session: int, input_file: Union[str, bytes, bytearray, io.BytesIO]):
""" Register an input file or bytes for the given session.
Args:
session (int): The session integer.
input_file (Union[str, bytes, bytearray, io.BytesIO]): The input file path or bytes.
Returns:
- result (glasswall.GwReturnObj): Depending on the input 'input_file':
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'input_file', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'status'.
"""Returns
An object with different attributes depending on the type of input_file.
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'input_file', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'status'.
The status attribute is an integer GW2_RetStatus enum value. Negative numbers indicate a failure.
Synopsis
This function registers a file stored in memory as the input file for a specified session.
/**
* @param {number} session The ID of the session.
* @param {string} inputFileBuffer A buffer holding the file data
* @param {number} inputLength The size of the file buffer
*/
GW2RegisterInputMemory(session, inputFileBuffer, inputLength)Returns
Returns an integer GW2_RetStatus enum value. Negative numbers indicate a failure.