GW2RegisterLicenceMemory
GW2RegisterLicenceMemory は、メモリ内に保持された licence file をセッションに登録します。
GW2RegisterLicenceFile と GW2RegisterLicenceMemory のいずれもセッションに登録されていない場合、Editor はデフォルトの場所でライセンスを検索しようとします。これは Editor library と同じフォルダーにある gwkey.lic というファイルです。これが見つからない場合、library はライセンス未登録と見なされ、一部の処理がライセンス有効期限の問題により失敗する可能性があります。
- 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 列挙値を返します。負の数は失敗を示します。
例
#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 列挙値を返します。負の数は失敗を示します。
概要
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 または空の場合にスローされます。
各セッションのライセンス登録は Python ラッパーで自動的に処理されるため、ユーザーが 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")
または、ライセンスデータを 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 列挙値を返します。負の数は失敗を示します。