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 4 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
38 changes: 30 additions & 8 deletions lexfloatclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func floatingLicenseCallbackWrapper(status int) {

PARAMETERS:
* productId - the unique product id of your application as mentioned
on the product page in the dashboard.
on the product page in the dashboard.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@muneebkq No need for this change.

RETURN CODES: LF_OK, LF_E_PRODUCT_ID
*/
Expand All @@ -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 @@ -322,6 +326,25 @@ func HasFloatingLicense() int {
return int(status)
}

/*
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
*/

func GetFloatingLicenseMode(modePtr *string) int {
Copy link
Collaborator

@ahmad-kemsan ahmad-kemsan Aug 1, 2024

Choose a reason for hiding this comment

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

@muneebkq Extra line between the docs and function. Also here we do not use the Ptr in the param across the go wrappers. Please check the other similar functions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

var cModePtr = getCArray()
status := C.GetFloatingLicenseMode(&cModePtr[0], maxCArrayLength)
*modePtr = ctoGoString(&cModePtr[0])
return int(status)
}

/*
FUNCTION: IncrementFloatingClientMeterAttributeUses()

Expand All @@ -335,7 +358,6 @@ func HasFloatingLicense() 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: IncrementFloatingClientMeterAttributeUses()

Expand Down