GW2RegisterLicenceMemory
GW2RegisterLicenceMemory는 메모리에 보관된 licence 파일을 세션에 등록합니다.
GW2RegisterLicenceFile 또는 GW2RegisterLicenceMemory 중 어느 것도 세션에 등록되지 않은 경우, Editor는 기본 위치에서 라이선스를 검색하려고 시도합니다. 이는 Editor 라이브러리와 동일한 폴더에 있는 gwkey.lic라는 파일입니다. 이 파일을 찾을 수 없으면 해당 라이브러리는 라이선스가 없는 것으로 간주되며, 일부 프로세스는 라이선스 만료 문제로 실패할 수 있습니다.
- C++
- C#
- Java
- Python
- JavaScript
개요
세션 session에 대해 GW2RegisterLicenceMemory 함수는 파일 처리 시 Glasswall에서 사용할 licence를 등록합니다. licenceContents는 licence 데이터에 대한 포인터이고, licenceLength는 licence 데이터의 크기를 바이트 단위로 지정합니다.
#include "glasswall.core2.api.h"
int GW2RegisterLicenceMemory(Session session,
const char *licenceContents,
size_t licenceLength);
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.
예제
#include "glasswall.core2.api.h"
Session session = GW2OpenSession();
char *licence = NULL;
size_t size = 0;
if (!session)
/* deal with error */
else
{
/* ... load 'licence' with a pointer to the licence content ... */
if (GW2RegisterLicenceMemory(session, licence, size) < 0)
/* deal with error */
else
/* continue processing */
}
. . .
/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */
개요
세션 session에 대해 RegisterLicenceMemory 메서드는 파일 처리 시 Glasswall에서 사용할 licence를 등록합니다.
/// <summary>
/// Provide a licence to use for the session.
/// </summary>
/// <param name="session">Current open Glasswall session</param>
/// <param name="licence">Byte content of the licence</param>
public int RegisterLicenceMemory(int session, byte[] licence)
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.
개요
import com.glasswall.core2javabridge.*;
public int GW2RegisterLicenceMemory(int session, byte[] licenceBuffer) throws GlasswallException, NullPointerException
public int GW2RegisterLicenceMemory(int session, byte[] licenceBuffer, int licenceLength) throws GlasswallException, NullPointerException
참고
The length of the licenceBuffer may optionally be specified.
반환값
GW2RegisterLicenceMemory 함수는 GW2_RetStatus 열거형을 int로 변환하여 반환합니다. 오류가 발생하면 값은 음수가 됩니다. 0은 성공을 나타냅니다. 자세한 내용은 API Overview/Return types를 참조하세요.
GlasswallException 예외는 session이 유효하지 않으면 발생합니다.
NullPointerException 예외는 licenceBuffer 버퍼가 null이거나 비어 있는 경우 발생합니다.
각 세션의 licence 등록은 Python wrapper에서 자동으로 처리되므로, 사용자가 GW2RegisterLicenceFile 또는 GW2RegisterLicenceMemory를 수동으로 호출할 필요가 없습니다.
By default, the Editor class expects a valid licence file to be located in the same directory as the library_path. You can also specify a different path to a gwkey.lic licence file using the licence argument.
import glasswall
# Load the Glasswall Editor library with a specified licence file
editor = glasswall.Editor(r"C:\gwpw\libraries\10.0", licence=r"C:\gwpw\licence\gwkey.lic")
또는 licence 데이터를 bytes, bytearray 또는 io.BytesIO 객체로 메모리 내에서 전달할 수 있습니다.
import glasswall
# Alternatively, load the licence from in-memory bytes or bytearray
with open(r"C:\gwpw\licence\gwkey.lic", "rb") as f:
licence_data = f.read()
editor = glasswall.Editor(
r"C:\gwpw\libraries\10.0",
licence=licence_data # In-memory licence data
)
개요
세션 session에 대해 GW2RegisterLicenceMemory 함수는 파일 처리 시 Glasswall에서 사용할 licence를 등록합니다. licenceContents는 licence 데이터에 대한 포인터이고, licenceLength는 licence 데이터의 크기를 바이트 단위로 지정합니다.
/**
* Provides the contents of the licence file that will be used for this session.
* @param {number} session The ID of the session.
* @param {string} licenceContents A pointer to the licence data buffer.
* @param {number} licenceLength Length of the data in the licence buffer.
* @returns {number} Status of the operation; 0 for success, non-zero for failure.
*/
GW2RegisterLicenceMemory(session, licenceContents, licenceLength)
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다.