授权管理使用共享内存支持主从模式

This commit is contained in:
luwenpeng
2023-06-20 21:49:58 +08:00
parent 61233aac97
commit 4c8c7f8759
17 changed files with 430 additions and 138 deletions

View File

@@ -0,0 +1,7 @@
add_executable(hasp_verify_demo ${CMAKE_SOURCE_DIR}/platform/tool/hasp_verify_demo.c)
target_link_libraries(hasp_verify_demo pthread rt hasp-tools)
install(TARGETS hasp_verify_demo RUNTIME DESTINATION bin COMPONENT Program)
add_executable(hasp_monitor ${CMAKE_SOURCE_DIR}/platform/tool/hasp_monitor.c)
target_link_libraries(hasp_monitor pthread rt hasp-tools)
install(TARGETS hasp_monitor RUNTIME DESTINATION bin COMPONENT Program)

View File

@@ -0,0 +1,41 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "hasp_verify.h"
static void usage(char *cmd)
{
fprintf(stderr, "USAGE: %s [OPTIONS]\n", cmd);
fprintf(stderr, " -f -- set feature id\n");
fprintf(stderr, " -i -- set interval second\n");
fprintf(stderr, " -h -- show help\n");
}
int main(int argc, char **argv)
{
int opt;
uint64_t interval_s = 0;
uint64_t feature_id = 100;
while ((opt = getopt(argc, argv, "f:i:h")) != -1)
{
switch (opt)
{
case 'i':
interval_s = atoi(optarg);
break;
case 'f':
feature_id = atoi(optarg);
break;
case 'h': /* fall through */
default:
usage(argv[0]);
return 0;
}
}
hasp_monitor(feature_id, interval_s);
return 0;
}

View File

@@ -0,0 +1,41 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "hasp_verify.h"
static void usage(char *cmd)
{
fprintf(stderr, "USAGE: %s [OPTIONS]\n", cmd);
fprintf(stderr, " -f -- set feature id\n");
fprintf(stderr, " -h -- show help\n");
}
int main(int argc, char **argv)
{
int opt;
uint64_t feature_id = 0;
while ((opt = getopt(argc, argv, "f:h")) != -1)
{
switch (opt)
{
case 'f':
feature_id = atoi(optarg);
break;
case 'h': /* fall through */
default:
usage(argv[0]);
return 0;
}
}
hasp_verify(feature_id);
while (1)
{
sleep(1);
}
return 0;
}