Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add GetFloatingLicenseMode function #12

Merged
merged 7 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions lexfloatclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

type callbackType func(int)

const (
const (
LA_USER uint = 0
LA_SYSTEM uint = 1
LA_IN_MEMORY uint = 2
Expand Down Expand Up @@ -50,6 +50,7 @@ func SetHostProductId(productId string) int {
freeCString(cProductId)
return int(status)
}

/*
FUNCTION: SetHostUrl()

Expand Down Expand Up @@ -125,14 +126,14 @@ func SetFloatingClientMetadata(key string, value string) int {
PARAMETERS:
* libraryVersion - pointer to a buffer that receives the value of the string
* length - size of the buffer pointed to by the libraryVersion parameter

RETURN CODES: LF_OK, LF_E_BUFFER_SIZE
*/
func GetFloatingClientLibraryVersion(libraryVersion *string) int {
var cLibraryVersion = getCArray()
status := C.GetFloatingClientLibraryVersion(&cLibraryVersion[0], maxCArrayLength)
*libraryVersion = ctoGoString(&cLibraryVersion[0])
return int(status)
var cLibraryVersion = getCArray()
status := C.GetFloatingClientLibraryVersion(&cLibraryVersion[0], maxCArrayLength)
*libraryVersion = ctoGoString(&cLibraryVersion[0])
return int(status)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@muneebkq Is this the UI reflecting this or was the indentation by mistake added here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was no proper indentation earlier


/*
Expand Down Expand Up @@ -193,7 +194,7 @@ func GetHostProductVersionFeatureFlag(name string, enabled *bool, data *string)
*enabled = cEnabled > 0
*data = ctoGoString(&cData[0])
return int(status)
}
}

/*
FUNCTION: GetHostLicenseMetadata()
Expand Down Expand Up @@ -242,6 +243,7 @@ func GetHostLicenseMeterAttribute(name string, allowedUses *uint, totalUses *uin
freeCString(cName)
return int(status)
}

/*
FUNCTION: GetHostLicenseExpiryDate()

Expand All @@ -258,6 +260,7 @@ func GetHostLicenseExpiryDate(expiryDate *uint) int {
*expiryDate = uint(cExpiryDate)
return int(status)
}

/*
FUNCTION: GetFloatingClientMeterAttributeUses()

Expand All @@ -277,6 +280,7 @@ func GetFloatingClientMeterAttributeUses(name string, uses *uint) int {
freeCString(cName)
return int(status)
}

/*
FUNCTION: RequestFloatingLicense()

Expand Down Expand Up @@ -339,6 +343,25 @@ func HasFloatingLicense() int {
return int(status)
}

/*

FUNCTION: GetFloatinglicenseMode()

PURPOSE: Gets the mode of the floating license (online or offline).

PARAMETERS:
* mode - pointer to a buffer that receives the value of the string
* length - size of the buffer pointed to by the value parameter

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_BUFFER_SIZE
*/
func GetFloatingLicenseMode(mode *string) int {
var cMode = getCArray()
status := C.GetFloatingLicenseMode(&cMode[0], maxCArrayLength)
*mode= ctoGoString(&cMode[0])
return int(status)
}

/*
FUNCTION: RequestOfflineFloatingLicense()

Expand All @@ -358,7 +381,7 @@ func RequestOfflineFloatingLicense(leaseDuration uint) int {
cLeaseDuration := (C.uint)(leaseDuration)
status := C.RequestOfflineFloatingLicense(cLeaseDuration)
return int(status)
};
}

/*
FUNCTION: IncrementFloatingClientMeterAttributeUses()
Expand All @@ -373,7 +396,6 @@ func RequestOfflineFloatingLicense(leaseDuration uint) int {
LF_E_INET, LF_E_LICENSE_NOT_FOUND, LF_E_CLIENT, LF_E_IP, LF_E_SERVER, LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED,
LF_E_SERVER_LICENSE_NOT_ACTIVATED, LF_E_SERVER_TIME_MODIFIED, LF_E_SERVER_LICENSE_SUSPENDED,
LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER, LF_E_SERVER_LICENSE_EXPIRED

*/
func IncrementFloatingClientMeterAttributeUses(name string, increment uint) int {
cName := goToCString(name)
Expand Down
13 changes: 13 additions & 0 deletions lexfloatclient/LexFloatClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,19 @@ LEXFLOATCLIENT_API int LF_CC DropFloatingLicense();
*/
LEXFLOATCLIENT_API int LF_CC HasFloatingLicense();

/*
FUNCTION: GetFloatinglicenseMode()

PURPOSE: Gets the mode of the floating license (online or offline).

PARAMETERS:
* modePtr - pointer to a buffer that receives the value of the string
* length - size of the buffer pointed to by the value parameter

RETURN CODES: LF_OK, LF_E_PRODUCT_ID, LF_E_NO_LICENSE, LF_E_BUFFER_SIZE
*/
LEXFLOATCLIENT_API int LF_CC GetFloatingLicenseMode(STRTYPE modePtr, uint32_t length);

/*
FUNCTION: RequestOfflineFloatingLicense()

Expand Down