├── .dockerignore ├── .gitignore ├── Dockerfile ├── README.md └── src ├── cpp ├── CMakeLists.txt ├── Makefile ├── base64.cc ├── base64.h ├── cmake │ └── common.cmake ├── dpfj.h ├── fingerprint.grpc.pb.cc ├── fingerprint.grpc.pb.h ├── fingerprint.pb.cc ├── fingerprint.pb.h ├── fingerprint_client.cc ├── fingerprint_server.cc ├── helper.cpp └── helper.h ├── php ├── Fingerprint │ ├── CheckDuplicateResponse.php │ ├── EnrolledFMD.php │ ├── EnrollmentRequest.php │ ├── FingerPrintClient.php │ ├── PreEnrolledFMD.php │ ├── VerificationRequest.php │ └── VerificationResponse.php ├── GPBMetadata │ └── Fingerprint.php ├── composer.json ├── composer.lock └── fingerprint_client.php ├── protos └── fingerprint.proto └── python ├── __pycache__ ├── fingerprint_pb2.cpython-37.pyc └── fingerprint_pb2_grpc.cpython-37.pyc ├── fingerprint_client.py ├── fingerprint_pb2.py ├── fingerprint_pb2_grpc.py └── requirements.txt /.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | .vscode 3 | .gitignore 4 | dist/* 5 | thirdparty 6 | README.md 7 | .gitignore 8 | src/* 9 | !src/cpp 10 | !src/protos 11 | **/build/* -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | .vscode 3 | .idea 4 | .sublime 5 | build 6 | grpcenv 7 | vendor 8 | dist 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Bismillahirrahmanirraheem 2 | # Author: Dahir Muhammad Dahir 3 | # Date: 17th-February-2021 11:11 AM 4 | # About: this Dockerfile uses multi-stage build 5 | # to create a small sized container for the grpc_fingerprint_server 6 | 7 | FROM dahirmuhammaddahir/bexils_grpc:1.0.0 as stage1 8 | 9 | WORKDIR /temp 10 | ENV VERSION="v1.1.0" 11 | # the order of the commands is 12 | RUN apt update && apt install -y wget && \ 13 | wget https://github.com/Bexils/grpc-fingerprint-engine/releases/download/${VERSION}/libdpfj.tar && \ 14 | tar -xvf libdpfj.tar && \ 15 | cp -r opt/* /opt && \ 16 | cp lib/* /lib && \ 17 | rm libdpfj.tar && \ 18 | apt purge -y --auto-remove wget 19 | 20 | WORKDIR /app 21 | COPY src/ ./src 22 | RUN cd src/cpp/build && cmake ../ && make -j 23 | 24 | FROM ubuntu:20.04 25 | 26 | ENV PORT=4134 27 | ENV PATH=$PATH:/app 28 | COPY --from=stage1 /opt /opt 29 | COPY --from=stage1 /temp/lib /lib 30 | 31 | WORKDIR /app 32 | COPY --from=stage1 /app/src/cpp/build/fingerprint_server . 33 | 34 | ENTRYPOINT [ "fingerprint_server" ] 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | grpc-fingerprint-engine 2 | ========================= 3 | 4 | grpc-fingerprint-engine is a Linux gRPC implementation of the DigitalPersona Fingerprint engine, to allow for usage with any programming language (php, python, js, c++ e.t.c). The assumption is that you have setup the fingerprint device on the client side and you are able to obtain FMDs (Fingerprint Minutiae Data) but need a flexible way to work with the data without the programming language limitations of the DigitalPersona SDK, if you haven't setup the device on the client side you can check [here](https://github.com/Ethic41/FingerPrint). 5 | 6 | How to Use 7 | =============== 8 | The project basically provides a server which is just a c++ grpc wrapper to enroll, identify and verify FMDs and also provides sample client side code that communicate with the server in any language. So the idea is you may want to write your code in a language of your choice, say maybe python, or js using the DigitalPersona fingerprint device, but the SDK is limited to C, C++ or Java, the solution is this project, you can generate the client code which receives fingerprint data (FMD) from a user (e.g from the browser), you can then use the generated code to send the FMD data to the server which can perform enrollment, verification or identification. To start using: 9 | 10 | ## 1 - Install DigitalPersona Linux SDK 11 | [Download the SDK](https://github.com/Bexils/grpc-fingerprint-engine/releases) 12 | 13 | You need ```root``` privilege to install the SDK 14 | 15 | ```bash 16 | 17 | # create directory for sdk 18 | mkdir digitalPersona && cd digitalPersona 19 | 20 | # decompress the downloaded tar archive 21 | tar -xvf ../digitalPersona-linux-sdk-2.2.3.tar 22 | 23 | # install the sdk 24 | sudo ./install 25 | 26 | ``` 27 | 28 | ## 2 - Setup the FingerPrint Engine Server 29 | To setup the fingerprint engine server you can either build from source or use our generated binaries (we assume a linux server) 30 | 31 | ## Use Generated Binaries 32 | Simply [Download](https://github.com/Bexils/grpc-fingerprint-engine/releases) and start the server 33 | 34 | ### **OR** 35 | 36 | ## Build from Source 37 | [Setup & Install gRPC globally](https://grpc.io/docs/languages/cpp/quickstart/#setup), then 38 | 39 | ```bash 40 | 41 | # clone this repository 42 | git clone https://github.com/Bexils/grpc-fingerprint-engine 43 | 44 | # move into server directory 45 | cd grpc-fingerprint-engine/src/cpp/ 46 | 47 | # create and move into the server build directory 48 | mkdir build && cd build 49 | 50 | # run cmake 51 | cmake ../ 52 | 53 | # make and build 54 | make -j 55 | 56 | # start the server 57 | ./fingerprint_server 58 | 59 | ``` 60 | 61 | # 62 | 63 | # Setup the Server Clients 64 | This is basically the heart of the project, the ability to generate code in the language of your choosing that can communicate with the Fingerprint Engine Server. You can generate client code from the ***.proto*** file(s) [here]() for any language of your choosing if it's supported by gRPC. 65 | 66 | ## Setting up Python client code (optional) 67 | We assume ***Python 3.7*** other versions should work, but haven't been tested 68 | ```bash 69 | 70 | # if you don't already have pip installed 71 | sudo apt install python3-pip 72 | 73 | # if you don't have venv installed 74 | sudo apt install python3-venv 75 | 76 | # globally install python grpc and grpc-tools 77 | sudo python3 -m pip install -r requirements.txt 78 | 79 | # move into client code directory 80 | cd grpc-fingerprint-engine/src/python 81 | 82 | # create a virtual environment (named grpcenv) 83 | python3 -m venv grpcenv 84 | 85 | # activate the environment 86 | chmod u+x grpcenv/bin/activate 87 | source grpcenv/bin/activate 88 | 89 | # install python grpc tools in the new environment 90 | python -m pip install -r requirements.txt 91 | 92 | # [optional step] regenerate the client code 93 | python -m grpc_tools.protoc -I../protos --python_out=. --grpc_python_out=. ../protos/fingerprint.proto 94 | 95 | # add the url_base64encoded fmds into the fingerprint_client.py file as required 96 | # PS: the fingerprint_server should already be running 97 | # then run the client (enjoy :) 98 | python fingerprint_client.py 99 | 100 | ``` 101 | 102 | ## Setting up PHP Client Code (optional) 103 | We assume PHP 7 or later, previous versions are untested 104 | ```bash 105 | 106 | # setup php and other prerequsites 107 | sudo apt install php7.3 php7.3-dev php-pear phpunit 108 | 109 | # install composer 110 | curl -sS https://getcomposer.org/installer | php 111 | sudo mv composer.phar /usr/local/bin/composer 112 | 113 | # install phpunit 114 | wget -O phpunit https://phar.phpunit.de/phpunit-5.phar 115 | chmod +x phpunit 116 | sudo mv phpunit /usr/bin/phpunit 117 | 118 | # install zlib 119 | sudo apt install libz-dev 120 | 121 | # install grpc 122 | sudo pecl install grpc 123 | 124 | # install protobuf 125 | sudo pecl install protobuf 126 | 127 | # in your php.ini file add the following 128 | # under the extension section 129 | extension=grpc 130 | extension=protobuf 131 | 132 | # regenerate php client code (optional) 133 | cd grpc-fingerprint-engine/src/php 134 | protoc --proto_path=../protos --php_out=. --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_php_plugin` ../protos/fingerprint.proto 135 | 136 | # install packages 137 | composer install 138 | 139 | # add the url_base64encoded fmds into the fingerprint_client.php 140 | # file as required (check the file) 141 | # PS: the fingerprint_server should already be running 142 | # then run the client (enjoy :) 143 | php fingerprint_client.php 144 | 145 | ``` -------------------------------------------------------------------------------- /src/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2018 gRPC authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # cmake build file for C++ route_guide example. 16 | # Assumes protobuf and gRPC have been installed using cmake. 17 | # See cmake_externalproject/CMakeLists.txt for all-in-one cmake build 18 | # that automatically builds all the dependencies before building route_guide. 19 | 20 | cmake_minimum_required(VERSION 3.5.1) 21 | 22 | project(FingerPrint C CXX) 23 | 24 | # include(../cmake/common.cmake) 25 | include("${CMAKE_SOURCE_DIR}/cmake/common.cmake") 26 | 27 | # Proto file 28 | # get_filename_component(fingerprint_proto "../../../protos/fingerprint.proto" ABSOLUTE) 29 | get_filename_component(fingerprint_proto "${CMAKE_SOURCE_DIR}/../protos/fingerprint.proto" ABSOLUTE) 30 | get_filename_component(fingerprint_proto_path "${fingerprint_proto}" PATH) 31 | 32 | # Generated sources 33 | set(fingerprint_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/fingerprint.pb.cc") 34 | set(fingerprint_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/fingerprint.pb.h") 35 | set(fingerprint_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/fingerprint.grpc.pb.cc") 36 | set(fingerprint_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/fingerprint.grpc.pb.h") 37 | 38 | # this custom command generate cpp files from the proto file 39 | add_custom_command( 40 | OUTPUT "${fingerprint_proto_srcs}" "${fingerprint_proto_hdrs}" "${fingerprint_grpc_srcs}" "${fingerprint_grpc_hdrs}" 41 | COMMAND ${_PROTOBUF_PROTOC} 42 | ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" 43 | --cpp_out "${CMAKE_CURRENT_BINARY_DIR}" 44 | -I "${fingerprint_proto_path}" 45 | --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" 46 | "${fingerprint_proto}" 47 | DEPENDS "${fingerprint_proto}") 48 | 49 | # Include generated *.pb.h files 50 | include_directories("${CMAKE_CURRENT_BINARY_DIR}") 51 | # Include *.h files 52 | include_directories("${CMAKE_SOURCE_DIR}") 53 | 54 | set(my_base_64_src "${CMAKE_SOURCE_DIR}/base64.h") 55 | set(my_base64_hdr "${CMAKE_SOURCE_DIR}/base64.cc") 56 | 57 | # fingerprint_grpc_proto 58 | add_library(fingerprint_grpc_proto 59 | ${fingerprint_grpc_srcs} 60 | ${fingerprint_grpc_hdrs} 61 | ${fingerprint_proto_srcs} 62 | ${fingerprint_proto_hdrs}) 63 | 64 | target_link_libraries(fingerprint_grpc_proto 65 | ${_REFLECTION} 66 | ${_GRPC_GRPCPP} 67 | ${_PROTOBUF_LIBPROTOBUF}) 68 | 69 | # fingerprint engine include 70 | add_library(dp_fingerprint_engine STATIC IMPORTED) 71 | set_property(TARGET dp_fingerprint_engine PROPERTY IMPORTED_LOCATION "/lib/libdpfj.so") 72 | 73 | # base64 include 74 | add_library(my_base64 ${my_base_64_src} ${my_base64_hdr}) 75 | 76 | # Targets fingerprint_(client|server) 77 | foreach(_target fingerprint_server) 78 | add_executable(${_target} 79 | "${_target}.cc") 80 | target_link_libraries(${_target} 81 | fingerprint_grpc_proto 82 | dp_fingerprint_engine 83 | my_base64 84 | ${_REFLECTION} 85 | ${_GRPC_GRPCPP} 86 | ${_PROTOBUF_LIBPROTOBUF}) 87 | endforeach() 88 | -------------------------------------------------------------------------------- /src/cpp/Makefile: -------------------------------------------------------------------------------- 1 | 2 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) 3 | SYSTEM ?= $(HOST_SYSTEM) 4 | CXX = g++ 5 | CPPFLAGS += `pkg-config --cflags protobuf grpc` 6 | CXXFLAGS += -std=c++11 7 | ifeq ($(SYSTEM),Darwin) 8 | LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++`\ 9 | -pthread\ 10 | -lgrpc++_reflection\ 11 | -ldl -ldpfj 12 | else 13 | LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++`\ 14 | -pthread\ 15 | -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\ 16 | -ldl -ldpfj 17 | endif 18 | PROTOC = protoc 19 | GRPC_CPP_PLUGIN = grpc_cpp_plugin 20 | GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)` 21 | 22 | PROTOS_PATH = ../protos 23 | 24 | vpath %.proto $(PROTOS_PATH) 25 | 26 | all: system-check fingerprint_client fingerprint_server 27 | 28 | fingerprint_client: fingerprint.pb.o fingerprint.grpc.pb.o fingerprint_client.o base64.o 29 | $(CXX) $^ $(LDFLAGS) -o $@ 30 | 31 | fingerprint_server: fingerprint.pb.o fingerprint.grpc.pb.o fingerprint_server.o base64.o 32 | $(CXX) $^ $(LDFLAGS) -o $@ 33 | 34 | %.grpc.pb.cc: %.proto 35 | $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $< 36 | 37 | %.pb.cc: %.proto 38 | $(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $< 39 | 40 | clean: 41 | rm -f *.o *.pb.cc *.pb.h 42 | 43 | 44 | # The following is to test your system and ensure a smoother experience. 45 | # They are by no means necessary to actually compile a grpc-enabled software. 46 | 47 | PROTOC_CMD = which $(PROTOC) 48 | PROTOC_CHECK_CMD = $(PROTOC) --version | grep -q libprotoc.3 49 | PLUGIN_CHECK_CMD = which $(GRPC_CPP_PLUGIN) 50 | HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false) 51 | ifeq ($(HAS_PROTOC),true) 52 | HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false) 53 | endif 54 | HAS_PLUGIN = $(shell $(PLUGIN_CHECK_CMD) > /dev/null && echo true || echo false) 55 | 56 | SYSTEM_OK = false 57 | ifeq ($(HAS_VALID_PROTOC),true) 58 | ifeq ($(HAS_PLUGIN),true) 59 | SYSTEM_OK = true 60 | endif 61 | endif 62 | 63 | system-check: 64 | ifneq ($(HAS_VALID_PROTOC),true) 65 | @echo " DEPENDENCY ERROR" 66 | @echo 67 | @echo "You don't have protoc 3.0.0 installed in your path." 68 | @echo "Please install Google protocol buffers 3.0.0 and its compiler." 69 | @echo "You can find it here:" 70 | @echo 71 | @echo " https://github.com/google/protobuf/releases/tag/v3.0.0" 72 | @echo 73 | @echo "Here is what I get when trying to evaluate your version of protoc:" 74 | @echo 75 | -$(PROTOC) --version 76 | @echo 77 | @echo 78 | endif 79 | ifneq ($(HAS_PLUGIN),true) 80 | @echo " DEPENDENCY ERROR" 81 | @echo 82 | @echo "You don't have the grpc c++ protobuf plugin installed in your path." 83 | @echo "Please install grpc. You can find it here:" 84 | @echo 85 | @echo " https://github.com/grpc/grpc" 86 | @echo 87 | @echo "Here is what I get when trying to detect if you have the plugin:" 88 | @echo 89 | -which $(GRPC_CPP_PLUGIN) 90 | @echo 91 | @echo 92 | endif 93 | ifneq ($(SYSTEM_OK),true) 94 | @false 95 | endif 96 | -------------------------------------------------------------------------------- /src/cpp/base64.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* 5 | Base64 translates 24 bits into 4 ASCII characters at a time. First, 6 | 3 8-bit bytes are treated as 4 6-bit groups. Those 4 groups are 7 | translated into ASCII characters. That is, each 6-bit number is treated 8 | as an index into the ASCII character array. 9 | 10 | If the final set of bits is less 8 or 16 instead of 24, traditional base64 11 | would add a padding character. However, if the length of the data is 12 | known, then padding can be eliminated. 13 | 14 | One difference between the "standard" Base64 is two characters are different. 15 | See RFC 4648 for details. 16 | This is how we end up with the Base64 URL encoding. 17 | */ 18 | 19 | const char base64_url_alphabet[] = { 20 | 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 21 | 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 22 | 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 23 | 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 24 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_' 25 | }; 26 | 27 | std::string base64_encode(const std::string & in) { 28 | std::string out; 29 | int val =0, valb=-6; 30 | size_t len = in.length(); 31 | unsigned int i = 0; 32 | for (i = 0; i < len; i++) { 33 | unsigned char c = in[i]; 34 | val = (val<<8) + c; 35 | valb += 8; 36 | while (valb >= 0) { 37 | out.push_back(base64_url_alphabet[(val>>valb)&0x3F]); 38 | valb -= 6; 39 | } 40 | } 41 | if (valb > -6) { 42 | out.push_back(base64_url_alphabet[((val<<8)>>(valb+8))&0x3F]); 43 | } 44 | return out; 45 | } 46 | 47 | std::string base64_decode(const std::string & in) { 48 | std::string out; 49 | std::vector T(256, -1); 50 | unsigned int i; 51 | for (i =0; i < 64; i++) T[base64_url_alphabet[i]] = i; 52 | 53 | int val = 0, valb = -8; 54 | for (i = 0; i < in.length(); i++) { 55 | unsigned char c = in[i]; 56 | if (T[c] == -1) break; 57 | val = (val<<6) + T[c]; 58 | valb += 6; 59 | if (valb >= 0) { 60 | out.push_back(char((val>>valb)&0xFF)); 61 | valb -= 8; 62 | } 63 | } 64 | return out; 65 | } 66 | -------------------------------------------------------------------------------- /src/cpp/base64.h: -------------------------------------------------------------------------------- 1 | /** 2 | * -=-<[ Bismillahirrahmanirrahim ]>-=- 3 | * Date : 2021-01-23 12:24:41 4 | * Author : Dahir Muhammad Dahir (dahirmuhammad3@gmail.com) 5 | * About : Compile with g++ 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | std::string base64_encode(const std::string & in); 12 | 13 | std::string base64_decode(const std::string & in); 14 | 15 | -------------------------------------------------------------------------------- /src/cpp/cmake/common.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2018 gRPC authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # cmake build file for C++ route_guide example. 16 | # Assumes protobuf and gRPC have been installed using cmake. 17 | # See cmake_externalproject/CMakeLists.txt for all-in-one cmake build 18 | # that automatically builds all the dependencies before building route_guide. 19 | 20 | cmake_minimum_required(VERSION 3.5.1) 21 | 22 | set (CMAKE_CXX_STANDARD 11) 23 | 24 | if(MSVC) 25 | add_definitions(-D_WIN32_WINNT=0x600) 26 | endif() 27 | 28 | # find the threads package which is required to continue 29 | find_package(Threads REQUIRED) 30 | 31 | if(GRPC_AS_SUBMODULE) 32 | # One way to build a projects that uses gRPC is to just include the 33 | # entire gRPC project tree via "add_subdirectory". 34 | # This approach is very simple to use, but the are some potential 35 | # disadvantages: 36 | # * it includes gRPC's CMakeLists.txt directly into your build script 37 | # without and that can make gRPC's internal setting interfere with your 38 | # own build. 39 | # * depending on what's installed on your system, the contents of submodules 40 | # in gRPC's third_party/* might need to be available (and there might be 41 | # additional prerequisites required to build them). Consider using 42 | # the gRPC_*_PROVIDER options to fine-tune the expected behavior. 43 | # 44 | # A more robust approach to add dependency on gRPC is using 45 | # cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt). 46 | 47 | # Include the gRPC's cmake build (normally grpc source code would live 48 | # in a git submodule called "third_party/grpc", but this example lives in 49 | # the same repository as gRPC sources, so we just look a few directories up) 50 | add_subdirectory(../../.. ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL) 51 | message(STATUS "Using gRPC via add_subdirectory.") 52 | 53 | # After using add_subdirectory, we can now use the grpc targets directly from 54 | # this build. 55 | set(_PROTOBUF_LIBPROTOBUF libprotobuf) 56 | set(_REFLECTION grpc++_reflection) 57 | if(CMAKE_CROSSCOMPILING) 58 | find_program(_PROTOBUF_PROTOC protoc) 59 | else() 60 | set(_PROTOBUF_PROTOC $) 61 | endif() 62 | set(_GRPC_GRPCPP grpc++) 63 | if(CMAKE_CROSSCOMPILING) 64 | find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) 65 | else() 66 | set(_GRPC_CPP_PLUGIN_EXECUTABLE $) 67 | endif() 68 | elseif(GRPC_FETCHCONTENT) 69 | # Another way is to use CMake's FetchContent module to clone gRPC at 70 | # configure time. This makes gRPC's source code available to your project, 71 | # similar to a git submodule. 72 | message(STATUS "Using gRPC via add_subdirectory (FetchContent).") 73 | include(FetchContent) 74 | FetchContent_Declare( 75 | grpc 76 | GIT_REPOSITORY https://github.com/grpc/grpc.git 77 | # when using gRPC, you will actually set this to an existing tag, such as 78 | # v1.25.0, v1.26.0 etc.. 79 | # For the purpose of testing, we override the tag used to the commit 80 | # that's currently under test. 81 | GIT_TAG vGRPC_TAG_VERSION_OF_YOUR_CHOICE) 82 | FetchContent_MakeAvailable(grpc) 83 | 84 | # Since FetchContent uses add_subdirectory under the hood, we can use 85 | # the grpc targets directly from this build. 86 | set(_PROTOBUF_LIBPROTOBUF libprotobuf) 87 | set(_REFLECTION grpc++_reflection) 88 | set(_PROTOBUF_PROTOC $) 89 | set(_GRPC_GRPCPP grpc++) 90 | if(CMAKE_CROSSCOMPILING) 91 | find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) 92 | else() 93 | set(_GRPC_CPP_PLUGIN_EXECUTABLE $) 94 | endif() 95 | else() 96 | # This branch assumes that gRPC and all its dependencies are already installed 97 | # on this system, so they can be located by find_package(). 98 | 99 | # Find Protobuf installation 100 | # Looks for protobuf-config.cmake file installed by Protobuf's cmake installation. 101 | set(protobuf_MODULE_COMPATIBLE TRUE) 102 | find_package(Protobuf CONFIG REQUIRED) 103 | message(STATUS "Using protobuf ${Protobuf_VERSION}") 104 | 105 | set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) 106 | set(_REFLECTION gRPC::grpc++_reflection) 107 | if(CMAKE_CROSSCOMPILING) 108 | find_program(_PROTOBUF_PROTOC protoc) 109 | else() 110 | set(_PROTOBUF_PROTOC $) 111 | endif() 112 | 113 | # Find gRPC installation 114 | # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. 115 | find_package(gRPC CONFIG REQUIRED) 116 | message(STATUS "Using gRPC ${gRPC_VERSION}") 117 | 118 | set(_GRPC_GRPCPP gRPC::grpc++) 119 | if(CMAKE_CROSSCOMPILING) 120 | find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) 121 | else() 122 | set(_GRPC_CPP_PLUGIN_EXECUTABLE $) 123 | endif() 124 | endif() 125 | -------------------------------------------------------------------------------- /src/cpp/dpfj.h: -------------------------------------------------------------------------------- 1 | /** 2 | \file dpfj.h 3 | 4 | \copyright (c) 2011 DigitalPersona, Inc 5 | 6 | \brief U.are.U SDK FingerJet Engine API 7 | 8 | Data types and functions for feature extraction, matching and conversion. 9 | 10 | \version 2.0.0 11 | */ 12 | 13 | #ifndef __DPFJ_H__ 14 | #define __DPFJ_H__ 15 | 16 | 17 | /** \cond NEVER */ 18 | #ifndef DPAPICALL 19 | # if defined(_WIN32) || defined(_WIN64) 20 | # ifdef WINCE 21 | # define DPAPICALL __cdecl 22 | # else 23 | # define DPAPICALL __stdcall 24 | # endif 25 | # else 26 | # define DPAPICALL 27 | # endif 28 | #endif 29 | 30 | #ifndef NULL 31 | # ifdef __cplusplus 32 | # define NULL 0 33 | # else 34 | # define NULL ((void *)0) 35 | # endif 36 | #endif 37 | 38 | #ifndef DPERROR 39 | # define _DP_FACILITY 0x05BA 40 | # define DPERROR(err) ((int)err | (_DP_FACILITY << 16)) 41 | #endif /* DPERROR */ 42 | 43 | #define DPFJ_API_VERSION_MAJOR 1 44 | #define DPFJ_API_VERSION_MINOR 0 45 | /** \endcond */ 46 | 47 | 48 | /**************************************************************************************************** 49 | Error codes 50 | ****************************************************************************************************/ 51 | 52 | /** 53 | \brief API call succeeded. 54 | */ 55 | #define DPFJ_SUCCESS 0 56 | 57 | /** 58 | \brief API call is not implemented. 59 | */ 60 | #define DPFJ_E_NOT_IMPLEMENTED DPERROR(0x0a) 61 | 62 | /** 63 | \brief Unspecified failure. 64 | 65 | "Catch-all" generic failure code. Can be returned by all API calls in case of failure, when the reason for the failure is unknown or cannot be specified. 66 | */ 67 | #define DPFJ_E_FAILURE DPERROR(0x0b) 68 | 69 | /** 70 | \brief No data is available. 71 | */ 72 | #define DPFJ_E_NO_DATA DPERROR(0x0c) 73 | 74 | /** 75 | \brief Memory allocated by application is not enough to contain data which is expected. 76 | */ 77 | #define DPFJ_E_MORE_DATA DPERROR(0x0d) 78 | 79 | /** 80 | \brief One or more parameters passed to the API call are invalid. 81 | */ 82 | #define DPFJ_E_INVALID_PARAMETER DPERROR(0x14) 83 | 84 | /** 85 | \brief FID is invalid. 86 | */ 87 | #define DPFJ_E_INVALID_FID DPERROR(0x65) 88 | 89 | /** 90 | \brief Image is too small. 91 | */ 92 | #define DPFJ_E_TOO_SMALL_AREA DPERROR(0x66) 93 | 94 | /** 95 | \brief FMD is invalid. 96 | */ 97 | #define DPFJ_E_INVALID_FMD DPERROR(0xc9) 98 | 99 | /** 100 | \brief Enrollment operation is in progress. 101 | */ 102 | #define DPFJ_E_ENROLLMENT_IN_PROGRESS DPERROR(0x12d) 103 | 104 | /** 105 | \brief Enrollment operation has not begun. 106 | */ 107 | #define DPFJ_E_ENROLLMENT_NOT_STARTED DPERROR(0x12e) 108 | 109 | /** 110 | \brief Not enough in the pool of FMDs to create enrollment FMD. 111 | */ 112 | #define DPFJ_E_ENROLLMENT_NOT_READY DPERROR(0x12f) 113 | 114 | /** 115 | \brief Unable to create enrollment FMD with the collected set of FMDs. 116 | */ 117 | #define DPFJ_E_ENROLLMENT_INVALID_SET DPERROR(0x130) 118 | 119 | /**************************************************************************************************** 120 | Data types and definitions 121 | ****************************************************************************************************/ 122 | 123 | /** 124 | \brief Normalized value when probability = 1. 125 | */ 126 | #define DPFJ_PROBABILITY_ONE 0x7fffffff 127 | 128 | /** 129 | \brief Fingerprint Image Data (FID) Format. 130 | */ 131 | typedef int DPFJ_FID_FORMAT; 132 | 133 | #define DPFJ_FID_ANSI_381_2004 0x001B0401 /**< ANSI INSITS 381-2004 format */ 134 | #define DPFJ_FID_ISO_19794_4_2005 0x01010007 /**< ISO IEC 19794-4-2005 format */ 135 | 136 | /** 137 | \brief Fingerptint Minutiae Data (FMD) Format. 138 | */ 139 | typedef int DPFJ_FMD_FORMAT; 140 | 141 | #define DPFJ_FMD_ANSI_378_2004 0x001B0001 /**< ANSI INSITS 378-2004 Fingerprint Minutiae Data format */ 142 | #define DPFJ_FMD_ISO_19794_2_2005 0x01010001 /**< ISO IEC 19794-2-2005 Fingerprint Minutiae Data format */ 143 | #define DPFJ_FMD_DP_PRE_REG_FEATURES 0 /**< deprecated DigitalPersona pre-registration feature set format */ 144 | #define DPFJ_FMD_DP_REG_FEATURES 1 /**< deprecated DigitalPersona registration template format */ 145 | #define DPFJ_FMD_DP_VER_FEATURES 2 /**< deprecated DigitalPersona verification feature set format */ 146 | 147 | /** \brief Defines finger position. 148 | 149 | Finger position according to ANSI 378-2004 and ISO 19794-2-2005 standards. 150 | */ 151 | typedef int DPFJ_FINGER_POSITION; 152 | 153 | #define DPFJ_POSITION_UNKNOWN 0 /**< position unknown */ 154 | #define DPFJ_POSITION_RTHUMB 1 /**< right thumb */ 155 | #define DPFJ_POSITION_RINDEX 2 /**< right index finger */ 156 | #define DPFJ_POSITION_RMIDDLE 3 /**< right middle finger */ 157 | #define DPFJ_POSITION_RRING 4 /**< right ring finger */ 158 | #define DPFJ_POSITION_RLITTLE 5 /**< right little finger */ 159 | #define DPFJ_POSITION_LTHUMB 6 /**< left thumb */ 160 | #define DPFJ_POSITION_LINDEX 7 /**< left index finger */ 161 | #define DPFJ_POSITION_LMIDDLE 8 /**< left middle finger */ 162 | #define DPFJ_POSITION_LRING 9 /**< left ring finger */ 163 | #define DPFJ_POSITION_LLITTLE 10 /**< left little finger */ 164 | 165 | /** 166 | \brief Defines impression type. 167 | 168 | Impression type according to ANSI 378-2004 and ISO 19794-2-2005 standards 169 | */ 170 | typedef int DPFJ_SCAN_TYPE; 171 | 172 | #define DPFJ_SCAN_LIVE_PLAIN 0 173 | #define DPFJ_SCAN_LIVE_ROLLED 1 174 | #define DPFJ_SCAN_NONLIVE_PLAIN 2 175 | #define DPFJ_SCAN_NONLIVE_ROLLED 3 176 | #define DPFJ_SCAN_SWIPE 8 177 | 178 | /** 179 | \brief Defines matching engine to use. 180 | */ 181 | typedef int DPFJ_ENGINE_TYPE; 182 | 183 | #define DPFJ_ENGINE_DPFJ 0 /**< DigitalPersona FingerJet matching engine */ 184 | #define DPFJ_ENGINE_INNOVATRICS_ANSIISO 1 /**< Innovatrics ANSI ISO Generator and Matcher */ 185 | 186 | /** 187 | \brief Reader handle. 188 | 189 | Reader handle acquired by calling dpfpdd_open(). 190 | */ 191 | typedef void* DPFJ_DEV; 192 | 193 | 194 | /** \cond NEVER */ 195 | #define DPFJ_FID_ANSI_381_2004_RECORD_HEADER_LENGTH 36 196 | #define DPFJ_FID_ISO_19794_4_2005_RECORD_HEADER_LENGTH 32 197 | #define DPFJ_FID_ANSI_ISO_VIEW_HEADER_LENGTH 14 198 | 199 | #define DPFJ_FMD_ANSI_378_2004_RECORD_HEADER_LENGTH 26 200 | #define DPFJ_FMD_ISO_19794_2_2005_RECORD_HEADER_LENGTH 24 201 | #define DPFJ_FMD_ANSI_ISO_VIEW_HEADER_LENGTH 4 202 | #define DPFJ_FMD_ANSI_ISO_MINITIA_LENGTH 6 203 | /** \endcond */ 204 | 205 | /** 206 | \brief Maximum size of a single-view FMD with no extended data block. 207 | */ 208 | #define MAX_FMD_SIZE (DPFJ_FMD_ANSI_378_2004_RECORD_HEADER_LENGTH + DPFJ_FMD_ANSI_ISO_VIEW_HEADER_LENGTH + 255 * DPFJ_FMD_ANSI_ISO_MINITIA_LENGTH + 2) 209 | 210 | /** 211 | \brief API Version information. 212 | */ 213 | typedef struct dpfj_ver_info { 214 | int major; /**< major version number */ 215 | int minor; /**< minor version number */ 216 | int maintenance; /**< maintenance or revision number */ 217 | } DPFJ_VER_INFO; 218 | 219 | /** 220 | \brief Complete information about library/SDK. 221 | */ 222 | typedef struct dpfj_version { 223 | unsigned int size; /**< Size of the structure, in bytes */ 224 | DPFJ_VER_INFO lib_ver; /**< file version of the library/SDK */ 225 | DPFJ_VER_INFO api_ver; /**< version of the API */ 226 | } DPFJ_VERSION; 227 | 228 | /** 229 | \brief Candidate, result of identification. 230 | */ 231 | typedef struct dpfj_candidate{ 232 | unsigned int size; /**< size of the structure, in bytes */ 233 | unsigned int fmd_idx; /**< index of the FMD in the input array */ 234 | unsigned int view_idx; /**< index of the view in the FMD */ 235 | } DPFJ_CANDIDATE; 236 | 237 | 238 | /**************************************************************************************************** 239 | API calls 240 | ****************************************************************************************************/ 241 | 242 | #ifdef __cplusplus 243 | extern "C" { 244 | #endif /* __cplusplus */ 245 | 246 | /** 247 | \brief Query the library and API version information. 248 | 249 | \param ver [in] Pointer to the empty structure (per DPFJ_VERSION); [out] Pointer to structure containing version information 250 | \return DPFJ_SUCCESS: Version information was acquired; 251 | \return DPFJ_E_FAILURE: Failed to acquire version information. 252 | */ 253 | int DPAPICALL dpfj_version( 254 | DPFJ_VERSION* ver 255 | ); 256 | 257 | /** 258 | \brief Select matching engine. 259 | 260 | DigitalPersona FingerJet is default engine used if this function is not called. FingerJet is available on all platforms and does not require 261 | open reader (parameter hdev can be NULL). Not every other engine is available on every platform. Some engines require valid handle from 262 | opened reader to be supplied. 263 | 264 | \param hdev [in] Reader handle. 265 | \param engine [in] Matching engine to use. 266 | \return DPFJ_SUCCESS: Engine is selected; 267 | \return DPFJ_E_NOT_IMPLEMENTED: Requested engine is not supported of this platform. 268 | */ 269 | int DPAPICALL dpfj_select_engine( 270 | DPFJ_DEV hdev, 271 | DPFJ_ENGINE_TYPE engine 272 | ); 273 | 274 | 275 | /** 276 | \brief Extracts features and creates an FMD from a raw image. 277 | 278 | When you do a fingerprint capture, you can receive a raw image or a FID. If you specify a raw image, you can then extract features into an FMD using this function. 279 | The raw image is just a buffer of pixels. This function works with raw images that have 280 | - 8 bits per pixel 281 | - no padding 282 | - square pixels (dpi is the same for horizontal and vertical) 283 | 284 | The size of the resulting FMD will vary depending on the minutiae in a specific fingerprint. The maximum possible size of a single-view FMD is MAX_FMD_SIZE. 285 | If the value pointed to by fmd_size is zero, the function will return with the error code DPFJ_E_MORE_DATA and the required size will be stored in the 286 | value pointed to by fmd_size. In order to determine the size, this function processes the image, extracts features and discards the FMD, so it takes significant 287 | processing time. However if memory shortages are a key issue, this allows you to allocate memory more efficiently at the expense of processing time. 288 | If memory is available, you will get the best performance if you always allocate MAX_FMD_SIZE for the FMD. 289 | The value pointed to by fmd_size will always be returned as the actual size of the FMD that was extracted. 290 | 291 | \param image_data pointer to the image data 292 | \param image_size size of the image data 293 | \param image_width width of the image 294 | \param image_height height of the image 295 | \param image_dpi resolution of the image 296 | \param finger_pos position of the finger 297 | \param cbeff_id CBEFF product ID, from IBIA registry 298 | \param fmd_type type of the FMD 299 | \param fmd pointer to recieve FMD 300 | \param fmd_size pointer to allocated size for the FMD, pointer to receive the actual size of the FMD 301 | \return DPFJ_SUCCESS: FMD was created; 302 | \return DPFJ_E_MORE_DATA: Features extracted, but allocated memory is not sufficient for FMD. The required memory size is in the fmd_size. 303 | \return DPFJ_E_INVALID_PARAMETER: One or more parameters passed are invalid. 304 | \return DPFJ_E_FAILURE: Failed to create FMD. 305 | */ 306 | int DPAPICALL dpfj_create_fmd_from_raw ( 307 | const unsigned char* image_data, 308 | unsigned int image_size, 309 | unsigned int image_width, 310 | unsigned int image_height, 311 | unsigned int image_dpi, 312 | DPFJ_FINGER_POSITION finger_pos, 313 | unsigned int cbeff_id, 314 | DPFJ_FMD_FORMAT fmd_type, 315 | unsigned char* fmd, 316 | unsigned int* fmd_size 317 | ); 318 | 319 | /** 320 | \brief Extracts features and creates an FMD from an ANSI or ISO image. 321 | 322 | This function works with FIDs that have 323 | - 8 bits per pixel 324 | - no padding 325 | - square pixels (dpi is the same for horizontal and vertical) 326 | The size of the resulting FMD will vary depending on the minutiae in a specific fingerprint. The maximum possible size of a single-view FMD is MAX_FMD_SIZE. 327 | If the value pointed to by fmd_size is zero, the function will return with the error code DPFJ_E_MORE_DATA and the required size will be stored in the value 328 | pointed to by fmd_size. In order to determine the size, this function processes the image, extracts the FMD and discards the FMD, so it takes significant processing time. 329 | However if memory shortages are a key issue, this allows you to allocate memory more efficiently at the expense of processing time. 330 | If memory is available, you will get the best performance if you always allocate MAX_FMD_SIZE for the FMD. 331 | The value pointed to by fmd_size will always be returned as the actual size of the FMD that was extracted. 332 | 333 | \param fid_type type of the FID 334 | \param fid pointer to the FID data 335 | \param fid_size size of the FID data 336 | \param fmd_type type of the FMD 337 | \param fmd pointer to recieve FMD data 338 | \param fmd_size pointer to allocated size for the FMD, pointer to receive the actual size of the FMD 339 | \return DPFJ_SUCCESS: FMD was created; 340 | \return DPFJ_E_MORE_DATA: Features extracted, but allocated memory is not sufficient for FMD. The required memory size is in the fmd_size. 341 | \return DPFJ_E_INVALID_PARAMETER: One or more parameters passed are invalid. 342 | \return DPFJ_E_FAILURE: Failed to create FMD. 343 | */ 344 | int DPAPICALL dpfj_create_fmd_from_fid ( 345 | DPFJ_FID_FORMAT fid_type, 346 | const unsigned char* fid, 347 | unsigned int fid_size, 348 | DPFJ_FMD_FORMAT fmd_type, 349 | unsigned char* fmd, 350 | unsigned int* fmd_size 351 | ); 352 | 353 | /** 354 | \brief Compares two fingerprints. 355 | 356 | Given two single views from two FMDs, this function returns a dissimilarity score indicating the quality of the match. 357 | The dissimilarity scores returned values are between: 358 | 0=match 359 | maxint=no match 360 | Values close to 0 indicate very close matches, values closer to maxint indicate very poor matches. 361 | For a discussion of how to evaluate dissimilarity scores, as well as the statistical validity of the dissimilarity score and error rates, consult the Developer Guide. 362 | The dpfj_compare function returns DPFJ_SUCCESS if it is able to compare the fingerprints successfully (i.e., the FMDs are valid and correctly formed). 363 | However that does not mean that the fingerprints matched. To check whether they matched, you must look at the dissimilarity score. 364 | 365 | \param fmd1_type type of the first FMD 366 | \param fmd1 pointer to the first FMD 367 | \param fmd1_size size of the first FMD 368 | \param fmd1_view_idx index of the view 369 | \param fmd2_type type of the second FMD 370 | \param fmd2 pointer to the second FMD 371 | \param fmd2_size size of the second FMD 372 | \param fmd2_view_idx index of the view 373 | \param score pointer to receive dissimilarity score 374 | \return DPFJ_SUCCESS: Comparison finished; 375 | \return DPFJ_E_FAILURE: Unknown error. 376 | */ 377 | int DPAPICALL dpfj_compare( 378 | DPFJ_FMD_FORMAT fmd1_type, 379 | unsigned char* fmd1, 380 | unsigned int fmd1_size, 381 | unsigned int fmd1_view_idx, 382 | DPFJ_FMD_FORMAT fmd2_type, 383 | unsigned char* fmd2, 384 | unsigned int fmd2_size, 385 | unsigned int fmd2_view_idx, 386 | unsigned int* score 387 | ); 388 | 389 | /** 390 | \brief Compares a single fingerprint to an array of fingerprints. 391 | 392 | This function takes as inputs: 393 | - a single view in an FMD 394 | - an array of FMDs (each FMD can contain up to 16 views) to compare 395 | - the desired number of candidates to return 396 | - the threshold for False Positive Identification Rate that is permitted 397 | This function compares a single view against an array of FMDs. Each time view has a score lower than the threshold, that view is marked as a possible candidate. 398 | Then when all possible candidates are identified (i.e., they meet the threshold), they are ranked by their score. Finally, the function returns as many 399 | candidates as requested, based on the candidates with the lowest dissimilarity score. 400 | For a discussion of setting the threshold as well as the statistical validity of the dissimilarity score and error rates, consult the Developer Guide. 401 | 402 | \param fmd1_type type of the FMDs 403 | \param fmd1 pointer to the first FMD data 404 | \param fmd1_size size of the first FMD data 405 | \param fmd1_view_idx index of the view 406 | \param fmds_type type of the FMDs in the fmds array 407 | \param fmds_cnt number of FMDs in the fmds array 408 | \param fmds array of FMDs 409 | \param fmds_size array of sizes of the FMDs data 410 | \param threshold_score target threshold on degree of dissimilarity 411 | \param candidate_cnt [in] number of allocated entries in the candidates array; [out] receives the actual number of candidates filled in the array as a result of identification 412 | \param candidates array of candidates 413 | \return DPFJ_SUCESS: Identification finished; 414 | \return DPFJ_E_FAILURE: Unknown error. 415 | */ 416 | int DPAPICALL dpfj_identify( 417 | DPFJ_FMD_FORMAT fmd1_type, 418 | unsigned char* fmd1, 419 | unsigned int fmd1_size, 420 | unsigned int fmd1_view_idx, 421 | DPFJ_FMD_FORMAT fmds_type, 422 | unsigned int fmds_cnt, 423 | unsigned char** fmds, 424 | unsigned int* fmds_size, 425 | unsigned int threshold_score, 426 | unsigned int* candidate_cnt, 427 | DPFJ_CANDIDATE* candidates 428 | ); 429 | 430 | /** 431 | \brief Starts enrollment operation. 432 | 433 | \param fmd_type type of FMD to produce as a result of enrollment operation 434 | \return DPFJ_SUCCESS: Enrollment started. 435 | \return DPFJ_E_INVALID_PARAMETER: Requested FMD type is invalid. 436 | \return DPFJ_E_ENROLLMENT_IN_PROGRESS: Another enrollment operation is in prgress. 437 | \return DPFJ_E_FAILURE: Unknown error. 438 | */ 439 | int DPAPICALL dpfj_start_enrollment( 440 | DPFJ_FMD_FORMAT fmd_type 441 | ); 442 | 443 | /** 444 | \brief Adds FMD to enrollment operation. 445 | 446 | Add an FMD to the pool of FMDs for enrollment and return a flag indicating when the enrollment is ready. 447 | This function must be called before dpfj_create_enrollment_fmd. 448 | 449 | \param fmd_type type of the FMD. 450 | \param fmd pointer to the FMD data. 451 | \param fmd_size size of the FMD data. 452 | \param fmd_view_idx index of the view 453 | \return DPFJ_SUCCESS: FMD added, enrollment is ready. 454 | \return DPFJ_E_MORE_DATA: FMD added, more FMDs for enrollment required. 455 | \return DPFJ_E_INVALID_PARAMETER: One or more parameters passed are invalid. 456 | \return DPFJ_E_ENROLLMENT_NOT_STARTED: Enrollment is not started. 457 | \return DPFJ_E_FAILURE: Unknown error. 458 | */ 459 | int DPAPICALL dpfj_add_to_enrollment( 460 | DPFJ_FMD_FORMAT fmd_type, 461 | unsigned char* fmd, 462 | unsigned int fmd_size, 463 | unsigned int fmd_view_idx 464 | ); 465 | 466 | /** 467 | \brief Creates and returns enrollment FMD. 468 | 469 | Create an FMD for an enrolled finger. The output FMD is suitable for storing in a database of enrolled users. 470 | Some applications like voting, banking and law enforcement require that you check for duplicate fingerprints before storing a new fingerprint in the database. 471 | For ANSI/ISO formats, the enrollment FMD is a standard FMD (the same as an FMD generated by the extraction function). For the DigitalPersona data format, 472 | the enrollment FMD uses the "fingerprint template" format as used by legacy DigitalPersona applications. 473 | This function must be called after dpfj_add_to_enrollment. 474 | The size of the resulting FMD will vary depending on the minutiae in the fingerprint(s) that were enrolled. The maximum possible size of an FMD is MAX_FMD_SIZE. 475 | If the value pointed to by fmd_size is zero, the function will return with the error code DPFJ_E_MORE_DATA and the required size will be stored in the value pointed to by fmd_size. 476 | In order to determine the size, this function processes the image, extracts features and discards the FMD, so it takes significant processing time. 477 | However if memory shortages are a key issue, this allows you to allocate memory more efficiently at the expense of processing time. 478 | If memory is available, you will get the best performance if you always allocate MAX_FMD_SIZE for the FMD. 479 | The value pointed to by fmd_size will always be returned as the actual size of the FMD that was extracted. 480 | 481 | \param fmd pointer to recieve FMD data 482 | \param fmd_size pointer to allocated size for the FMD data, pointer to receive the actual size of the FMD data 483 | \return DPFJ_SUCCESS: FMD created. 484 | \return DPFJ_E_MORE_DATA: FMD created, but allocated memory is not sufficient. The required memory size is in the fmd_size. 485 | \return DPFJ_E_INVALID_PARAMETER: One or more parameters passed are invalid. 486 | \return DPFJ_E_ENROLLMENT_NOT_STARTED: Enrollment is not started. 487 | \return DPFJ_E_FAILURE: Unknown error. 488 | */ 489 | int DPAPICALL dpfj_create_enrollment_fmd( 490 | unsigned char* fmd, 491 | unsigned int* fmd_size 492 | ); 493 | 494 | /** 495 | \brief Ends enrollment operation, releases memory. 496 | 497 | This function releases resources used during the enrollment process. Call after enrollment is complete. 498 | \return DPFJ_SUCCESS: Enrollment ended. 499 | \return DPFJ_E_FAILURE: Unknown error. 500 | */ 501 | int DPAPICALL dpfj_finish_enrollment(); 502 | 503 | /** 504 | \brief Converts an FMD from any supported format to any other supported format. 505 | 506 | \param fmd1_type type of the input FMD 507 | \param fmd1 pointer to the input FMD data 508 | \param fmd1_size size of the input FMD data 509 | \param fmd2_type type of the target FMD 510 | \param fmd2 pointer to receive target FMD data 511 | \param fmd2_size pointer to allocated size for the FMD data, pointer to receive the actual size of the FMD data 512 | \return DPFJ_SUCCESS: FMD was converted; 513 | \return DPFJ_E_INVALID_PARAMETER: One or more parameters passed are invalid. 514 | \return DPFJ_E_FAILURE: Failed to convert FMD. 515 | */ 516 | int DPAPICALL dpfj_fmd_convert( 517 | DPFJ_FMD_FORMAT fmd1_type, 518 | unsigned char* fmd1, 519 | unsigned int fmd1_size, 520 | DPFJ_FMD_FORMAT fmd2_type, 521 | unsigned char* fmd2, 522 | unsigned int* fmd2_size 523 | ); 524 | 525 | /**************************************************************************************************** 526 | legacy DigitalPersona image format conversion 527 | ****************************************************************************************************/ 528 | 529 | /** 530 | \brief Converts legacy DigitalPersona image to the image in ANSI or ISO format. 531 | 532 | \param dp_image pointer to the DP image data 533 | \param dp_image_size size of the DP image data 534 | \param fid_type type of the FID 535 | \param fid_dpi resolution of the FID, valid values are 500 and 1000 536 | \param rotate180 flag: rotate image, 0 - do not rotate, 1 - rotate 537 | \param fid pointer to receive FID data 538 | \param fid_size pointer to receive the size of the FID 539 | \return DPFJ_SUCCESS: FID was created 540 | \return DPFJ_E_FAILURE: Failed to create FID 541 | */ 542 | int DPAPICALL dpfj_dp_fid_convert( 543 | const unsigned char* dp_image, 544 | unsigned int dp_image_size, 545 | DPFJ_FID_FORMAT fid_type, 546 | unsigned int fid_dpi, 547 | unsigned int rotate180, 548 | unsigned char* fid, 549 | unsigned int* fid_size 550 | ); 551 | 552 | /**************************************************************************************************** 553 | raw image format conversion 554 | ****************************************************************************************************/ 555 | 556 | /** 557 | \brief Converts raw image to the image in ANSI or ISO format. 558 | 559 | \param image_data pointer to the image data 560 | \param image_size size of the image data 561 | \param image_width width of the image 562 | \param image_height height of the image 563 | \param image_dpi resolution of the image 564 | \param finger_pos position of the finger 565 | \param cbeff_id CBEFF product ID, from IBIA registry 566 | \param fid_type type of the FID 567 | \param fid_dpi resolution of the FID, valid values are 500 and 1000 568 | \param rotate180 flag: rotate image, 0 - do not rotate, 1 - rotate 569 | \param fid pointer to receive FID data 570 | \param fid_size pointer to receive the size of the FID 571 | \return DPFJ_SUCCESS: FID was created 572 | \return DPFJ_E_FAILURE: Failed to create FID 573 | */ 574 | int DPAPICALL dpfj_raw_convert( 575 | const unsigned char* image_data, 576 | unsigned int image_size, 577 | unsigned int image_width, 578 | unsigned int image_height, 579 | unsigned int image_dpi, 580 | DPFJ_FINGER_POSITION finger_pos, 581 | unsigned int cbeff_id, 582 | DPFJ_FID_FORMAT fid_type, 583 | unsigned int fid_dpi, 584 | unsigned int rotate180, 585 | unsigned char* fid, 586 | unsigned int* fid_size 587 | ); 588 | 589 | /**************************************************************************************************** 590 | FID and FMD manipulation: types and definitions 591 | ****************************************************************************************************/ 592 | 593 | /** 594 | \brief Define image properties. 595 | 596 | Structure defines image properties for FIDs in ANSI 381-2004 597 | and ISO 19794-4-2005 formats. 598 | */ 599 | typedef struct dpfj_fid_record_params{ 600 | unsigned int record_length; /**< total length of the image, including headers and all views */ 601 | unsigned int cbeff_id; /**< CBEFF product identifier */ 602 | unsigned int capture_device_id; /**< vendor specified */ 603 | unsigned int acquisition_level; /**< from Table 1 in "ANSI INSITS 381-2004" */ 604 | unsigned int finger_cnt; /**< total number of fingerprints in the record, must be greater or equal to 1 */ 605 | unsigned int scale_units; /**< pixels/cm (2) or pixels/inch (1) */ 606 | unsigned int scan_res; /**< scan resolution */ 607 | unsigned int image_res; /**< image resolution */ 608 | unsigned int bpp; /**< pixel depth, 1 - 16 bits */ 609 | unsigned int compression; /**< from Table 3 in "ANSI INSITS 381-2004" */ 610 | } DPFJ_FID_RECORD_PARAMS; 611 | 612 | /** 613 | \brief Define fingerprint image view (FIV) properties. 614 | 615 | Structure defines image view properties for FIVs in ANSI 381-2004 616 | and ISO 19794-4-2005 formats. 617 | */ 618 | typedef struct dpfj_fid_view_params{ 619 | unsigned int data_length; /**< total length of the finger data including header */ 620 | DPFJ_FINGER_POSITION finger_position; /**< finger position */ 621 | unsigned int view_cnt; /**< number of views associated with this finger, must be greater or equal to 1 */ 622 | unsigned int view_number; /**< 1 - 256 */ 623 | unsigned int quality; /**< 1 - 100 for ISO; 1 - 100, 254 for ANSI */ 624 | DPFJ_SCAN_TYPE impression_type; /**< impression type */ 625 | unsigned int width; /**< width of the fingerprint view, in pixels */ 626 | unsigned int height; /**< height of the fingerprint view, in pixels */ 627 | unsigned char* view_data; /**< pointer to the view data */ 628 | } DPFJ_FID_VIEW_PARAMS; 629 | 630 | /** 631 | \brief Define FMD properties. 632 | 633 | Structure defines minutiae data properties for FMDs in ANSI 378-2004 634 | and ISO 19794-2-2005 formats. 635 | */ 636 | typedef struct dpfj_fmd_record_params{ 637 | unsigned int record_length; /**< total length of the image, including headers and all views */ 638 | unsigned int cbeff_id; /**< CBEFF product identifier */ 639 | unsigned int capture_equipment_comp; /**< 4 bits: compliance; */ 640 | unsigned int capture_equipment_id; /**< 12 bits: capture device id, vendor specified */ 641 | unsigned int width; /**< width of the fingerprint image, in pixels */ 642 | unsigned int height; /**< height of the fingerprint image, in pixels */ 643 | unsigned int resolution; /**< resolution of the fingerprint image */ 644 | unsigned int view_cnt; /**< number of views */ 645 | } DPFJ_FMD_RECORD_PARAMS; 646 | 647 | /** 648 | \brief Define fingerprint minutiae view (FMV) properties. 649 | 650 | Structure defines minutiae view properties for FMVs in ANSI 378-2004 651 | and ISO 19794-2-2005 formats. 652 | */ 653 | typedef struct dpfj_fmd_view_params{ 654 | DPFJ_FINGER_POSITION finger_position; /**< 0 - 10, from Table 5 in "ANSI INSITS 381-2004" */ 655 | unsigned int view_number; /**< 0 - 15 */ 656 | DPFJ_SCAN_TYPE impression_type; /**< Table 2 in "ANSI INSITS 378-2004" */ 657 | unsigned int quality; /**< 1 - 100 */ 658 | unsigned int minutia_cnt; /**< number of minutiae */ 659 | unsigned int ext_block_length; /**< length of the extended data block, in bytes */ 660 | unsigned char* ext_block; /**< pointer to the extended data block */ 661 | } DPFJ_FMD_VIEW_PARAMS; 662 | 663 | /**************************************************************************************************** 664 | FID manipulation 665 | ****************************************************************************************************/ 666 | 667 | /** 668 | \brief Read image properties from FID. 669 | 670 | \param image_type type of the FID (per DPFJ_FID_FORMAT) 671 | \param image pointer to the FID 672 | \param params pointer to the structure to receive image properties 673 | \return void 674 | */ 675 | void DPAPICALL dpfj_get_fid_record_params( 676 | DPFJ_FID_FORMAT image_type, 677 | const unsigned char* image, 678 | DPFJ_FID_RECORD_PARAMS* params 679 | ); 680 | 681 | /** 682 | \brief Writes image properties to FID. 683 | 684 | \param params pointer to the structure containing image properties 685 | \param image_type format of the FID (per DPFJ_FID_FORMAT) 686 | \param image pointer to the FID 687 | \return void 688 | */ 689 | void DPAPICALL dpfj_set_fid_record_params( 690 | const DPFJ_FID_RECORD_PARAMS* params, 691 | DPFJ_FID_FORMAT image_type, 692 | unsigned char* image 693 | ); 694 | 695 | /** 696 | \brief Returns pointer to the specified view from FID. 697 | 698 | \param image_type type of the FID (per DPFJ_FID_FORMAT) 699 | \param image pointer to the FID 700 | \param view_idx view index 701 | \return offset to the specified view 702 | */ 703 | unsigned int DPAPICALL dpfj_get_fid_view_offset( 704 | DPFJ_FID_FORMAT image_type, 705 | const unsigned char* image, 706 | unsigned int view_idx 707 | ); 708 | 709 | /** 710 | \brief Read image view properties from FID. 711 | 712 | \param view pointer to the view from the FID 713 | \param params pointer to the structure to receive view properties 714 | \return void 715 | */ 716 | void DPAPICALL dpfj_get_fid_view_params( 717 | const unsigned char* view, 718 | DPFJ_FID_VIEW_PARAMS* params 719 | ); 720 | 721 | /** 722 | \brief Write image view properties to FID. 723 | 724 | \param params pointer to the structure containing view properties 725 | \param view pointer to the view from the FID 726 | \return void 727 | */ 728 | void DPAPICALL dpfj_set_fid_view_params( 729 | const DPFJ_FID_VIEW_PARAMS* params, 730 | unsigned char* view 731 | ); 732 | 733 | /**************************************************************************************************** 734 | FMD manipulation 735 | ****************************************************************************************************/ 736 | 737 | /** 738 | \brief Read minutiae record properties from FMD. 739 | 740 | \param fmd_type format of the FMD (per DPFJ_FMD_FORMAT) 741 | \param fmd pointer to the FMD 742 | \param params pointer to the structure to receive FMD properties 743 | \return void 744 | */ 745 | void DPAPICALL dpfj_get_fmd_record_params( 746 | DPFJ_FMD_FORMAT fmd_type, 747 | const unsigned char* fmd, 748 | DPFJ_FMD_RECORD_PARAMS* params 749 | ); 750 | 751 | /** \brief Write minutiae record properties to FMD. 752 | 753 | \param params pointer to the structure containing FMD properties 754 | \param fmd_type format of the FMD (per DPFJ_FMD_FORMAT) 755 | \param fmd pointer to the FMD 756 | \return void 757 | */ 758 | void DPAPICALL dpfj_set_fmd_record_params( 759 | const DPFJ_FMD_RECORD_PARAMS* params, 760 | DPFJ_FMD_FORMAT fmd_type, 761 | unsigned char* fmd 762 | ); 763 | 764 | /** 765 | \brief Return pointer to the specified view from FMD. 766 | 767 | \param fmd_type format of the FMD (per DPFJ_FMD_FORMAT) 768 | \param fmd pointer to the FMD 769 | \param view_idx view index 770 | \return offset to the specified view 771 | */ 772 | unsigned int DPAPICALL dpfj_get_fmd_view_offset( 773 | DPFJ_FMD_FORMAT fmd_type, 774 | const unsigned char* fmd, 775 | unsigned int view_idx 776 | ); 777 | 778 | /** 779 | \brief Read view properties from FMD. 780 | 781 | \param view pointer to the view from the FMD 782 | \param params pointer to the structure to receive view properties 783 | \return void 784 | */ 785 | void DPAPICALL dpfj_get_fmd_view_params( 786 | const unsigned char* view, 787 | DPFJ_FMD_VIEW_PARAMS* params 788 | ); 789 | 790 | /** 791 | \brief Write view properties to FMD. 792 | 793 | \param params pointer to the structure containing view properties 794 | \param view pointer to the view from the FMD 795 | \return void 796 | */ 797 | void DPAPICALL dpfj_set_fmd_view_params( 798 | const DPFJ_FMD_VIEW_PARAMS* params, 799 | unsigned char* view 800 | ); 801 | 802 | 803 | #ifdef __cplusplus 804 | } 805 | #endif /* __cplusplus */ 806 | 807 | #endif /* __DPFJ_H__ */ 808 | -------------------------------------------------------------------------------- /src/cpp/fingerprint.grpc.pb.cc: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: fingerprint.proto 4 | 5 | #include "fingerprint.pb.h" 6 | #include "fingerprint.grpc.pb.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | namespace fingerprint { 23 | 24 | static const char* FingerPrint_method_names[] = { 25 | "/fingerprint.FingerPrint/EnrollFingerprint", 26 | "/fingerprint.FingerPrint/VerifyFingerprint", 27 | "/fingerprint.FingerPrint/CheckDuplicate", 28 | }; 29 | 30 | std::unique_ptr< FingerPrint::Stub> FingerPrint::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) { 31 | (void)options; 32 | std::unique_ptr< FingerPrint::Stub> stub(new FingerPrint::Stub(channel)); 33 | return stub; 34 | } 35 | 36 | FingerPrint::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel) 37 | : channel_(channel), rpcmethod_EnrollFingerprint_(FingerPrint_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) 38 | , rpcmethod_VerifyFingerprint_(FingerPrint_method_names[1], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) 39 | , rpcmethod_CheckDuplicate_(FingerPrint_method_names[2], ::grpc::internal::RpcMethod::NORMAL_RPC, channel) 40 | {} 41 | 42 | ::grpc::Status FingerPrint::Stub::EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::fingerprint::EnrolledFMD* response) { 43 | return ::grpc::internal::BlockingUnaryCall< ::fingerprint::EnrollmentRequest, ::fingerprint::EnrolledFMD, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_EnrollFingerprint_, context, request, response); 44 | } 45 | 46 | void FingerPrint::Stub::experimental_async::EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response, std::function f) { 47 | ::grpc::internal::CallbackUnaryCall< ::fingerprint::EnrollmentRequest, ::fingerprint::EnrolledFMD, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_EnrollFingerprint_, context, request, response, std::move(f)); 48 | } 49 | 50 | void FingerPrint::Stub::experimental_async::EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response, ::grpc::experimental::ClientUnaryReactor* reactor) { 51 | ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_EnrollFingerprint_, context, request, response, reactor); 52 | } 53 | 54 | ::grpc::ClientAsyncResponseReader< ::fingerprint::EnrolledFMD>* FingerPrint::Stub::PrepareAsyncEnrollFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) { 55 | return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::fingerprint::EnrolledFMD, ::fingerprint::EnrollmentRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_EnrollFingerprint_, context, request); 56 | } 57 | 58 | ::grpc::ClientAsyncResponseReader< ::fingerprint::EnrolledFMD>* FingerPrint::Stub::AsyncEnrollFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) { 59 | auto* result = 60 | this->PrepareAsyncEnrollFingerprintRaw(context, request, cq); 61 | result->StartCall(); 62 | return result; 63 | } 64 | 65 | ::grpc::Status FingerPrint::Stub::VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::fingerprint::VerificationResponse* response) { 66 | return ::grpc::internal::BlockingUnaryCall< ::fingerprint::VerificationRequest, ::fingerprint::VerificationResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_VerifyFingerprint_, context, request, response); 67 | } 68 | 69 | void FingerPrint::Stub::experimental_async::VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response, std::function f) { 70 | ::grpc::internal::CallbackUnaryCall< ::fingerprint::VerificationRequest, ::fingerprint::VerificationResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_VerifyFingerprint_, context, request, response, std::move(f)); 71 | } 72 | 73 | void FingerPrint::Stub::experimental_async::VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) { 74 | ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_VerifyFingerprint_, context, request, response, reactor); 75 | } 76 | 77 | ::grpc::ClientAsyncResponseReader< ::fingerprint::VerificationResponse>* FingerPrint::Stub::PrepareAsyncVerifyFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 78 | return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::fingerprint::VerificationResponse, ::fingerprint::VerificationRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_VerifyFingerprint_, context, request); 79 | } 80 | 81 | ::grpc::ClientAsyncResponseReader< ::fingerprint::VerificationResponse>* FingerPrint::Stub::AsyncVerifyFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 82 | auto* result = 83 | this->PrepareAsyncVerifyFingerprintRaw(context, request, cq); 84 | result->StartCall(); 85 | return result; 86 | } 87 | 88 | ::grpc::Status FingerPrint::Stub::CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::fingerprint::CheckDuplicateResponse* response) { 89 | return ::grpc::internal::BlockingUnaryCall< ::fingerprint::VerificationRequest, ::fingerprint::CheckDuplicateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_CheckDuplicate_, context, request, response); 90 | } 91 | 92 | void FingerPrint::Stub::experimental_async::CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response, std::function f) { 93 | ::grpc::internal::CallbackUnaryCall< ::fingerprint::VerificationRequest, ::fingerprint::CheckDuplicateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_CheckDuplicate_, context, request, response, std::move(f)); 94 | } 95 | 96 | void FingerPrint::Stub::experimental_async::CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) { 97 | ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_CheckDuplicate_, context, request, response, reactor); 98 | } 99 | 100 | ::grpc::ClientAsyncResponseReader< ::fingerprint::CheckDuplicateResponse>* FingerPrint::Stub::PrepareAsyncCheckDuplicateRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 101 | return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::fingerprint::CheckDuplicateResponse, ::fingerprint::VerificationRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_CheckDuplicate_, context, request); 102 | } 103 | 104 | ::grpc::ClientAsyncResponseReader< ::fingerprint::CheckDuplicateResponse>* FingerPrint::Stub::AsyncCheckDuplicateRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 105 | auto* result = 106 | this->PrepareAsyncCheckDuplicateRaw(context, request, cq); 107 | result->StartCall(); 108 | return result; 109 | } 110 | 111 | FingerPrint::Service::Service() { 112 | AddMethod(new ::grpc::internal::RpcServiceMethod( 113 | FingerPrint_method_names[0], 114 | ::grpc::internal::RpcMethod::NORMAL_RPC, 115 | new ::grpc::internal::RpcMethodHandler< FingerPrint::Service, ::fingerprint::EnrollmentRequest, ::fingerprint::EnrolledFMD, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( 116 | [](FingerPrint::Service* service, 117 | ::grpc::ServerContext* ctx, 118 | const ::fingerprint::EnrollmentRequest* req, 119 | ::fingerprint::EnrolledFMD* resp) { 120 | return service->EnrollFingerprint(ctx, req, resp); 121 | }, this))); 122 | AddMethod(new ::grpc::internal::RpcServiceMethod( 123 | FingerPrint_method_names[1], 124 | ::grpc::internal::RpcMethod::NORMAL_RPC, 125 | new ::grpc::internal::RpcMethodHandler< FingerPrint::Service, ::fingerprint::VerificationRequest, ::fingerprint::VerificationResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( 126 | [](FingerPrint::Service* service, 127 | ::grpc::ServerContext* ctx, 128 | const ::fingerprint::VerificationRequest* req, 129 | ::fingerprint::VerificationResponse* resp) { 130 | return service->VerifyFingerprint(ctx, req, resp); 131 | }, this))); 132 | AddMethod(new ::grpc::internal::RpcServiceMethod( 133 | FingerPrint_method_names[2], 134 | ::grpc::internal::RpcMethod::NORMAL_RPC, 135 | new ::grpc::internal::RpcMethodHandler< FingerPrint::Service, ::fingerprint::VerificationRequest, ::fingerprint::CheckDuplicateResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>( 136 | [](FingerPrint::Service* service, 137 | ::grpc::ServerContext* ctx, 138 | const ::fingerprint::VerificationRequest* req, 139 | ::fingerprint::CheckDuplicateResponse* resp) { 140 | return service->CheckDuplicate(ctx, req, resp); 141 | }, this))); 142 | } 143 | 144 | FingerPrint::Service::~Service() { 145 | } 146 | 147 | ::grpc::Status FingerPrint::Service::EnrollFingerprint(::grpc::ServerContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response) { 148 | (void) context; 149 | (void) request; 150 | (void) response; 151 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 152 | } 153 | 154 | ::grpc::Status FingerPrint::Service::VerifyFingerprint(::grpc::ServerContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response) { 155 | (void) context; 156 | (void) request; 157 | (void) response; 158 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 159 | } 160 | 161 | ::grpc::Status FingerPrint::Service::CheckDuplicate(::grpc::ServerContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response) { 162 | (void) context; 163 | (void) request; 164 | (void) response; 165 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 166 | } 167 | 168 | 169 | } // namespace fingerprint 170 | 171 | -------------------------------------------------------------------------------- /src/cpp/fingerprint.grpc.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the gRPC C++ plugin. 2 | // If you make any local change, they will be lost. 3 | // source: fingerprint.proto 4 | // Original file comments: 5 | // 6 | // 7 | // Bismillahirrahmanirraheem 8 | // Author: Dahir Muhammad Dahir 9 | // Date: 22-01-2021 02:47 PM 10 | // About: I will tell you later 11 | // 12 | // 13 | #ifndef GRPC_fingerprint_2eproto__INCLUDED 14 | #define GRPC_fingerprint_2eproto__INCLUDED 15 | 16 | #include "fingerprint.pb.h" 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | namespace fingerprint { 39 | 40 | class FingerPrint final { 41 | public: 42 | static constexpr char const* service_full_name() { 43 | return "fingerprint.FingerPrint"; 44 | } 45 | class StubInterface { 46 | public: 47 | virtual ~StubInterface() {} 48 | virtual ::grpc::Status EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::fingerprint::EnrolledFMD* response) = 0; 49 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::EnrolledFMD>> AsyncEnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) { 50 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::EnrolledFMD>>(AsyncEnrollFingerprintRaw(context, request, cq)); 51 | } 52 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::EnrolledFMD>> PrepareAsyncEnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) { 53 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::EnrolledFMD>>(PrepareAsyncEnrollFingerprintRaw(context, request, cq)); 54 | } 55 | virtual ::grpc::Status VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::fingerprint::VerificationResponse* response) = 0; 56 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::VerificationResponse>> AsyncVerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 57 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::VerificationResponse>>(AsyncVerifyFingerprintRaw(context, request, cq)); 58 | } 59 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::VerificationResponse>> PrepareAsyncVerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 60 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::VerificationResponse>>(PrepareAsyncVerifyFingerprintRaw(context, request, cq)); 61 | } 62 | virtual ::grpc::Status CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::fingerprint::CheckDuplicateResponse* response) = 0; 63 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::CheckDuplicateResponse>> AsyncCheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 64 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::CheckDuplicateResponse>>(AsyncCheckDuplicateRaw(context, request, cq)); 65 | } 66 | std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::CheckDuplicateResponse>> PrepareAsyncCheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 67 | return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::CheckDuplicateResponse>>(PrepareAsyncCheckDuplicateRaw(context, request, cq)); 68 | } 69 | class experimental_async_interface { 70 | public: 71 | virtual ~experimental_async_interface() {} 72 | virtual void EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response, std::function) = 0; 73 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 74 | virtual void EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response, ::grpc::ClientUnaryReactor* reactor) = 0; 75 | #else 76 | virtual void EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; 77 | #endif 78 | virtual void VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response, std::function) = 0; 79 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 80 | virtual void VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; 81 | #else 82 | virtual void VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; 83 | #endif 84 | virtual void CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response, std::function) = 0; 85 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 86 | virtual void CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0; 87 | #else 88 | virtual void CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0; 89 | #endif 90 | }; 91 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 92 | typedef class experimental_async_interface async_interface; 93 | #endif 94 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 95 | async_interface* async() { return experimental_async(); } 96 | #endif 97 | virtual class experimental_async_interface* experimental_async() { return nullptr; } 98 | private: 99 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::EnrolledFMD>* AsyncEnrollFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) = 0; 100 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::EnrolledFMD>* PrepareAsyncEnrollFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) = 0; 101 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::VerificationResponse>* AsyncVerifyFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) = 0; 102 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::VerificationResponse>* PrepareAsyncVerifyFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) = 0; 103 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::CheckDuplicateResponse>* AsyncCheckDuplicateRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) = 0; 104 | virtual ::grpc::ClientAsyncResponseReaderInterface< ::fingerprint::CheckDuplicateResponse>* PrepareAsyncCheckDuplicateRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) = 0; 105 | }; 106 | class Stub final : public StubInterface { 107 | public: 108 | Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); 109 | ::grpc::Status EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::fingerprint::EnrolledFMD* response) override; 110 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::EnrolledFMD>> AsyncEnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) { 111 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::EnrolledFMD>>(AsyncEnrollFingerprintRaw(context, request, cq)); 112 | } 113 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::EnrolledFMD>> PrepareAsyncEnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) { 114 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::EnrolledFMD>>(PrepareAsyncEnrollFingerprintRaw(context, request, cq)); 115 | } 116 | ::grpc::Status VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::fingerprint::VerificationResponse* response) override; 117 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::VerificationResponse>> AsyncVerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 118 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::VerificationResponse>>(AsyncVerifyFingerprintRaw(context, request, cq)); 119 | } 120 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::VerificationResponse>> PrepareAsyncVerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 121 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::VerificationResponse>>(PrepareAsyncVerifyFingerprintRaw(context, request, cq)); 122 | } 123 | ::grpc::Status CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::fingerprint::CheckDuplicateResponse* response) override; 124 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::CheckDuplicateResponse>> AsyncCheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 125 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::CheckDuplicateResponse>>(AsyncCheckDuplicateRaw(context, request, cq)); 126 | } 127 | std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::CheckDuplicateResponse>> PrepareAsyncCheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) { 128 | return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fingerprint::CheckDuplicateResponse>>(PrepareAsyncCheckDuplicateRaw(context, request, cq)); 129 | } 130 | class experimental_async final : 131 | public StubInterface::experimental_async_interface { 132 | public: 133 | void EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response, std::function) override; 134 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 135 | void EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response, ::grpc::ClientUnaryReactor* reactor) override; 136 | #else 137 | void EnrollFingerprint(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; 138 | #endif 139 | void VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response, std::function) override; 140 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 141 | void VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response, ::grpc::ClientUnaryReactor* reactor) override; 142 | #else 143 | void VerifyFingerprint(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; 144 | #endif 145 | void CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response, std::function) override; 146 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 147 | void CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response, ::grpc::ClientUnaryReactor* reactor) override; 148 | #else 149 | void CheckDuplicate(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override; 150 | #endif 151 | private: 152 | friend class Stub; 153 | explicit experimental_async(Stub* stub): stub_(stub) { } 154 | Stub* stub() { return stub_; } 155 | Stub* stub_; 156 | }; 157 | class experimental_async_interface* experimental_async() override { return &async_stub_; } 158 | 159 | private: 160 | std::shared_ptr< ::grpc::ChannelInterface> channel_; 161 | class experimental_async async_stub_{this}; 162 | ::grpc::ClientAsyncResponseReader< ::fingerprint::EnrolledFMD>* AsyncEnrollFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) override; 163 | ::grpc::ClientAsyncResponseReader< ::fingerprint::EnrolledFMD>* PrepareAsyncEnrollFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::EnrollmentRequest& request, ::grpc::CompletionQueue* cq) override; 164 | ::grpc::ClientAsyncResponseReader< ::fingerprint::VerificationResponse>* AsyncVerifyFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) override; 165 | ::grpc::ClientAsyncResponseReader< ::fingerprint::VerificationResponse>* PrepareAsyncVerifyFingerprintRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) override; 166 | ::grpc::ClientAsyncResponseReader< ::fingerprint::CheckDuplicateResponse>* AsyncCheckDuplicateRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) override; 167 | ::grpc::ClientAsyncResponseReader< ::fingerprint::CheckDuplicateResponse>* PrepareAsyncCheckDuplicateRaw(::grpc::ClientContext* context, const ::fingerprint::VerificationRequest& request, ::grpc::CompletionQueue* cq) override; 168 | const ::grpc::internal::RpcMethod rpcmethod_EnrollFingerprint_; 169 | const ::grpc::internal::RpcMethod rpcmethod_VerifyFingerprint_; 170 | const ::grpc::internal::RpcMethod rpcmethod_CheckDuplicate_; 171 | }; 172 | static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); 173 | 174 | class Service : public ::grpc::Service { 175 | public: 176 | Service(); 177 | virtual ~Service(); 178 | virtual ::grpc::Status EnrollFingerprint(::grpc::ServerContext* context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response); 179 | virtual ::grpc::Status VerifyFingerprint(::grpc::ServerContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response); 180 | virtual ::grpc::Status CheckDuplicate(::grpc::ServerContext* context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response); 181 | }; 182 | template 183 | class WithAsyncMethod_EnrollFingerprint : public BaseClass { 184 | private: 185 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 186 | public: 187 | WithAsyncMethod_EnrollFingerprint() { 188 | ::grpc::Service::MarkMethodAsync(0); 189 | } 190 | ~WithAsyncMethod_EnrollFingerprint() override { 191 | BaseClassMustBeDerivedFromService(this); 192 | } 193 | // disable synchronous version of this method 194 | ::grpc::Status EnrollFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::EnrollmentRequest* /*request*/, ::fingerprint::EnrolledFMD* /*response*/) override { 195 | abort(); 196 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 197 | } 198 | void RequestEnrollFingerprint(::grpc::ServerContext* context, ::fingerprint::EnrollmentRequest* request, ::grpc::ServerAsyncResponseWriter< ::fingerprint::EnrolledFMD>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 199 | ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); 200 | } 201 | }; 202 | template 203 | class WithAsyncMethod_VerifyFingerprint : public BaseClass { 204 | private: 205 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 206 | public: 207 | WithAsyncMethod_VerifyFingerprint() { 208 | ::grpc::Service::MarkMethodAsync(1); 209 | } 210 | ~WithAsyncMethod_VerifyFingerprint() override { 211 | BaseClassMustBeDerivedFromService(this); 212 | } 213 | // disable synchronous version of this method 214 | ::grpc::Status VerifyFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::VerificationResponse* /*response*/) override { 215 | abort(); 216 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 217 | } 218 | void RequestVerifyFingerprint(::grpc::ServerContext* context, ::fingerprint::VerificationRequest* request, ::grpc::ServerAsyncResponseWriter< ::fingerprint::VerificationResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 219 | ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); 220 | } 221 | }; 222 | template 223 | class WithAsyncMethod_CheckDuplicate : public BaseClass { 224 | private: 225 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 226 | public: 227 | WithAsyncMethod_CheckDuplicate() { 228 | ::grpc::Service::MarkMethodAsync(2); 229 | } 230 | ~WithAsyncMethod_CheckDuplicate() override { 231 | BaseClassMustBeDerivedFromService(this); 232 | } 233 | // disable synchronous version of this method 234 | ::grpc::Status CheckDuplicate(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::CheckDuplicateResponse* /*response*/) override { 235 | abort(); 236 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 237 | } 238 | void RequestCheckDuplicate(::grpc::ServerContext* context, ::fingerprint::VerificationRequest* request, ::grpc::ServerAsyncResponseWriter< ::fingerprint::CheckDuplicateResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 239 | ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); 240 | } 241 | }; 242 | typedef WithAsyncMethod_EnrollFingerprint > > AsyncService; 243 | template 244 | class ExperimentalWithCallbackMethod_EnrollFingerprint : public BaseClass { 245 | private: 246 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 247 | public: 248 | ExperimentalWithCallbackMethod_EnrollFingerprint() { 249 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 250 | ::grpc::Service:: 251 | #else 252 | ::grpc::Service::experimental(). 253 | #endif 254 | MarkMethodCallback(0, 255 | new ::grpc::internal::CallbackUnaryHandler< ::fingerprint::EnrollmentRequest, ::fingerprint::EnrolledFMD>( 256 | [this]( 257 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 258 | ::grpc::CallbackServerContext* 259 | #else 260 | ::grpc::experimental::CallbackServerContext* 261 | #endif 262 | context, const ::fingerprint::EnrollmentRequest* request, ::fingerprint::EnrolledFMD* response) { return this->EnrollFingerprint(context, request, response); }));} 263 | void SetMessageAllocatorFor_EnrollFingerprint( 264 | ::grpc::experimental::MessageAllocator< ::fingerprint::EnrollmentRequest, ::fingerprint::EnrolledFMD>* allocator) { 265 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 266 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0); 267 | #else 268 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(0); 269 | #endif 270 | static_cast<::grpc::internal::CallbackUnaryHandler< ::fingerprint::EnrollmentRequest, ::fingerprint::EnrolledFMD>*>(handler) 271 | ->SetMessageAllocator(allocator); 272 | } 273 | ~ExperimentalWithCallbackMethod_EnrollFingerprint() override { 274 | BaseClassMustBeDerivedFromService(this); 275 | } 276 | // disable synchronous version of this method 277 | ::grpc::Status EnrollFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::EnrollmentRequest* /*request*/, ::fingerprint::EnrolledFMD* /*response*/) override { 278 | abort(); 279 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 280 | } 281 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 282 | virtual ::grpc::ServerUnaryReactor* EnrollFingerprint( 283 | ::grpc::CallbackServerContext* /*context*/, const ::fingerprint::EnrollmentRequest* /*request*/, ::fingerprint::EnrolledFMD* /*response*/) 284 | #else 285 | virtual ::grpc::experimental::ServerUnaryReactor* EnrollFingerprint( 286 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::fingerprint::EnrollmentRequest* /*request*/, ::fingerprint::EnrolledFMD* /*response*/) 287 | #endif 288 | { return nullptr; } 289 | }; 290 | template 291 | class ExperimentalWithCallbackMethod_VerifyFingerprint : public BaseClass { 292 | private: 293 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 294 | public: 295 | ExperimentalWithCallbackMethod_VerifyFingerprint() { 296 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 297 | ::grpc::Service:: 298 | #else 299 | ::grpc::Service::experimental(). 300 | #endif 301 | MarkMethodCallback(1, 302 | new ::grpc::internal::CallbackUnaryHandler< ::fingerprint::VerificationRequest, ::fingerprint::VerificationResponse>( 303 | [this]( 304 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 305 | ::grpc::CallbackServerContext* 306 | #else 307 | ::grpc::experimental::CallbackServerContext* 308 | #endif 309 | context, const ::fingerprint::VerificationRequest* request, ::fingerprint::VerificationResponse* response) { return this->VerifyFingerprint(context, request, response); }));} 310 | void SetMessageAllocatorFor_VerifyFingerprint( 311 | ::grpc::experimental::MessageAllocator< ::fingerprint::VerificationRequest, ::fingerprint::VerificationResponse>* allocator) { 312 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 313 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(1); 314 | #else 315 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(1); 316 | #endif 317 | static_cast<::grpc::internal::CallbackUnaryHandler< ::fingerprint::VerificationRequest, ::fingerprint::VerificationResponse>*>(handler) 318 | ->SetMessageAllocator(allocator); 319 | } 320 | ~ExperimentalWithCallbackMethod_VerifyFingerprint() override { 321 | BaseClassMustBeDerivedFromService(this); 322 | } 323 | // disable synchronous version of this method 324 | ::grpc::Status VerifyFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::VerificationResponse* /*response*/) override { 325 | abort(); 326 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 327 | } 328 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 329 | virtual ::grpc::ServerUnaryReactor* VerifyFingerprint( 330 | ::grpc::CallbackServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::VerificationResponse* /*response*/) 331 | #else 332 | virtual ::grpc::experimental::ServerUnaryReactor* VerifyFingerprint( 333 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::VerificationResponse* /*response*/) 334 | #endif 335 | { return nullptr; } 336 | }; 337 | template 338 | class ExperimentalWithCallbackMethod_CheckDuplicate : public BaseClass { 339 | private: 340 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 341 | public: 342 | ExperimentalWithCallbackMethod_CheckDuplicate() { 343 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 344 | ::grpc::Service:: 345 | #else 346 | ::grpc::Service::experimental(). 347 | #endif 348 | MarkMethodCallback(2, 349 | new ::grpc::internal::CallbackUnaryHandler< ::fingerprint::VerificationRequest, ::fingerprint::CheckDuplicateResponse>( 350 | [this]( 351 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 352 | ::grpc::CallbackServerContext* 353 | #else 354 | ::grpc::experimental::CallbackServerContext* 355 | #endif 356 | context, const ::fingerprint::VerificationRequest* request, ::fingerprint::CheckDuplicateResponse* response) { return this->CheckDuplicate(context, request, response); }));} 357 | void SetMessageAllocatorFor_CheckDuplicate( 358 | ::grpc::experimental::MessageAllocator< ::fingerprint::VerificationRequest, ::fingerprint::CheckDuplicateResponse>* allocator) { 359 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 360 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(2); 361 | #else 362 | ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(2); 363 | #endif 364 | static_cast<::grpc::internal::CallbackUnaryHandler< ::fingerprint::VerificationRequest, ::fingerprint::CheckDuplicateResponse>*>(handler) 365 | ->SetMessageAllocator(allocator); 366 | } 367 | ~ExperimentalWithCallbackMethod_CheckDuplicate() override { 368 | BaseClassMustBeDerivedFromService(this); 369 | } 370 | // disable synchronous version of this method 371 | ::grpc::Status CheckDuplicate(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::CheckDuplicateResponse* /*response*/) override { 372 | abort(); 373 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 374 | } 375 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 376 | virtual ::grpc::ServerUnaryReactor* CheckDuplicate( 377 | ::grpc::CallbackServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::CheckDuplicateResponse* /*response*/) 378 | #else 379 | virtual ::grpc::experimental::ServerUnaryReactor* CheckDuplicate( 380 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::CheckDuplicateResponse* /*response*/) 381 | #endif 382 | { return nullptr; } 383 | }; 384 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 385 | typedef ExperimentalWithCallbackMethod_EnrollFingerprint > > CallbackService; 386 | #endif 387 | 388 | typedef ExperimentalWithCallbackMethod_EnrollFingerprint > > ExperimentalCallbackService; 389 | template 390 | class WithGenericMethod_EnrollFingerprint : public BaseClass { 391 | private: 392 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 393 | public: 394 | WithGenericMethod_EnrollFingerprint() { 395 | ::grpc::Service::MarkMethodGeneric(0); 396 | } 397 | ~WithGenericMethod_EnrollFingerprint() override { 398 | BaseClassMustBeDerivedFromService(this); 399 | } 400 | // disable synchronous version of this method 401 | ::grpc::Status EnrollFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::EnrollmentRequest* /*request*/, ::fingerprint::EnrolledFMD* /*response*/) override { 402 | abort(); 403 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 404 | } 405 | }; 406 | template 407 | class WithGenericMethod_VerifyFingerprint : public BaseClass { 408 | private: 409 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 410 | public: 411 | WithGenericMethod_VerifyFingerprint() { 412 | ::grpc::Service::MarkMethodGeneric(1); 413 | } 414 | ~WithGenericMethod_VerifyFingerprint() override { 415 | BaseClassMustBeDerivedFromService(this); 416 | } 417 | // disable synchronous version of this method 418 | ::grpc::Status VerifyFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::VerificationResponse* /*response*/) override { 419 | abort(); 420 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 421 | } 422 | }; 423 | template 424 | class WithGenericMethod_CheckDuplicate : public BaseClass { 425 | private: 426 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 427 | public: 428 | WithGenericMethod_CheckDuplicate() { 429 | ::grpc::Service::MarkMethodGeneric(2); 430 | } 431 | ~WithGenericMethod_CheckDuplicate() override { 432 | BaseClassMustBeDerivedFromService(this); 433 | } 434 | // disable synchronous version of this method 435 | ::grpc::Status CheckDuplicate(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::CheckDuplicateResponse* /*response*/) override { 436 | abort(); 437 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 438 | } 439 | }; 440 | template 441 | class WithRawMethod_EnrollFingerprint : public BaseClass { 442 | private: 443 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 444 | public: 445 | WithRawMethod_EnrollFingerprint() { 446 | ::grpc::Service::MarkMethodRaw(0); 447 | } 448 | ~WithRawMethod_EnrollFingerprint() override { 449 | BaseClassMustBeDerivedFromService(this); 450 | } 451 | // disable synchronous version of this method 452 | ::grpc::Status EnrollFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::EnrollmentRequest* /*request*/, ::fingerprint::EnrolledFMD* /*response*/) override { 453 | abort(); 454 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 455 | } 456 | void RequestEnrollFingerprint(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 457 | ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag); 458 | } 459 | }; 460 | template 461 | class WithRawMethod_VerifyFingerprint : public BaseClass { 462 | private: 463 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 464 | public: 465 | WithRawMethod_VerifyFingerprint() { 466 | ::grpc::Service::MarkMethodRaw(1); 467 | } 468 | ~WithRawMethod_VerifyFingerprint() override { 469 | BaseClassMustBeDerivedFromService(this); 470 | } 471 | // disable synchronous version of this method 472 | ::grpc::Status VerifyFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::VerificationResponse* /*response*/) override { 473 | abort(); 474 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 475 | } 476 | void RequestVerifyFingerprint(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 477 | ::grpc::Service::RequestAsyncUnary(1, context, request, response, new_call_cq, notification_cq, tag); 478 | } 479 | }; 480 | template 481 | class WithRawMethod_CheckDuplicate : public BaseClass { 482 | private: 483 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 484 | public: 485 | WithRawMethod_CheckDuplicate() { 486 | ::grpc::Service::MarkMethodRaw(2); 487 | } 488 | ~WithRawMethod_CheckDuplicate() override { 489 | BaseClassMustBeDerivedFromService(this); 490 | } 491 | // disable synchronous version of this method 492 | ::grpc::Status CheckDuplicate(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::CheckDuplicateResponse* /*response*/) override { 493 | abort(); 494 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 495 | } 496 | void RequestCheckDuplicate(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) { 497 | ::grpc::Service::RequestAsyncUnary(2, context, request, response, new_call_cq, notification_cq, tag); 498 | } 499 | }; 500 | template 501 | class ExperimentalWithRawCallbackMethod_EnrollFingerprint : public BaseClass { 502 | private: 503 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 504 | public: 505 | ExperimentalWithRawCallbackMethod_EnrollFingerprint() { 506 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 507 | ::grpc::Service:: 508 | #else 509 | ::grpc::Service::experimental(). 510 | #endif 511 | MarkMethodRawCallback(0, 512 | new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( 513 | [this]( 514 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 515 | ::grpc::CallbackServerContext* 516 | #else 517 | ::grpc::experimental::CallbackServerContext* 518 | #endif 519 | context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->EnrollFingerprint(context, request, response); })); 520 | } 521 | ~ExperimentalWithRawCallbackMethod_EnrollFingerprint() override { 522 | BaseClassMustBeDerivedFromService(this); 523 | } 524 | // disable synchronous version of this method 525 | ::grpc::Status EnrollFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::EnrollmentRequest* /*request*/, ::fingerprint::EnrolledFMD* /*response*/) override { 526 | abort(); 527 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 528 | } 529 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 530 | virtual ::grpc::ServerUnaryReactor* EnrollFingerprint( 531 | ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 532 | #else 533 | virtual ::grpc::experimental::ServerUnaryReactor* EnrollFingerprint( 534 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 535 | #endif 536 | { return nullptr; } 537 | }; 538 | template 539 | class ExperimentalWithRawCallbackMethod_VerifyFingerprint : public BaseClass { 540 | private: 541 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 542 | public: 543 | ExperimentalWithRawCallbackMethod_VerifyFingerprint() { 544 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 545 | ::grpc::Service:: 546 | #else 547 | ::grpc::Service::experimental(). 548 | #endif 549 | MarkMethodRawCallback(1, 550 | new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( 551 | [this]( 552 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 553 | ::grpc::CallbackServerContext* 554 | #else 555 | ::grpc::experimental::CallbackServerContext* 556 | #endif 557 | context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->VerifyFingerprint(context, request, response); })); 558 | } 559 | ~ExperimentalWithRawCallbackMethod_VerifyFingerprint() override { 560 | BaseClassMustBeDerivedFromService(this); 561 | } 562 | // disable synchronous version of this method 563 | ::grpc::Status VerifyFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::VerificationResponse* /*response*/) override { 564 | abort(); 565 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 566 | } 567 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 568 | virtual ::grpc::ServerUnaryReactor* VerifyFingerprint( 569 | ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 570 | #else 571 | virtual ::grpc::experimental::ServerUnaryReactor* VerifyFingerprint( 572 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 573 | #endif 574 | { return nullptr; } 575 | }; 576 | template 577 | class ExperimentalWithRawCallbackMethod_CheckDuplicate : public BaseClass { 578 | private: 579 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 580 | public: 581 | ExperimentalWithRawCallbackMethod_CheckDuplicate() { 582 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 583 | ::grpc::Service:: 584 | #else 585 | ::grpc::Service::experimental(). 586 | #endif 587 | MarkMethodRawCallback(2, 588 | new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>( 589 | [this]( 590 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 591 | ::grpc::CallbackServerContext* 592 | #else 593 | ::grpc::experimental::CallbackServerContext* 594 | #endif 595 | context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->CheckDuplicate(context, request, response); })); 596 | } 597 | ~ExperimentalWithRawCallbackMethod_CheckDuplicate() override { 598 | BaseClassMustBeDerivedFromService(this); 599 | } 600 | // disable synchronous version of this method 601 | ::grpc::Status CheckDuplicate(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::CheckDuplicateResponse* /*response*/) override { 602 | abort(); 603 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 604 | } 605 | #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL 606 | virtual ::grpc::ServerUnaryReactor* CheckDuplicate( 607 | ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 608 | #else 609 | virtual ::grpc::experimental::ServerUnaryReactor* CheckDuplicate( 610 | ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/) 611 | #endif 612 | { return nullptr; } 613 | }; 614 | template 615 | class WithStreamedUnaryMethod_EnrollFingerprint : public BaseClass { 616 | private: 617 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 618 | public: 619 | WithStreamedUnaryMethod_EnrollFingerprint() { 620 | ::grpc::Service::MarkMethodStreamed(0, 621 | new ::grpc::internal::StreamedUnaryHandler< 622 | ::fingerprint::EnrollmentRequest, ::fingerprint::EnrolledFMD>( 623 | [this](::grpc::ServerContext* context, 624 | ::grpc::ServerUnaryStreamer< 625 | ::fingerprint::EnrollmentRequest, ::fingerprint::EnrolledFMD>* streamer) { 626 | return this->StreamedEnrollFingerprint(context, 627 | streamer); 628 | })); 629 | } 630 | ~WithStreamedUnaryMethod_EnrollFingerprint() override { 631 | BaseClassMustBeDerivedFromService(this); 632 | } 633 | // disable regular version of this method 634 | ::grpc::Status EnrollFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::EnrollmentRequest* /*request*/, ::fingerprint::EnrolledFMD* /*response*/) override { 635 | abort(); 636 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 637 | } 638 | // replace default version of method with streamed unary 639 | virtual ::grpc::Status StreamedEnrollFingerprint(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::fingerprint::EnrollmentRequest,::fingerprint::EnrolledFMD>* server_unary_streamer) = 0; 640 | }; 641 | template 642 | class WithStreamedUnaryMethod_VerifyFingerprint : public BaseClass { 643 | private: 644 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 645 | public: 646 | WithStreamedUnaryMethod_VerifyFingerprint() { 647 | ::grpc::Service::MarkMethodStreamed(1, 648 | new ::grpc::internal::StreamedUnaryHandler< 649 | ::fingerprint::VerificationRequest, ::fingerprint::VerificationResponse>( 650 | [this](::grpc::ServerContext* context, 651 | ::grpc::ServerUnaryStreamer< 652 | ::fingerprint::VerificationRequest, ::fingerprint::VerificationResponse>* streamer) { 653 | return this->StreamedVerifyFingerprint(context, 654 | streamer); 655 | })); 656 | } 657 | ~WithStreamedUnaryMethod_VerifyFingerprint() override { 658 | BaseClassMustBeDerivedFromService(this); 659 | } 660 | // disable regular version of this method 661 | ::grpc::Status VerifyFingerprint(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::VerificationResponse* /*response*/) override { 662 | abort(); 663 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 664 | } 665 | // replace default version of method with streamed unary 666 | virtual ::grpc::Status StreamedVerifyFingerprint(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::fingerprint::VerificationRequest,::fingerprint::VerificationResponse>* server_unary_streamer) = 0; 667 | }; 668 | template 669 | class WithStreamedUnaryMethod_CheckDuplicate : public BaseClass { 670 | private: 671 | void BaseClassMustBeDerivedFromService(const Service* /*service*/) {} 672 | public: 673 | WithStreamedUnaryMethod_CheckDuplicate() { 674 | ::grpc::Service::MarkMethodStreamed(2, 675 | new ::grpc::internal::StreamedUnaryHandler< 676 | ::fingerprint::VerificationRequest, ::fingerprint::CheckDuplicateResponse>( 677 | [this](::grpc::ServerContext* context, 678 | ::grpc::ServerUnaryStreamer< 679 | ::fingerprint::VerificationRequest, ::fingerprint::CheckDuplicateResponse>* streamer) { 680 | return this->StreamedCheckDuplicate(context, 681 | streamer); 682 | })); 683 | } 684 | ~WithStreamedUnaryMethod_CheckDuplicate() override { 685 | BaseClassMustBeDerivedFromService(this); 686 | } 687 | // disable regular version of this method 688 | ::grpc::Status CheckDuplicate(::grpc::ServerContext* /*context*/, const ::fingerprint::VerificationRequest* /*request*/, ::fingerprint::CheckDuplicateResponse* /*response*/) override { 689 | abort(); 690 | return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); 691 | } 692 | // replace default version of method with streamed unary 693 | virtual ::grpc::Status StreamedCheckDuplicate(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::fingerprint::VerificationRequest,::fingerprint::CheckDuplicateResponse>* server_unary_streamer) = 0; 694 | }; 695 | typedef WithStreamedUnaryMethod_EnrollFingerprint > > StreamedUnaryService; 696 | typedef Service SplitStreamedService; 697 | typedef WithStreamedUnaryMethod_EnrollFingerprint > > StreamedService; 698 | }; 699 | 700 | } // namespace fingerprint 701 | 702 | 703 | #endif // GRPC_fingerprint_2eproto__INCLUDED 704 | -------------------------------------------------------------------------------- /src/cpp/fingerprint.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: fingerprint.proto 3 | 4 | #ifndef GOOGLE_PROTOBUF_INCLUDED_fingerprint_2eproto 5 | #define GOOGLE_PROTOBUF_INCLUDED_fingerprint_2eproto 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #if PROTOBUF_VERSION < 3014000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 3014000 < PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include // IWYU pragma: export 32 | #include // IWYU pragma: export 33 | #include 34 | // @@protoc_insertion_point(includes) 35 | #include 36 | #define PROTOBUF_INTERNAL_EXPORT_fingerprint_2eproto 37 | PROTOBUF_NAMESPACE_OPEN 38 | namespace internal { 39 | class AnyMetadata; 40 | } // namespace internal 41 | PROTOBUF_NAMESPACE_CLOSE 42 | 43 | // Internal implementation detail -- do not use these members. 44 | struct TableStruct_fingerprint_2eproto { 45 | static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] 46 | PROTOBUF_SECTION_VARIABLE(protodesc_cold); 47 | static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] 48 | PROTOBUF_SECTION_VARIABLE(protodesc_cold); 49 | static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[6] 50 | PROTOBUF_SECTION_VARIABLE(protodesc_cold); 51 | static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; 52 | static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; 53 | static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[]; 54 | }; 55 | extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_fingerprint_2eproto; 56 | namespace fingerprint { 57 | class CheckDuplicateResponse; 58 | class CheckDuplicateResponseDefaultTypeInternal; 59 | extern CheckDuplicateResponseDefaultTypeInternal _CheckDuplicateResponse_default_instance_; 60 | class EnrolledFMD; 61 | class EnrolledFMDDefaultTypeInternal; 62 | extern EnrolledFMDDefaultTypeInternal _EnrolledFMD_default_instance_; 63 | class EnrollmentRequest; 64 | class EnrollmentRequestDefaultTypeInternal; 65 | extern EnrollmentRequestDefaultTypeInternal _EnrollmentRequest_default_instance_; 66 | class PreEnrolledFMD; 67 | class PreEnrolledFMDDefaultTypeInternal; 68 | extern PreEnrolledFMDDefaultTypeInternal _PreEnrolledFMD_default_instance_; 69 | class VerificationRequest; 70 | class VerificationRequestDefaultTypeInternal; 71 | extern VerificationRequestDefaultTypeInternal _VerificationRequest_default_instance_; 72 | class VerificationResponse; 73 | class VerificationResponseDefaultTypeInternal; 74 | extern VerificationResponseDefaultTypeInternal _VerificationResponse_default_instance_; 75 | } // namespace fingerprint 76 | PROTOBUF_NAMESPACE_OPEN 77 | template<> ::fingerprint::CheckDuplicateResponse* Arena::CreateMaybeMessage<::fingerprint::CheckDuplicateResponse>(Arena*); 78 | template<> ::fingerprint::EnrolledFMD* Arena::CreateMaybeMessage<::fingerprint::EnrolledFMD>(Arena*); 79 | template<> ::fingerprint::EnrollmentRequest* Arena::CreateMaybeMessage<::fingerprint::EnrollmentRequest>(Arena*); 80 | template<> ::fingerprint::PreEnrolledFMD* Arena::CreateMaybeMessage<::fingerprint::PreEnrolledFMD>(Arena*); 81 | template<> ::fingerprint::VerificationRequest* Arena::CreateMaybeMessage<::fingerprint::VerificationRequest>(Arena*); 82 | template<> ::fingerprint::VerificationResponse* Arena::CreateMaybeMessage<::fingerprint::VerificationResponse>(Arena*); 83 | PROTOBUF_NAMESPACE_CLOSE 84 | namespace fingerprint { 85 | 86 | // =================================================================== 87 | 88 | class PreEnrolledFMD PROTOBUF_FINAL : 89 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fingerprint.PreEnrolledFMD) */ { 90 | public: 91 | inline PreEnrolledFMD() : PreEnrolledFMD(nullptr) {} 92 | virtual ~PreEnrolledFMD(); 93 | 94 | PreEnrolledFMD(const PreEnrolledFMD& from); 95 | PreEnrolledFMD(PreEnrolledFMD&& from) noexcept 96 | : PreEnrolledFMD() { 97 | *this = ::std::move(from); 98 | } 99 | 100 | inline PreEnrolledFMD& operator=(const PreEnrolledFMD& from) { 101 | CopyFrom(from); 102 | return *this; 103 | } 104 | inline PreEnrolledFMD& operator=(PreEnrolledFMD&& from) noexcept { 105 | if (GetArena() == from.GetArena()) { 106 | if (this != &from) InternalSwap(&from); 107 | } else { 108 | CopyFrom(from); 109 | } 110 | return *this; 111 | } 112 | 113 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 114 | return GetDescriptor(); 115 | } 116 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 117 | return GetMetadataStatic().descriptor; 118 | } 119 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 120 | return GetMetadataStatic().reflection; 121 | } 122 | static const PreEnrolledFMD& default_instance(); 123 | 124 | static inline const PreEnrolledFMD* internal_default_instance() { 125 | return reinterpret_cast( 126 | &_PreEnrolledFMD_default_instance_); 127 | } 128 | static constexpr int kIndexInFileMessages = 129 | 0; 130 | 131 | friend void swap(PreEnrolledFMD& a, PreEnrolledFMD& b) { 132 | a.Swap(&b); 133 | } 134 | inline void Swap(PreEnrolledFMD* other) { 135 | if (other == this) return; 136 | if (GetArena() == other->GetArena()) { 137 | InternalSwap(other); 138 | } else { 139 | ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); 140 | } 141 | } 142 | void UnsafeArenaSwap(PreEnrolledFMD* other) { 143 | if (other == this) return; 144 | GOOGLE_DCHECK(GetArena() == other->GetArena()); 145 | InternalSwap(other); 146 | } 147 | 148 | // implements Message ---------------------------------------------- 149 | 150 | inline PreEnrolledFMD* New() const final { 151 | return CreateMaybeMessage(nullptr); 152 | } 153 | 154 | PreEnrolledFMD* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 155 | return CreateMaybeMessage(arena); 156 | } 157 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 158 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 159 | void CopyFrom(const PreEnrolledFMD& from); 160 | void MergeFrom(const PreEnrolledFMD& from); 161 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 162 | bool IsInitialized() const final; 163 | 164 | size_t ByteSizeLong() const final; 165 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 166 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 167 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 168 | int GetCachedSize() const final { return _cached_size_.Get(); } 169 | 170 | private: 171 | inline void SharedCtor(); 172 | inline void SharedDtor(); 173 | void SetCachedSize(int size) const final; 174 | void InternalSwap(PreEnrolledFMD* other); 175 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 176 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 177 | return "fingerprint.PreEnrolledFMD"; 178 | } 179 | protected: 180 | explicit PreEnrolledFMD(::PROTOBUF_NAMESPACE_ID::Arena* arena); 181 | private: 182 | static void ArenaDtor(void* object); 183 | inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); 184 | public: 185 | 186 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 187 | private: 188 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 189 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_fingerprint_2eproto); 190 | return ::descriptor_table_fingerprint_2eproto.file_level_metadata[kIndexInFileMessages]; 191 | } 192 | 193 | public: 194 | 195 | // nested types ---------------------------------------------------- 196 | 197 | // accessors ------------------------------------------------------- 198 | 199 | enum : int { 200 | kBase64PreEnrolledFMDFieldNumber = 1, 201 | }; 202 | // string base64PreEnrolledFMD = 1; 203 | void clear_base64preenrolledfmd(); 204 | const std::string& base64preenrolledfmd() const; 205 | void set_base64preenrolledfmd(const std::string& value); 206 | void set_base64preenrolledfmd(std::string&& value); 207 | void set_base64preenrolledfmd(const char* value); 208 | void set_base64preenrolledfmd(const char* value, size_t size); 209 | std::string* mutable_base64preenrolledfmd(); 210 | std::string* release_base64preenrolledfmd(); 211 | void set_allocated_base64preenrolledfmd(std::string* base64preenrolledfmd); 212 | private: 213 | const std::string& _internal_base64preenrolledfmd() const; 214 | void _internal_set_base64preenrolledfmd(const std::string& value); 215 | std::string* _internal_mutable_base64preenrolledfmd(); 216 | public: 217 | 218 | // @@protoc_insertion_point(class_scope:fingerprint.PreEnrolledFMD) 219 | private: 220 | class _Internal; 221 | 222 | template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; 223 | typedef void InternalArenaConstructable_; 224 | typedef void DestructorSkippable_; 225 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr base64preenrolledfmd_; 226 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 227 | friend struct ::TableStruct_fingerprint_2eproto; 228 | }; 229 | // ------------------------------------------------------------------- 230 | 231 | class EnrolledFMD PROTOBUF_FINAL : 232 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fingerprint.EnrolledFMD) */ { 233 | public: 234 | inline EnrolledFMD() : EnrolledFMD(nullptr) {} 235 | virtual ~EnrolledFMD(); 236 | 237 | EnrolledFMD(const EnrolledFMD& from); 238 | EnrolledFMD(EnrolledFMD&& from) noexcept 239 | : EnrolledFMD() { 240 | *this = ::std::move(from); 241 | } 242 | 243 | inline EnrolledFMD& operator=(const EnrolledFMD& from) { 244 | CopyFrom(from); 245 | return *this; 246 | } 247 | inline EnrolledFMD& operator=(EnrolledFMD&& from) noexcept { 248 | if (GetArena() == from.GetArena()) { 249 | if (this != &from) InternalSwap(&from); 250 | } else { 251 | CopyFrom(from); 252 | } 253 | return *this; 254 | } 255 | 256 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 257 | return GetDescriptor(); 258 | } 259 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 260 | return GetMetadataStatic().descriptor; 261 | } 262 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 263 | return GetMetadataStatic().reflection; 264 | } 265 | static const EnrolledFMD& default_instance(); 266 | 267 | static inline const EnrolledFMD* internal_default_instance() { 268 | return reinterpret_cast( 269 | &_EnrolledFMD_default_instance_); 270 | } 271 | static constexpr int kIndexInFileMessages = 272 | 1; 273 | 274 | friend void swap(EnrolledFMD& a, EnrolledFMD& b) { 275 | a.Swap(&b); 276 | } 277 | inline void Swap(EnrolledFMD* other) { 278 | if (other == this) return; 279 | if (GetArena() == other->GetArena()) { 280 | InternalSwap(other); 281 | } else { 282 | ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); 283 | } 284 | } 285 | void UnsafeArenaSwap(EnrolledFMD* other) { 286 | if (other == this) return; 287 | GOOGLE_DCHECK(GetArena() == other->GetArena()); 288 | InternalSwap(other); 289 | } 290 | 291 | // implements Message ---------------------------------------------- 292 | 293 | inline EnrolledFMD* New() const final { 294 | return CreateMaybeMessage(nullptr); 295 | } 296 | 297 | EnrolledFMD* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 298 | return CreateMaybeMessage(arena); 299 | } 300 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 301 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 302 | void CopyFrom(const EnrolledFMD& from); 303 | void MergeFrom(const EnrolledFMD& from); 304 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 305 | bool IsInitialized() const final; 306 | 307 | size_t ByteSizeLong() const final; 308 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 309 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 310 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 311 | int GetCachedSize() const final { return _cached_size_.Get(); } 312 | 313 | private: 314 | inline void SharedCtor(); 315 | inline void SharedDtor(); 316 | void SetCachedSize(int size) const final; 317 | void InternalSwap(EnrolledFMD* other); 318 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 319 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 320 | return "fingerprint.EnrolledFMD"; 321 | } 322 | protected: 323 | explicit EnrolledFMD(::PROTOBUF_NAMESPACE_ID::Arena* arena); 324 | private: 325 | static void ArenaDtor(void* object); 326 | inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); 327 | public: 328 | 329 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 330 | private: 331 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 332 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_fingerprint_2eproto); 333 | return ::descriptor_table_fingerprint_2eproto.file_level_metadata[kIndexInFileMessages]; 334 | } 335 | 336 | public: 337 | 338 | // nested types ---------------------------------------------------- 339 | 340 | // accessors ------------------------------------------------------- 341 | 342 | enum : int { 343 | kBase64EnrolledFMDFieldNumber = 1, 344 | }; 345 | // string base64EnrolledFMD = 1; 346 | void clear_base64enrolledfmd(); 347 | const std::string& base64enrolledfmd() const; 348 | void set_base64enrolledfmd(const std::string& value); 349 | void set_base64enrolledfmd(std::string&& value); 350 | void set_base64enrolledfmd(const char* value); 351 | void set_base64enrolledfmd(const char* value, size_t size); 352 | std::string* mutable_base64enrolledfmd(); 353 | std::string* release_base64enrolledfmd(); 354 | void set_allocated_base64enrolledfmd(std::string* base64enrolledfmd); 355 | private: 356 | const std::string& _internal_base64enrolledfmd() const; 357 | void _internal_set_base64enrolledfmd(const std::string& value); 358 | std::string* _internal_mutable_base64enrolledfmd(); 359 | public: 360 | 361 | // @@protoc_insertion_point(class_scope:fingerprint.EnrolledFMD) 362 | private: 363 | class _Internal; 364 | 365 | template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; 366 | typedef void InternalArenaConstructable_; 367 | typedef void DestructorSkippable_; 368 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr base64enrolledfmd_; 369 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 370 | friend struct ::TableStruct_fingerprint_2eproto; 371 | }; 372 | // ------------------------------------------------------------------- 373 | 374 | class EnrollmentRequest PROTOBUF_FINAL : 375 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fingerprint.EnrollmentRequest) */ { 376 | public: 377 | inline EnrollmentRequest() : EnrollmentRequest(nullptr) {} 378 | virtual ~EnrollmentRequest(); 379 | 380 | EnrollmentRequest(const EnrollmentRequest& from); 381 | EnrollmentRequest(EnrollmentRequest&& from) noexcept 382 | : EnrollmentRequest() { 383 | *this = ::std::move(from); 384 | } 385 | 386 | inline EnrollmentRequest& operator=(const EnrollmentRequest& from) { 387 | CopyFrom(from); 388 | return *this; 389 | } 390 | inline EnrollmentRequest& operator=(EnrollmentRequest&& from) noexcept { 391 | if (GetArena() == from.GetArena()) { 392 | if (this != &from) InternalSwap(&from); 393 | } else { 394 | CopyFrom(from); 395 | } 396 | return *this; 397 | } 398 | 399 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 400 | return GetDescriptor(); 401 | } 402 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 403 | return GetMetadataStatic().descriptor; 404 | } 405 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 406 | return GetMetadataStatic().reflection; 407 | } 408 | static const EnrollmentRequest& default_instance(); 409 | 410 | static inline const EnrollmentRequest* internal_default_instance() { 411 | return reinterpret_cast( 412 | &_EnrollmentRequest_default_instance_); 413 | } 414 | static constexpr int kIndexInFileMessages = 415 | 2; 416 | 417 | friend void swap(EnrollmentRequest& a, EnrollmentRequest& b) { 418 | a.Swap(&b); 419 | } 420 | inline void Swap(EnrollmentRequest* other) { 421 | if (other == this) return; 422 | if (GetArena() == other->GetArena()) { 423 | InternalSwap(other); 424 | } else { 425 | ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); 426 | } 427 | } 428 | void UnsafeArenaSwap(EnrollmentRequest* other) { 429 | if (other == this) return; 430 | GOOGLE_DCHECK(GetArena() == other->GetArena()); 431 | InternalSwap(other); 432 | } 433 | 434 | // implements Message ---------------------------------------------- 435 | 436 | inline EnrollmentRequest* New() const final { 437 | return CreateMaybeMessage(nullptr); 438 | } 439 | 440 | EnrollmentRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 441 | return CreateMaybeMessage(arena); 442 | } 443 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 444 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 445 | void CopyFrom(const EnrollmentRequest& from); 446 | void MergeFrom(const EnrollmentRequest& from); 447 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 448 | bool IsInitialized() const final; 449 | 450 | size_t ByteSizeLong() const final; 451 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 452 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 453 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 454 | int GetCachedSize() const final { return _cached_size_.Get(); } 455 | 456 | private: 457 | inline void SharedCtor(); 458 | inline void SharedDtor(); 459 | void SetCachedSize(int size) const final; 460 | void InternalSwap(EnrollmentRequest* other); 461 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 462 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 463 | return "fingerprint.EnrollmentRequest"; 464 | } 465 | protected: 466 | explicit EnrollmentRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena); 467 | private: 468 | static void ArenaDtor(void* object); 469 | inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); 470 | public: 471 | 472 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 473 | private: 474 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 475 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_fingerprint_2eproto); 476 | return ::descriptor_table_fingerprint_2eproto.file_level_metadata[kIndexInFileMessages]; 477 | } 478 | 479 | public: 480 | 481 | // nested types ---------------------------------------------------- 482 | 483 | // accessors ------------------------------------------------------- 484 | 485 | enum : int { 486 | kFmdCandidatesFieldNumber = 1, 487 | }; 488 | // repeated .fingerprint.PreEnrolledFMD fmdCandidates = 1; 489 | int fmdcandidates_size() const; 490 | private: 491 | int _internal_fmdcandidates_size() const; 492 | public: 493 | void clear_fmdcandidates(); 494 | ::fingerprint::PreEnrolledFMD* mutable_fmdcandidates(int index); 495 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::PreEnrolledFMD >* 496 | mutable_fmdcandidates(); 497 | private: 498 | const ::fingerprint::PreEnrolledFMD& _internal_fmdcandidates(int index) const; 499 | ::fingerprint::PreEnrolledFMD* _internal_add_fmdcandidates(); 500 | public: 501 | const ::fingerprint::PreEnrolledFMD& fmdcandidates(int index) const; 502 | ::fingerprint::PreEnrolledFMD* add_fmdcandidates(); 503 | const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::PreEnrolledFMD >& 504 | fmdcandidates() const; 505 | 506 | // @@protoc_insertion_point(class_scope:fingerprint.EnrollmentRequest) 507 | private: 508 | class _Internal; 509 | 510 | template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; 511 | typedef void InternalArenaConstructable_; 512 | typedef void DestructorSkippable_; 513 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::PreEnrolledFMD > fmdcandidates_; 514 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 515 | friend struct ::TableStruct_fingerprint_2eproto; 516 | }; 517 | // ------------------------------------------------------------------- 518 | 519 | class VerificationRequest PROTOBUF_FINAL : 520 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fingerprint.VerificationRequest) */ { 521 | public: 522 | inline VerificationRequest() : VerificationRequest(nullptr) {} 523 | virtual ~VerificationRequest(); 524 | 525 | VerificationRequest(const VerificationRequest& from); 526 | VerificationRequest(VerificationRequest&& from) noexcept 527 | : VerificationRequest() { 528 | *this = ::std::move(from); 529 | } 530 | 531 | inline VerificationRequest& operator=(const VerificationRequest& from) { 532 | CopyFrom(from); 533 | return *this; 534 | } 535 | inline VerificationRequest& operator=(VerificationRequest&& from) noexcept { 536 | if (GetArena() == from.GetArena()) { 537 | if (this != &from) InternalSwap(&from); 538 | } else { 539 | CopyFrom(from); 540 | } 541 | return *this; 542 | } 543 | 544 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 545 | return GetDescriptor(); 546 | } 547 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 548 | return GetMetadataStatic().descriptor; 549 | } 550 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 551 | return GetMetadataStatic().reflection; 552 | } 553 | static const VerificationRequest& default_instance(); 554 | 555 | static inline const VerificationRequest* internal_default_instance() { 556 | return reinterpret_cast( 557 | &_VerificationRequest_default_instance_); 558 | } 559 | static constexpr int kIndexInFileMessages = 560 | 3; 561 | 562 | friend void swap(VerificationRequest& a, VerificationRequest& b) { 563 | a.Swap(&b); 564 | } 565 | inline void Swap(VerificationRequest* other) { 566 | if (other == this) return; 567 | if (GetArena() == other->GetArena()) { 568 | InternalSwap(other); 569 | } else { 570 | ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); 571 | } 572 | } 573 | void UnsafeArenaSwap(VerificationRequest* other) { 574 | if (other == this) return; 575 | GOOGLE_DCHECK(GetArena() == other->GetArena()); 576 | InternalSwap(other); 577 | } 578 | 579 | // implements Message ---------------------------------------------- 580 | 581 | inline VerificationRequest* New() const final { 582 | return CreateMaybeMessage(nullptr); 583 | } 584 | 585 | VerificationRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 586 | return CreateMaybeMessage(arena); 587 | } 588 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 589 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 590 | void CopyFrom(const VerificationRequest& from); 591 | void MergeFrom(const VerificationRequest& from); 592 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 593 | bool IsInitialized() const final; 594 | 595 | size_t ByteSizeLong() const final; 596 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 597 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 598 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 599 | int GetCachedSize() const final { return _cached_size_.Get(); } 600 | 601 | private: 602 | inline void SharedCtor(); 603 | inline void SharedDtor(); 604 | void SetCachedSize(int size) const final; 605 | void InternalSwap(VerificationRequest* other); 606 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 607 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 608 | return "fingerprint.VerificationRequest"; 609 | } 610 | protected: 611 | explicit VerificationRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena); 612 | private: 613 | static void ArenaDtor(void* object); 614 | inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); 615 | public: 616 | 617 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 618 | private: 619 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 620 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_fingerprint_2eproto); 621 | return ::descriptor_table_fingerprint_2eproto.file_level_metadata[kIndexInFileMessages]; 622 | } 623 | 624 | public: 625 | 626 | // nested types ---------------------------------------------------- 627 | 628 | // accessors ------------------------------------------------------- 629 | 630 | enum : int { 631 | kFmdCandidatesFieldNumber = 2, 632 | kTargetFMDFieldNumber = 1, 633 | }; 634 | // repeated .fingerprint.EnrolledFMD fmdCandidates = 2; 635 | int fmdcandidates_size() const; 636 | private: 637 | int _internal_fmdcandidates_size() const; 638 | public: 639 | void clear_fmdcandidates(); 640 | ::fingerprint::EnrolledFMD* mutable_fmdcandidates(int index); 641 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::EnrolledFMD >* 642 | mutable_fmdcandidates(); 643 | private: 644 | const ::fingerprint::EnrolledFMD& _internal_fmdcandidates(int index) const; 645 | ::fingerprint::EnrolledFMD* _internal_add_fmdcandidates(); 646 | public: 647 | const ::fingerprint::EnrolledFMD& fmdcandidates(int index) const; 648 | ::fingerprint::EnrolledFMD* add_fmdcandidates(); 649 | const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::EnrolledFMD >& 650 | fmdcandidates() const; 651 | 652 | // .fingerprint.PreEnrolledFMD targetFMD = 1; 653 | bool has_targetfmd() const; 654 | private: 655 | bool _internal_has_targetfmd() const; 656 | public: 657 | void clear_targetfmd(); 658 | const ::fingerprint::PreEnrolledFMD& targetfmd() const; 659 | ::fingerprint::PreEnrolledFMD* release_targetfmd(); 660 | ::fingerprint::PreEnrolledFMD* mutable_targetfmd(); 661 | void set_allocated_targetfmd(::fingerprint::PreEnrolledFMD* targetfmd); 662 | private: 663 | const ::fingerprint::PreEnrolledFMD& _internal_targetfmd() const; 664 | ::fingerprint::PreEnrolledFMD* _internal_mutable_targetfmd(); 665 | public: 666 | void unsafe_arena_set_allocated_targetfmd( 667 | ::fingerprint::PreEnrolledFMD* targetfmd); 668 | ::fingerprint::PreEnrolledFMD* unsafe_arena_release_targetfmd(); 669 | 670 | // @@protoc_insertion_point(class_scope:fingerprint.VerificationRequest) 671 | private: 672 | class _Internal; 673 | 674 | template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; 675 | typedef void InternalArenaConstructable_; 676 | typedef void DestructorSkippable_; 677 | ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::EnrolledFMD > fmdcandidates_; 678 | ::fingerprint::PreEnrolledFMD* targetfmd_; 679 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 680 | friend struct ::TableStruct_fingerprint_2eproto; 681 | }; 682 | // ------------------------------------------------------------------- 683 | 684 | class VerificationResponse PROTOBUF_FINAL : 685 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fingerprint.VerificationResponse) */ { 686 | public: 687 | inline VerificationResponse() : VerificationResponse(nullptr) {} 688 | virtual ~VerificationResponse(); 689 | 690 | VerificationResponse(const VerificationResponse& from); 691 | VerificationResponse(VerificationResponse&& from) noexcept 692 | : VerificationResponse() { 693 | *this = ::std::move(from); 694 | } 695 | 696 | inline VerificationResponse& operator=(const VerificationResponse& from) { 697 | CopyFrom(from); 698 | return *this; 699 | } 700 | inline VerificationResponse& operator=(VerificationResponse&& from) noexcept { 701 | if (GetArena() == from.GetArena()) { 702 | if (this != &from) InternalSwap(&from); 703 | } else { 704 | CopyFrom(from); 705 | } 706 | return *this; 707 | } 708 | 709 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 710 | return GetDescriptor(); 711 | } 712 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 713 | return GetMetadataStatic().descriptor; 714 | } 715 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 716 | return GetMetadataStatic().reflection; 717 | } 718 | static const VerificationResponse& default_instance(); 719 | 720 | static inline const VerificationResponse* internal_default_instance() { 721 | return reinterpret_cast( 722 | &_VerificationResponse_default_instance_); 723 | } 724 | static constexpr int kIndexInFileMessages = 725 | 4; 726 | 727 | friend void swap(VerificationResponse& a, VerificationResponse& b) { 728 | a.Swap(&b); 729 | } 730 | inline void Swap(VerificationResponse* other) { 731 | if (other == this) return; 732 | if (GetArena() == other->GetArena()) { 733 | InternalSwap(other); 734 | } else { 735 | ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); 736 | } 737 | } 738 | void UnsafeArenaSwap(VerificationResponse* other) { 739 | if (other == this) return; 740 | GOOGLE_DCHECK(GetArena() == other->GetArena()); 741 | InternalSwap(other); 742 | } 743 | 744 | // implements Message ---------------------------------------------- 745 | 746 | inline VerificationResponse* New() const final { 747 | return CreateMaybeMessage(nullptr); 748 | } 749 | 750 | VerificationResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 751 | return CreateMaybeMessage(arena); 752 | } 753 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 754 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 755 | void CopyFrom(const VerificationResponse& from); 756 | void MergeFrom(const VerificationResponse& from); 757 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 758 | bool IsInitialized() const final; 759 | 760 | size_t ByteSizeLong() const final; 761 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 762 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 763 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 764 | int GetCachedSize() const final { return _cached_size_.Get(); } 765 | 766 | private: 767 | inline void SharedCtor(); 768 | inline void SharedDtor(); 769 | void SetCachedSize(int size) const final; 770 | void InternalSwap(VerificationResponse* other); 771 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 772 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 773 | return "fingerprint.VerificationResponse"; 774 | } 775 | protected: 776 | explicit VerificationResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena); 777 | private: 778 | static void ArenaDtor(void* object); 779 | inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); 780 | public: 781 | 782 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 783 | private: 784 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 785 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_fingerprint_2eproto); 786 | return ::descriptor_table_fingerprint_2eproto.file_level_metadata[kIndexInFileMessages]; 787 | } 788 | 789 | public: 790 | 791 | // nested types ---------------------------------------------------- 792 | 793 | // accessors ------------------------------------------------------- 794 | 795 | enum : int { 796 | kMatchFieldNumber = 1, 797 | }; 798 | // bool match = 1; 799 | void clear_match(); 800 | bool match() const; 801 | void set_match(bool value); 802 | private: 803 | bool _internal_match() const; 804 | void _internal_set_match(bool value); 805 | public: 806 | 807 | // @@protoc_insertion_point(class_scope:fingerprint.VerificationResponse) 808 | private: 809 | class _Internal; 810 | 811 | template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; 812 | typedef void InternalArenaConstructable_; 813 | typedef void DestructorSkippable_; 814 | bool match_; 815 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 816 | friend struct ::TableStruct_fingerprint_2eproto; 817 | }; 818 | // ------------------------------------------------------------------- 819 | 820 | class CheckDuplicateResponse PROTOBUF_FINAL : 821 | public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fingerprint.CheckDuplicateResponse) */ { 822 | public: 823 | inline CheckDuplicateResponse() : CheckDuplicateResponse(nullptr) {} 824 | virtual ~CheckDuplicateResponse(); 825 | 826 | CheckDuplicateResponse(const CheckDuplicateResponse& from); 827 | CheckDuplicateResponse(CheckDuplicateResponse&& from) noexcept 828 | : CheckDuplicateResponse() { 829 | *this = ::std::move(from); 830 | } 831 | 832 | inline CheckDuplicateResponse& operator=(const CheckDuplicateResponse& from) { 833 | CopyFrom(from); 834 | return *this; 835 | } 836 | inline CheckDuplicateResponse& operator=(CheckDuplicateResponse&& from) noexcept { 837 | if (GetArena() == from.GetArena()) { 838 | if (this != &from) InternalSwap(&from); 839 | } else { 840 | CopyFrom(from); 841 | } 842 | return *this; 843 | } 844 | 845 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { 846 | return GetDescriptor(); 847 | } 848 | static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { 849 | return GetMetadataStatic().descriptor; 850 | } 851 | static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { 852 | return GetMetadataStatic().reflection; 853 | } 854 | static const CheckDuplicateResponse& default_instance(); 855 | 856 | static inline const CheckDuplicateResponse* internal_default_instance() { 857 | return reinterpret_cast( 858 | &_CheckDuplicateResponse_default_instance_); 859 | } 860 | static constexpr int kIndexInFileMessages = 861 | 5; 862 | 863 | friend void swap(CheckDuplicateResponse& a, CheckDuplicateResponse& b) { 864 | a.Swap(&b); 865 | } 866 | inline void Swap(CheckDuplicateResponse* other) { 867 | if (other == this) return; 868 | if (GetArena() == other->GetArena()) { 869 | InternalSwap(other); 870 | } else { 871 | ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); 872 | } 873 | } 874 | void UnsafeArenaSwap(CheckDuplicateResponse* other) { 875 | if (other == this) return; 876 | GOOGLE_DCHECK(GetArena() == other->GetArena()); 877 | InternalSwap(other); 878 | } 879 | 880 | // implements Message ---------------------------------------------- 881 | 882 | inline CheckDuplicateResponse* New() const final { 883 | return CreateMaybeMessage(nullptr); 884 | } 885 | 886 | CheckDuplicateResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { 887 | return CreateMaybeMessage(arena); 888 | } 889 | void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 890 | void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; 891 | void CopyFrom(const CheckDuplicateResponse& from); 892 | void MergeFrom(const CheckDuplicateResponse& from); 893 | PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; 894 | bool IsInitialized() const final; 895 | 896 | size_t ByteSizeLong() const final; 897 | const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; 898 | ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( 899 | ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; 900 | int GetCachedSize() const final { return _cached_size_.Get(); } 901 | 902 | private: 903 | inline void SharedCtor(); 904 | inline void SharedDtor(); 905 | void SetCachedSize(int size) const final; 906 | void InternalSwap(CheckDuplicateResponse* other); 907 | friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; 908 | static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { 909 | return "fingerprint.CheckDuplicateResponse"; 910 | } 911 | protected: 912 | explicit CheckDuplicateResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena); 913 | private: 914 | static void ArenaDtor(void* object); 915 | inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); 916 | public: 917 | 918 | ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; 919 | private: 920 | static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { 921 | ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_fingerprint_2eproto); 922 | return ::descriptor_table_fingerprint_2eproto.file_level_metadata[kIndexInFileMessages]; 923 | } 924 | 925 | public: 926 | 927 | // nested types ---------------------------------------------------- 928 | 929 | // accessors ------------------------------------------------------- 930 | 931 | enum : int { 932 | kIsDuplicateFieldNumber = 1, 933 | }; 934 | // bool isDuplicate = 1; 935 | void clear_isduplicate(); 936 | bool isduplicate() const; 937 | void set_isduplicate(bool value); 938 | private: 939 | bool _internal_isduplicate() const; 940 | void _internal_set_isduplicate(bool value); 941 | public: 942 | 943 | // @@protoc_insertion_point(class_scope:fingerprint.CheckDuplicateResponse) 944 | private: 945 | class _Internal; 946 | 947 | template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; 948 | typedef void InternalArenaConstructable_; 949 | typedef void DestructorSkippable_; 950 | bool isduplicate_; 951 | mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; 952 | friend struct ::TableStruct_fingerprint_2eproto; 953 | }; 954 | // =================================================================== 955 | 956 | 957 | // =================================================================== 958 | 959 | #ifdef __GNUC__ 960 | #pragma GCC diagnostic push 961 | #pragma GCC diagnostic ignored "-Wstrict-aliasing" 962 | #endif // __GNUC__ 963 | // PreEnrolledFMD 964 | 965 | // string base64PreEnrolledFMD = 1; 966 | inline void PreEnrolledFMD::clear_base64preenrolledfmd() { 967 | base64preenrolledfmd_.ClearToEmpty(); 968 | } 969 | inline const std::string& PreEnrolledFMD::base64preenrolledfmd() const { 970 | // @@protoc_insertion_point(field_get:fingerprint.PreEnrolledFMD.base64PreEnrolledFMD) 971 | return _internal_base64preenrolledfmd(); 972 | } 973 | inline void PreEnrolledFMD::set_base64preenrolledfmd(const std::string& value) { 974 | _internal_set_base64preenrolledfmd(value); 975 | // @@protoc_insertion_point(field_set:fingerprint.PreEnrolledFMD.base64PreEnrolledFMD) 976 | } 977 | inline std::string* PreEnrolledFMD::mutable_base64preenrolledfmd() { 978 | // @@protoc_insertion_point(field_mutable:fingerprint.PreEnrolledFMD.base64PreEnrolledFMD) 979 | return _internal_mutable_base64preenrolledfmd(); 980 | } 981 | inline const std::string& PreEnrolledFMD::_internal_base64preenrolledfmd() const { 982 | return base64preenrolledfmd_.Get(); 983 | } 984 | inline void PreEnrolledFMD::_internal_set_base64preenrolledfmd(const std::string& value) { 985 | 986 | base64preenrolledfmd_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena()); 987 | } 988 | inline void PreEnrolledFMD::set_base64preenrolledfmd(std::string&& value) { 989 | 990 | base64preenrolledfmd_.Set( 991 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena()); 992 | // @@protoc_insertion_point(field_set_rvalue:fingerprint.PreEnrolledFMD.base64PreEnrolledFMD) 993 | } 994 | inline void PreEnrolledFMD::set_base64preenrolledfmd(const char* value) { 995 | GOOGLE_DCHECK(value != nullptr); 996 | 997 | base64preenrolledfmd_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena()); 998 | // @@protoc_insertion_point(field_set_char:fingerprint.PreEnrolledFMD.base64PreEnrolledFMD) 999 | } 1000 | inline void PreEnrolledFMD::set_base64preenrolledfmd(const char* value, 1001 | size_t size) { 1002 | 1003 | base64preenrolledfmd_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string( 1004 | reinterpret_cast(value), size), GetArena()); 1005 | // @@protoc_insertion_point(field_set_pointer:fingerprint.PreEnrolledFMD.base64PreEnrolledFMD) 1006 | } 1007 | inline std::string* PreEnrolledFMD::_internal_mutable_base64preenrolledfmd() { 1008 | 1009 | return base64preenrolledfmd_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena()); 1010 | } 1011 | inline std::string* PreEnrolledFMD::release_base64preenrolledfmd() { 1012 | // @@protoc_insertion_point(field_release:fingerprint.PreEnrolledFMD.base64PreEnrolledFMD) 1013 | return base64preenrolledfmd_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); 1014 | } 1015 | inline void PreEnrolledFMD::set_allocated_base64preenrolledfmd(std::string* base64preenrolledfmd) { 1016 | if (base64preenrolledfmd != nullptr) { 1017 | 1018 | } else { 1019 | 1020 | } 1021 | base64preenrolledfmd_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), base64preenrolledfmd, 1022 | GetArena()); 1023 | // @@protoc_insertion_point(field_set_allocated:fingerprint.PreEnrolledFMD.base64PreEnrolledFMD) 1024 | } 1025 | 1026 | // ------------------------------------------------------------------- 1027 | 1028 | // EnrolledFMD 1029 | 1030 | // string base64EnrolledFMD = 1; 1031 | inline void EnrolledFMD::clear_base64enrolledfmd() { 1032 | base64enrolledfmd_.ClearToEmpty(); 1033 | } 1034 | inline const std::string& EnrolledFMD::base64enrolledfmd() const { 1035 | // @@protoc_insertion_point(field_get:fingerprint.EnrolledFMD.base64EnrolledFMD) 1036 | return _internal_base64enrolledfmd(); 1037 | } 1038 | inline void EnrolledFMD::set_base64enrolledfmd(const std::string& value) { 1039 | _internal_set_base64enrolledfmd(value); 1040 | // @@protoc_insertion_point(field_set:fingerprint.EnrolledFMD.base64EnrolledFMD) 1041 | } 1042 | inline std::string* EnrolledFMD::mutable_base64enrolledfmd() { 1043 | // @@protoc_insertion_point(field_mutable:fingerprint.EnrolledFMD.base64EnrolledFMD) 1044 | return _internal_mutable_base64enrolledfmd(); 1045 | } 1046 | inline const std::string& EnrolledFMD::_internal_base64enrolledfmd() const { 1047 | return base64enrolledfmd_.Get(); 1048 | } 1049 | inline void EnrolledFMD::_internal_set_base64enrolledfmd(const std::string& value) { 1050 | 1051 | base64enrolledfmd_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena()); 1052 | } 1053 | inline void EnrolledFMD::set_base64enrolledfmd(std::string&& value) { 1054 | 1055 | base64enrolledfmd_.Set( 1056 | ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::move(value), GetArena()); 1057 | // @@protoc_insertion_point(field_set_rvalue:fingerprint.EnrolledFMD.base64EnrolledFMD) 1058 | } 1059 | inline void EnrolledFMD::set_base64enrolledfmd(const char* value) { 1060 | GOOGLE_DCHECK(value != nullptr); 1061 | 1062 | base64enrolledfmd_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string(value), GetArena()); 1063 | // @@protoc_insertion_point(field_set_char:fingerprint.EnrolledFMD.base64EnrolledFMD) 1064 | } 1065 | inline void EnrolledFMD::set_base64enrolledfmd(const char* value, 1066 | size_t size) { 1067 | 1068 | base64enrolledfmd_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, ::std::string( 1069 | reinterpret_cast(value), size), GetArena()); 1070 | // @@protoc_insertion_point(field_set_pointer:fingerprint.EnrolledFMD.base64EnrolledFMD) 1071 | } 1072 | inline std::string* EnrolledFMD::_internal_mutable_base64enrolledfmd() { 1073 | 1074 | return base64enrolledfmd_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena()); 1075 | } 1076 | inline std::string* EnrolledFMD::release_base64enrolledfmd() { 1077 | // @@protoc_insertion_point(field_release:fingerprint.EnrolledFMD.base64EnrolledFMD) 1078 | return base64enrolledfmd_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena()); 1079 | } 1080 | inline void EnrolledFMD::set_allocated_base64enrolledfmd(std::string* base64enrolledfmd) { 1081 | if (base64enrolledfmd != nullptr) { 1082 | 1083 | } else { 1084 | 1085 | } 1086 | base64enrolledfmd_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), base64enrolledfmd, 1087 | GetArena()); 1088 | // @@protoc_insertion_point(field_set_allocated:fingerprint.EnrolledFMD.base64EnrolledFMD) 1089 | } 1090 | 1091 | // ------------------------------------------------------------------- 1092 | 1093 | // EnrollmentRequest 1094 | 1095 | // repeated .fingerprint.PreEnrolledFMD fmdCandidates = 1; 1096 | inline int EnrollmentRequest::_internal_fmdcandidates_size() const { 1097 | return fmdcandidates_.size(); 1098 | } 1099 | inline int EnrollmentRequest::fmdcandidates_size() const { 1100 | return _internal_fmdcandidates_size(); 1101 | } 1102 | inline void EnrollmentRequest::clear_fmdcandidates() { 1103 | fmdcandidates_.Clear(); 1104 | } 1105 | inline ::fingerprint::PreEnrolledFMD* EnrollmentRequest::mutable_fmdcandidates(int index) { 1106 | // @@protoc_insertion_point(field_mutable:fingerprint.EnrollmentRequest.fmdCandidates) 1107 | return fmdcandidates_.Mutable(index); 1108 | } 1109 | inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::PreEnrolledFMD >* 1110 | EnrollmentRequest::mutable_fmdcandidates() { 1111 | // @@protoc_insertion_point(field_mutable_list:fingerprint.EnrollmentRequest.fmdCandidates) 1112 | return &fmdcandidates_; 1113 | } 1114 | inline const ::fingerprint::PreEnrolledFMD& EnrollmentRequest::_internal_fmdcandidates(int index) const { 1115 | return fmdcandidates_.Get(index); 1116 | } 1117 | inline const ::fingerprint::PreEnrolledFMD& EnrollmentRequest::fmdcandidates(int index) const { 1118 | // @@protoc_insertion_point(field_get:fingerprint.EnrollmentRequest.fmdCandidates) 1119 | return _internal_fmdcandidates(index); 1120 | } 1121 | inline ::fingerprint::PreEnrolledFMD* EnrollmentRequest::_internal_add_fmdcandidates() { 1122 | return fmdcandidates_.Add(); 1123 | } 1124 | inline ::fingerprint::PreEnrolledFMD* EnrollmentRequest::add_fmdcandidates() { 1125 | // @@protoc_insertion_point(field_add:fingerprint.EnrollmentRequest.fmdCandidates) 1126 | return _internal_add_fmdcandidates(); 1127 | } 1128 | inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::PreEnrolledFMD >& 1129 | EnrollmentRequest::fmdcandidates() const { 1130 | // @@protoc_insertion_point(field_list:fingerprint.EnrollmentRequest.fmdCandidates) 1131 | return fmdcandidates_; 1132 | } 1133 | 1134 | // ------------------------------------------------------------------- 1135 | 1136 | // VerificationRequest 1137 | 1138 | // .fingerprint.PreEnrolledFMD targetFMD = 1; 1139 | inline bool VerificationRequest::_internal_has_targetfmd() const { 1140 | return this != internal_default_instance() && targetfmd_ != nullptr; 1141 | } 1142 | inline bool VerificationRequest::has_targetfmd() const { 1143 | return _internal_has_targetfmd(); 1144 | } 1145 | inline void VerificationRequest::clear_targetfmd() { 1146 | if (GetArena() == nullptr && targetfmd_ != nullptr) { 1147 | delete targetfmd_; 1148 | } 1149 | targetfmd_ = nullptr; 1150 | } 1151 | inline const ::fingerprint::PreEnrolledFMD& VerificationRequest::_internal_targetfmd() const { 1152 | const ::fingerprint::PreEnrolledFMD* p = targetfmd_; 1153 | return p != nullptr ? *p : reinterpret_cast( 1154 | ::fingerprint::_PreEnrolledFMD_default_instance_); 1155 | } 1156 | inline const ::fingerprint::PreEnrolledFMD& VerificationRequest::targetfmd() const { 1157 | // @@protoc_insertion_point(field_get:fingerprint.VerificationRequest.targetFMD) 1158 | return _internal_targetfmd(); 1159 | } 1160 | inline void VerificationRequest::unsafe_arena_set_allocated_targetfmd( 1161 | ::fingerprint::PreEnrolledFMD* targetfmd) { 1162 | if (GetArena() == nullptr) { 1163 | delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(targetfmd_); 1164 | } 1165 | targetfmd_ = targetfmd; 1166 | if (targetfmd) { 1167 | 1168 | } else { 1169 | 1170 | } 1171 | // @@protoc_insertion_point(field_unsafe_arena_set_allocated:fingerprint.VerificationRequest.targetFMD) 1172 | } 1173 | inline ::fingerprint::PreEnrolledFMD* VerificationRequest::release_targetfmd() { 1174 | 1175 | ::fingerprint::PreEnrolledFMD* temp = targetfmd_; 1176 | targetfmd_ = nullptr; 1177 | if (GetArena() != nullptr) { 1178 | temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); 1179 | } 1180 | return temp; 1181 | } 1182 | inline ::fingerprint::PreEnrolledFMD* VerificationRequest::unsafe_arena_release_targetfmd() { 1183 | // @@protoc_insertion_point(field_release:fingerprint.VerificationRequest.targetFMD) 1184 | 1185 | ::fingerprint::PreEnrolledFMD* temp = targetfmd_; 1186 | targetfmd_ = nullptr; 1187 | return temp; 1188 | } 1189 | inline ::fingerprint::PreEnrolledFMD* VerificationRequest::_internal_mutable_targetfmd() { 1190 | 1191 | if (targetfmd_ == nullptr) { 1192 | auto* p = CreateMaybeMessage<::fingerprint::PreEnrolledFMD>(GetArena()); 1193 | targetfmd_ = p; 1194 | } 1195 | return targetfmd_; 1196 | } 1197 | inline ::fingerprint::PreEnrolledFMD* VerificationRequest::mutable_targetfmd() { 1198 | // @@protoc_insertion_point(field_mutable:fingerprint.VerificationRequest.targetFMD) 1199 | return _internal_mutable_targetfmd(); 1200 | } 1201 | inline void VerificationRequest::set_allocated_targetfmd(::fingerprint::PreEnrolledFMD* targetfmd) { 1202 | ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena(); 1203 | if (message_arena == nullptr) { 1204 | delete targetfmd_; 1205 | } 1206 | if (targetfmd) { 1207 | ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = 1208 | ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(targetfmd); 1209 | if (message_arena != submessage_arena) { 1210 | targetfmd = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( 1211 | message_arena, targetfmd, submessage_arena); 1212 | } 1213 | 1214 | } else { 1215 | 1216 | } 1217 | targetfmd_ = targetfmd; 1218 | // @@protoc_insertion_point(field_set_allocated:fingerprint.VerificationRequest.targetFMD) 1219 | } 1220 | 1221 | // repeated .fingerprint.EnrolledFMD fmdCandidates = 2; 1222 | inline int VerificationRequest::_internal_fmdcandidates_size() const { 1223 | return fmdcandidates_.size(); 1224 | } 1225 | inline int VerificationRequest::fmdcandidates_size() const { 1226 | return _internal_fmdcandidates_size(); 1227 | } 1228 | inline void VerificationRequest::clear_fmdcandidates() { 1229 | fmdcandidates_.Clear(); 1230 | } 1231 | inline ::fingerprint::EnrolledFMD* VerificationRequest::mutable_fmdcandidates(int index) { 1232 | // @@protoc_insertion_point(field_mutable:fingerprint.VerificationRequest.fmdCandidates) 1233 | return fmdcandidates_.Mutable(index); 1234 | } 1235 | inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::EnrolledFMD >* 1236 | VerificationRequest::mutable_fmdcandidates() { 1237 | // @@protoc_insertion_point(field_mutable_list:fingerprint.VerificationRequest.fmdCandidates) 1238 | return &fmdcandidates_; 1239 | } 1240 | inline const ::fingerprint::EnrolledFMD& VerificationRequest::_internal_fmdcandidates(int index) const { 1241 | return fmdcandidates_.Get(index); 1242 | } 1243 | inline const ::fingerprint::EnrolledFMD& VerificationRequest::fmdcandidates(int index) const { 1244 | // @@protoc_insertion_point(field_get:fingerprint.VerificationRequest.fmdCandidates) 1245 | return _internal_fmdcandidates(index); 1246 | } 1247 | inline ::fingerprint::EnrolledFMD* VerificationRequest::_internal_add_fmdcandidates() { 1248 | return fmdcandidates_.Add(); 1249 | } 1250 | inline ::fingerprint::EnrolledFMD* VerificationRequest::add_fmdcandidates() { 1251 | // @@protoc_insertion_point(field_add:fingerprint.VerificationRequest.fmdCandidates) 1252 | return _internal_add_fmdcandidates(); 1253 | } 1254 | inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::fingerprint::EnrolledFMD >& 1255 | VerificationRequest::fmdcandidates() const { 1256 | // @@protoc_insertion_point(field_list:fingerprint.VerificationRequest.fmdCandidates) 1257 | return fmdcandidates_; 1258 | } 1259 | 1260 | // ------------------------------------------------------------------- 1261 | 1262 | // VerificationResponse 1263 | 1264 | // bool match = 1; 1265 | inline void VerificationResponse::clear_match() { 1266 | match_ = false; 1267 | } 1268 | inline bool VerificationResponse::_internal_match() const { 1269 | return match_; 1270 | } 1271 | inline bool VerificationResponse::match() const { 1272 | // @@protoc_insertion_point(field_get:fingerprint.VerificationResponse.match) 1273 | return _internal_match(); 1274 | } 1275 | inline void VerificationResponse::_internal_set_match(bool value) { 1276 | 1277 | match_ = value; 1278 | } 1279 | inline void VerificationResponse::set_match(bool value) { 1280 | _internal_set_match(value); 1281 | // @@protoc_insertion_point(field_set:fingerprint.VerificationResponse.match) 1282 | } 1283 | 1284 | // ------------------------------------------------------------------- 1285 | 1286 | // CheckDuplicateResponse 1287 | 1288 | // bool isDuplicate = 1; 1289 | inline void CheckDuplicateResponse::clear_isduplicate() { 1290 | isduplicate_ = false; 1291 | } 1292 | inline bool CheckDuplicateResponse::_internal_isduplicate() const { 1293 | return isduplicate_; 1294 | } 1295 | inline bool CheckDuplicateResponse::isduplicate() const { 1296 | // @@protoc_insertion_point(field_get:fingerprint.CheckDuplicateResponse.isDuplicate) 1297 | return _internal_isduplicate(); 1298 | } 1299 | inline void CheckDuplicateResponse::_internal_set_isduplicate(bool value) { 1300 | 1301 | isduplicate_ = value; 1302 | } 1303 | inline void CheckDuplicateResponse::set_isduplicate(bool value) { 1304 | _internal_set_isduplicate(value); 1305 | // @@protoc_insertion_point(field_set:fingerprint.CheckDuplicateResponse.isDuplicate) 1306 | } 1307 | 1308 | #ifdef __GNUC__ 1309 | #pragma GCC diagnostic pop 1310 | #endif // __GNUC__ 1311 | // ------------------------------------------------------------------- 1312 | 1313 | // ------------------------------------------------------------------- 1314 | 1315 | // ------------------------------------------------------------------- 1316 | 1317 | // ------------------------------------------------------------------- 1318 | 1319 | // ------------------------------------------------------------------- 1320 | 1321 | 1322 | // @@protoc_insertion_point(namespace_scope) 1323 | 1324 | } // namespace fingerprint 1325 | 1326 | // @@protoc_insertion_point(global_scope) 1327 | 1328 | #include 1329 | #endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_fingerprint_2eproto 1330 | -------------------------------------------------------------------------------- /src/cpp/fingerprint_client.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alhytham-tech/grpc-fingerprint-engine/3ae83f91e3894ef57beab4f5d8f0c3cc8d8c4d8a/src/cpp/fingerprint_client.cc -------------------------------------------------------------------------------- /src/cpp/fingerprint_server.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * -=-<[ Bismillahirrahmanirrahim ]>-=- 3 | * Date : 2021-01-23 10:39:01 4 | * Author : Dahir Muhammad Dahir (dahirmuhammad3@gmail.com) 5 | * About : Compile with g++ 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | // DigitalPersona Includes 15 | #include "dpfj.h" 16 | 17 | // Base64 Includes 18 | #include "base64.h" 19 | 20 | // gRPC Includes 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "helper.h" 27 | #include "fingerprint.grpc.pb.h" 28 | 29 | #define MY_MAX_FMD_SIZE 2000 30 | #define MAX_PORT "65535" 31 | #define DEFAULT_PORT "4134" // DMD :) 32 | 33 | using grpc::Server; 34 | using grpc::ServerBuilder; 35 | using grpc::ServerContext; 36 | using grpc::Status; 37 | 38 | using fingerprint::PreEnrolledFMD; 39 | using fingerprint::EnrolledFMD; 40 | using fingerprint::EnrollmentRequest; 41 | 42 | using fingerprint::VerificationRequest; 43 | using fingerprint::VerificationResponse; 44 | 45 | using fingerprint::CheckDuplicateResponse; 46 | using fingerprint::FingerPrint; 47 | 48 | using std::vector; 49 | using std::string; 50 | using std::cout; 51 | using std::getenv; 52 | using std::endl; 53 | using std::unique_ptr; 54 | using std::map; 55 | 56 | typedef unsigned char MyFMD; 57 | typedef unsigned int MyFMDSize; 58 | 59 | class FingerPrintImpl final : public FingerPrint::Service { 60 | private: 61 | unsigned int threshold_score = DPFJ_PROBABILITY_ONE / 1000000; 62 | 63 | public: 64 | Status EnrollFingerprint(ServerContext* context, const EnrollmentRequest* enrollmentRequest, EnrolledFMD* enrolledFMD) { 65 | //pass 66 | enrolledFMD->set_base64enrolledfmd(createEnrollment(enrollmentRequest)->base64enrolledfmd()); 67 | return Status::OK; 68 | } 69 | 70 | EnrolledFMD* createEnrollment(const EnrollmentRequest* enrollmentRequest){ 71 | 72 | vector pre_reg_fmd_cont = {}; //container for decoded preregistered FMDs 73 | 74 | for (PreEnrolledFMD pre_enrolled_fmd: enrollmentRequest->fmdcandidates()) { 75 | /* 76 | Decode the received base64 encoded pre_registered FMDs 77 | and store them in a container 78 | */ 79 | string decoded_pre_reg_fmd = base64_decode(pre_enrolled_fmd.base64preenrolledfmd()); 80 | pre_reg_fmd_cont.push_back(decoded_pre_reg_fmd); 81 | 82 | } 83 | 84 | int start_enrollment_process = dpfj_start_enrollment(DPFJ_FMD_DP_REG_FEATURES); 85 | 86 | if (start_enrollment_process == DPFJ_SUCCESS) { 87 | cout << "enrollment process started successfully" << endl; 88 | 89 | for (string pre_reg_fmd: pre_reg_fmd_cont) { 90 | 91 | MyFMD* pre_reg_fmd_ptr = (MyFMD*) pre_reg_fmd.c_str(); 92 | 93 | int enrollment_add_pre_reg_fmd = dpfj_add_to_enrollment( 94 | DPFJ_FMD_DP_PRE_REG_FEATURES, 95 | pre_reg_fmd_ptr, 96 | pre_reg_fmd.size(), 0 97 | ); 98 | 99 | if (enrollment_add_pre_reg_fmd == DPFJ_E_MORE_DATA) { 100 | cout << "adding more pre_registered fmd for enrollment..." << endl; 101 | continue; 102 | } 103 | 104 | else if (enrollment_add_pre_reg_fmd == DPFJ_SUCCESS) { 105 | cout << "pre_reg fmds added, ready for enrollment..." << endl; 106 | 107 | MyFMD reg_fmd[MY_MAX_FMD_SIZE]; 108 | unsigned int fmd_size = MY_MAX_FMD_SIZE; 109 | 110 | int enrollment_result = dpfj_create_enrollment_fmd(reg_fmd, &fmd_size); 111 | 112 | EnrolledFMD* enrolled_fmd = new EnrolledFMD(); 113 | 114 | if (enrollment_result == DPFJ_SUCCESS) { 115 | cout << "enrollment successful..." << endl; 116 | string enrolled_fmd_ptr(reinterpret_cast(reg_fmd), fmd_size); 117 | string encoded_fmd = base64_encode(enrolled_fmd_ptr); 118 | 119 | enrolled_fmd->set_base64enrolledfmd(encoded_fmd); 120 | dpfj_finish_enrollment(); 121 | return enrolled_fmd; 122 | } 123 | 124 | else if (enrollment_result == DPFJ_E_MORE_DATA) { 125 | cout << "insufficient memory in create_enrollment_fmd()..." << endl; 126 | dpfj_finish_enrollment(); 127 | return enrolled_fmd; 128 | } 129 | 130 | else { 131 | cout << "Unknown error occurred in create_enrollment_fmd()..." << endl; 132 | dpfj_finish_enrollment(); 133 | return enrolled_fmd; 134 | } 135 | 136 | } 137 | 138 | else if (enrollment_add_pre_reg_fmd == DPFJ_E_INVALID_PARAMETER) { 139 | cout << "one or more parameters are invalid, during add_enrollment()..." << endl; 140 | continue; 141 | } 142 | 143 | else { 144 | cout << "Unknown error occurred during add_enrollment()..." << endl; 145 | dpfj_finish_enrollment(); 146 | break; 147 | } 148 | 149 | } 150 | } 151 | else { 152 | cout << "failed to start enrollment..." << endl; 153 | dpfj_finish_enrollment(); 154 | } 155 | 156 | return new EnrolledFMD(); 157 | } 158 | 159 | Status VerifyFingerprint(ServerContext* context, const VerificationRequest* verification_request, VerificationResponse* verification_response) { 160 | //pass 161 | verification_response->set_match(makeVerification(verification_request)->match()); 162 | return Status::OK; 163 | } 164 | 165 | VerificationResponse* makeVerification(const VerificationRequest* verification_request){ 166 | 167 | string target_pre_fmd = base64_decode(verification_request->targetfmd().base64preenrolledfmd()); 168 | MyFMD* target_pre_fmd_ptr = (MyFMD* ) target_pre_fmd.c_str(); 169 | 170 | map target_verify_fmd_map = convert_fmd(DPFJ_FMD_DP_PRE_REG_FEATURES, DPFJ_FMD_DP_VER_FEATURES, target_pre_fmd_ptr, (MyFMDSize ) target_pre_fmd.size()); 171 | 172 | map::iterator target_verify_fmd_map_it = target_verify_fmd_map.begin(); 173 | 174 | MyFMD* target_verify_fmd_ptr = target_verify_fmd_map_it->first; 175 | MyFMDSize* target_verify_fmd_size = target_verify_fmd_map_it->second; 176 | 177 | int candidates_count = verification_request->fmdcandidates_size(); 178 | 179 | string candidates_container[candidates_count]; 180 | MyFMD* candidates_pointers_container[candidates_count]; 181 | MyFMDSize candidates_size_container[candidates_count]; 182 | 183 | DPFJ_CANDIDATE matched_candidates_container[1]; 184 | MyFMDSize expected_matches_count = 1; 185 | 186 | int counter = 0; 187 | 188 | for (EnrolledFMD enrolled_candidate: verification_request->fmdcandidates()) { 189 | 190 | string candidate_reg_fmd = base64_decode(enrolled_candidate.base64enrolledfmd()); 191 | candidates_container[counter] = candidate_reg_fmd; 192 | candidates_size_container[counter] = candidate_reg_fmd.size(); 193 | candidates_pointers_container[counter] = (MyFMD* ) candidates_container[counter].c_str(); 194 | counter++; 195 | 196 | } 197 | 198 | int identify_result = dpfj_identify(DPFJ_FMD_DP_VER_FEATURES, target_verify_fmd_ptr, *target_verify_fmd_size, 0, DPFJ_FMD_DP_REG_FEATURES, candidates_count, candidates_pointers_container, candidates_size_container, threshold_score, &expected_matches_count, matched_candidates_container); 199 | 200 | VerificationResponse* verification_response = new VerificationResponse(); 201 | verification_response->set_match(false); 202 | 203 | if (identify_result == DPFJ_SUCCESS && expected_matches_count > 0) { 204 | cout << expected_matches_count << " match found..." << endl; 205 | verification_response->set_match(true); 206 | return verification_response; 207 | } 208 | 209 | else { 210 | cout << "No match found..." << endl; 211 | return verification_response; 212 | } 213 | } 214 | 215 | Status CheckDuplicate(ServerContext* context, const VerificationRequest* verification_request, CheckDuplicateResponse* check_duplicate_response) { 216 | if (!makeVerification(verification_request)->match()) { 217 | check_duplicate_response->set_isduplicate(false); 218 | } 219 | 220 | else{ 221 | check_duplicate_response->set_isduplicate(true); 222 | } 223 | 224 | return Status::OK; 225 | 226 | } 227 | 228 | map convert_fmd(DPFJ_FMD_FORMAT input_fmd_formt, DPFJ_FMD_FORMAT output_fmd_format, MyFMD* input_fmd, MyFMDSize input_fmd_size) { 229 | 230 | MyFMD output_fmd[MY_MAX_FMD_SIZE]; // will hold the output fmd 231 | MyFMDSize output_fmd_size; // will hold the original size of the output fmd 232 | 233 | int conversion_result = dpfj_fmd_convert(input_fmd_formt, input_fmd, input_fmd_size, output_fmd_format, output_fmd, &output_fmd_size); 234 | 235 | map converted_fmd_result; 236 | 237 | if (conversion_result == DPFJ_SUCCESS) { 238 | cout << "FMD coverted successfully..." << endl; 239 | converted_fmd_result[output_fmd] = &output_fmd_size; 240 | 241 | return converted_fmd_result; 242 | } 243 | 244 | cout << "Unknown error..." << endl; 245 | return converted_fmd_result; 246 | 247 | } 248 | }; 249 | 250 | 251 | void RunServer() { 252 | const char * port = getenv("PORT"); 253 | string server_address("0.0.0.0:"); 254 | if (port && strlen(port) <= strlen(MAX_PORT)) { 255 | string user_port(port); 256 | server_address.append(port); 257 | } 258 | else { 259 | server_address.append(DEFAULT_PORT); 260 | } 261 | 262 | FingerPrintImpl service; 263 | 264 | ServerBuilder builder; 265 | builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); 266 | builder.RegisterService(&service); 267 | 268 | unique_ptr server(builder.BuildAndStart()); 269 | cout << "Server started, listening on " << server_address << endl; 270 | server->Wait(); 271 | } 272 | 273 | int main() { 274 | RunServer(); 275 | } -------------------------------------------------------------------------------- /src/cpp/helper.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alhytham-tech/grpc-fingerprint-engine/3ae83f91e3894ef57beab4f5d8f0c3cc8d8c4d8a/src/cpp/helper.cpp -------------------------------------------------------------------------------- /src/cpp/helper.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alhytham-tech/grpc-fingerprint-engine/3ae83f91e3894ef57beab4f5d8f0c3cc8d8c4d8a/src/cpp/helper.h -------------------------------------------------------------------------------- /src/php/Fingerprint/CheckDuplicateResponse.php: -------------------------------------------------------------------------------- 1 | fingerprint.CheckDuplicateResponse 13 | */ 14 | class CheckDuplicateResponse extends \Google\Protobuf\Internal\Message 15 | { 16 | /** 17 | * Generated from protobuf field bool isDuplicate = 1; 18 | */ 19 | protected $isDuplicate = false; 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param array $data { 25 | * Optional. Data for populating the Message object. 26 | * 27 | * @type bool $isDuplicate 28 | * } 29 | */ 30 | public function __construct($data = NULL) { 31 | \GPBMetadata\Fingerprint::initOnce(); 32 | parent::__construct($data); 33 | } 34 | 35 | /** 36 | * Generated from protobuf field bool isDuplicate = 1; 37 | * @return bool 38 | */ 39 | public function getIsDuplicate() 40 | { 41 | return $this->isDuplicate; 42 | } 43 | 44 | /** 45 | * Generated from protobuf field bool isDuplicate = 1; 46 | * @param bool $var 47 | * @return $this 48 | */ 49 | public function setIsDuplicate($var) 50 | { 51 | GPBUtil::checkBool($var); 52 | $this->isDuplicate = $var; 53 | 54 | return $this; 55 | } 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/php/Fingerprint/EnrolledFMD.php: -------------------------------------------------------------------------------- 1 | fingerprint.EnrolledFMD 13 | */ 14 | class EnrolledFMD extends \Google\Protobuf\Internal\Message 15 | { 16 | /** 17 | * Generated from protobuf field string base64EnrolledFMD = 1; 18 | */ 19 | protected $base64EnrolledFMD = ''; 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param array $data { 25 | * Optional. Data for populating the Message object. 26 | * 27 | * @type string $base64EnrolledFMD 28 | * } 29 | */ 30 | public function __construct($data = NULL) { 31 | \GPBMetadata\Fingerprint::initOnce(); 32 | parent::__construct($data); 33 | } 34 | 35 | /** 36 | * Generated from protobuf field string base64EnrolledFMD = 1; 37 | * @return string 38 | */ 39 | public function getBase64EnrolledFMD() 40 | { 41 | return $this->base64EnrolledFMD; 42 | } 43 | 44 | /** 45 | * Generated from protobuf field string base64EnrolledFMD = 1; 46 | * @param string $var 47 | * @return $this 48 | */ 49 | public function setBase64EnrolledFMD($var) 50 | { 51 | GPBUtil::checkString($var, True); 52 | $this->base64EnrolledFMD = $var; 53 | 54 | return $this; 55 | } 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/php/Fingerprint/EnrollmentRequest.php: -------------------------------------------------------------------------------- 1 | fingerprint.EnrollmentRequest 13 | */ 14 | class EnrollmentRequest extends \Google\Protobuf\Internal\Message 15 | { 16 | /** 17 | * Generated from protobuf field repeated .fingerprint.PreEnrolledFMD fmdCandidates = 1; 18 | */ 19 | private $fmdCandidates; 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param array $data { 25 | * Optional. Data for populating the Message object. 26 | * 27 | * @type \Fingerprint\PreEnrolledFMD[]|\Google\Protobuf\Internal\RepeatedField $fmdCandidates 28 | * } 29 | */ 30 | public function __construct($data = NULL) { 31 | \GPBMetadata\Fingerprint::initOnce(); 32 | parent::__construct($data); 33 | } 34 | 35 | /** 36 | * Generated from protobuf field repeated .fingerprint.PreEnrolledFMD fmdCandidates = 1; 37 | * @return \Google\Protobuf\Internal\RepeatedField 38 | */ 39 | public function getFmdCandidates() 40 | { 41 | return $this->fmdCandidates; 42 | } 43 | 44 | /** 45 | * Generated from protobuf field repeated .fingerprint.PreEnrolledFMD fmdCandidates = 1; 46 | * @param \Fingerprint\PreEnrolledFMD[]|\Google\Protobuf\Internal\RepeatedField $var 47 | * @return $this 48 | */ 49 | public function setFmdCandidates($var) 50 | { 51 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Fingerprint\PreEnrolledFMD::class); 52 | $this->fmdCandidates = $arr; 53 | 54 | return $this; 55 | } 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/php/Fingerprint/FingerPrintClient.php: -------------------------------------------------------------------------------- 1 | _simpleRequest('/fingerprint.FingerPrint/EnrollFingerprint', 37 | $argument, 38 | ['\Fingerprint\EnrolledFMD', 'decode'], 39 | $metadata, $options); 40 | } 41 | 42 | /** 43 | * @param \Fingerprint\VerificationRequest $argument input argument 44 | * @param array $metadata metadata 45 | * @param array $options call options 46 | * @return \Grpc\UnaryCall 47 | */ 48 | public function VerifyFingerprint(\Fingerprint\VerificationRequest $argument, 49 | $metadata = [], $options = []) { 50 | return $this->_simpleRequest('/fingerprint.FingerPrint/VerifyFingerprint', 51 | $argument, 52 | ['\Fingerprint\VerificationResponse', 'decode'], 53 | $metadata, $options); 54 | } 55 | 56 | /** 57 | * @param \Fingerprint\VerificationRequest $argument input argument 58 | * @param array $metadata metadata 59 | * @param array $options call options 60 | * @return \Grpc\UnaryCall 61 | */ 62 | public function CheckDuplicate(\Fingerprint\VerificationRequest $argument, 63 | $metadata = [], $options = []) { 64 | return $this->_simpleRequest('/fingerprint.FingerPrint/CheckDuplicate', 65 | $argument, 66 | ['\Fingerprint\CheckDuplicateResponse', 'decode'], 67 | $metadata, $options); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/php/Fingerprint/PreEnrolledFMD.php: -------------------------------------------------------------------------------- 1 | fingerprint.PreEnrolledFMD 13 | */ 14 | class PreEnrolledFMD extends \Google\Protobuf\Internal\Message 15 | { 16 | /** 17 | * Generated from protobuf field string base64PreEnrolledFMD = 1; 18 | */ 19 | protected $base64PreEnrolledFMD = ''; 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param array $data { 25 | * Optional. Data for populating the Message object. 26 | * 27 | * @type string $base64PreEnrolledFMD 28 | * } 29 | */ 30 | public function __construct($data = NULL) { 31 | \GPBMetadata\Fingerprint::initOnce(); 32 | parent::__construct($data); 33 | } 34 | 35 | /** 36 | * Generated from protobuf field string base64PreEnrolledFMD = 1; 37 | * @return string 38 | */ 39 | public function getBase64PreEnrolledFMD() 40 | { 41 | return $this->base64PreEnrolledFMD; 42 | } 43 | 44 | /** 45 | * Generated from protobuf field string base64PreEnrolledFMD = 1; 46 | * @param string $var 47 | * @return $this 48 | */ 49 | public function setBase64PreEnrolledFMD($var) 50 | { 51 | GPBUtil::checkString($var, True); 52 | $this->base64PreEnrolledFMD = $var; 53 | 54 | return $this; 55 | } 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/php/Fingerprint/VerificationRequest.php: -------------------------------------------------------------------------------- 1 | fingerprint.VerificationRequest 13 | */ 14 | class VerificationRequest extends \Google\Protobuf\Internal\Message 15 | { 16 | /** 17 | * Generated from protobuf field .fingerprint.PreEnrolledFMD targetFMD = 1; 18 | */ 19 | protected $targetFMD = null; 20 | /** 21 | * Generated from protobuf field repeated .fingerprint.EnrolledFMD fmdCandidates = 2; 22 | */ 23 | private $fmdCandidates; 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param array $data { 29 | * Optional. Data for populating the Message object. 30 | * 31 | * @type \Fingerprint\PreEnrolledFMD $targetFMD 32 | * @type \Fingerprint\EnrolledFMD[]|\Google\Protobuf\Internal\RepeatedField $fmdCandidates 33 | * } 34 | */ 35 | public function __construct($data = NULL) { 36 | \GPBMetadata\Fingerprint::initOnce(); 37 | parent::__construct($data); 38 | } 39 | 40 | /** 41 | * Generated from protobuf field .fingerprint.PreEnrolledFMD targetFMD = 1; 42 | * @return \Fingerprint\PreEnrolledFMD 43 | */ 44 | public function getTargetFMD() 45 | { 46 | return isset($this->targetFMD) ? $this->targetFMD : null; 47 | } 48 | 49 | public function hasTargetFMD() 50 | { 51 | return isset($this->targetFMD); 52 | } 53 | 54 | public function clearTargetFMD() 55 | { 56 | unset($this->targetFMD); 57 | } 58 | 59 | /** 60 | * Generated from protobuf field .fingerprint.PreEnrolledFMD targetFMD = 1; 61 | * @param \Fingerprint\PreEnrolledFMD $var 62 | * @return $this 63 | */ 64 | public function setTargetFMD($var) 65 | { 66 | GPBUtil::checkMessage($var, \Fingerprint\PreEnrolledFMD::class); 67 | $this->targetFMD = $var; 68 | 69 | return $this; 70 | } 71 | 72 | /** 73 | * Generated from protobuf field repeated .fingerprint.EnrolledFMD fmdCandidates = 2; 74 | * @return \Google\Protobuf\Internal\RepeatedField 75 | */ 76 | public function getFmdCandidates() 77 | { 78 | return $this->fmdCandidates; 79 | } 80 | 81 | /** 82 | * Generated from protobuf field repeated .fingerprint.EnrolledFMD fmdCandidates = 2; 83 | * @param \Fingerprint\EnrolledFMD[]|\Google\Protobuf\Internal\RepeatedField $var 84 | * @return $this 85 | */ 86 | public function setFmdCandidates($var) 87 | { 88 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Fingerprint\EnrolledFMD::class); 89 | $this->fmdCandidates = $arr; 90 | 91 | return $this; 92 | } 93 | 94 | } 95 | 96 | -------------------------------------------------------------------------------- /src/php/Fingerprint/VerificationResponse.php: -------------------------------------------------------------------------------- 1 | fingerprint.VerificationResponse 13 | */ 14 | class VerificationResponse extends \Google\Protobuf\Internal\Message 15 | { 16 | /** 17 | * Generated from protobuf field bool match = 1; 18 | */ 19 | protected $match = false; 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param array $data { 25 | * Optional. Data for populating the Message object. 26 | * 27 | * @type bool $match 28 | * } 29 | */ 30 | public function __construct($data = NULL) { 31 | \GPBMetadata\Fingerprint::initOnce(); 32 | parent::__construct($data); 33 | } 34 | 35 | /** 36 | * Generated from protobuf field bool match = 1; 37 | * @return bool 38 | */ 39 | public function getMatch() 40 | { 41 | return $this->match; 42 | } 43 | 44 | /** 45 | * Generated from protobuf field bool match = 1; 46 | * @param bool $var 47 | * @return $this 48 | */ 49 | public function setMatch($var) 50 | { 51 | GPBUtil::checkBool($var); 52 | $this->match = $var; 53 | 54 | return $this; 55 | } 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/php/GPBMetadata/Fingerprint.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alhytham-tech/grpc-fingerprint-engine/3ae83f91e3894ef57beab4f5d8f0c3cc8d8c4d8a/src/php/GPBMetadata/Fingerprint.php -------------------------------------------------------------------------------- /src/php/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bexils/grpc-fingerprint-engine", 3 | "description": "digital persona fingerprint engine grpc implementation", 4 | "type": "project", 5 | "authors": [ 6 | { 7 | "name": "Ethic41", 8 | "email": "dahirmuhammad3@gmail.com" 9 | } 10 | ], 11 | "require": { 12 | "grpc/grpc": "v1.35.0", 13 | "google/protobuf": "^v3.14.0" 14 | }, 15 | 16 | "autoload": { 17 | "psr-4": { 18 | "Fingerprint\\": "Fingerprint/", 19 | "GPBMetadata\\": "GPBMetadata/" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/php/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "4de117e2587497a0fc44ceaa13c9d8de", 8 | "packages": [ 9 | { 10 | "name": "google/protobuf", 11 | "version": "v3.15.0", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/protocolbuffers/protobuf-php.git", 15 | "reference": "758a0ef01c7bdf20d7ff31295d2af872547cc072" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/758a0ef01c7bdf20d7ff31295d2af872547cc072", 20 | "reference": "758a0ef01c7bdf20d7ff31295d2af872547cc072", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">=5.5.0" 25 | }, 26 | "require-dev": { 27 | "phpunit/phpunit": ">=4.8.0" 28 | }, 29 | "suggest": { 30 | "ext-bcmath": "Need to support JSON deserialization" 31 | }, 32 | "type": "library", 33 | "autoload": { 34 | "psr-4": { 35 | "Google\\Protobuf\\": "src/Google/Protobuf", 36 | "GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf" 37 | } 38 | }, 39 | "notification-url": "https://packagist.org/downloads/", 40 | "license": [ 41 | "BSD-3-Clause" 42 | ], 43 | "description": "proto library for PHP", 44 | "homepage": "https://developers.google.com/protocol-buffers/", 45 | "keywords": [ 46 | "proto" 47 | ], 48 | "support": { 49 | "issues": "https://github.com/protocolbuffers/protobuf-php/issues", 50 | "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.15.0" 51 | }, 52 | "time": "2021-02-18T22:06:03+00:00" 53 | }, 54 | { 55 | "name": "grpc/grpc", 56 | "version": "1.35.0", 57 | "source": { 58 | "type": "git", 59 | "url": "https://github.com/grpc/grpc-php.git", 60 | "reference": "cf75367acfcf154331f97d1525f9f46383b7891d" 61 | }, 62 | "dist": { 63 | "type": "zip", 64 | "url": "https://api.github.com/repos/grpc/grpc-php/zipball/cf75367acfcf154331f97d1525f9f46383b7891d", 65 | "reference": "cf75367acfcf154331f97d1525f9f46383b7891d", 66 | "shasum": "" 67 | }, 68 | "require": { 69 | "php": ">=7.0.0" 70 | }, 71 | "require-dev": { 72 | "google/auth": "^v1.3.0" 73 | }, 74 | "suggest": { 75 | "ext-protobuf": "For better performance, install the protobuf C extension.", 76 | "google/protobuf": "To get started using grpc quickly, install the native protobuf library." 77 | }, 78 | "type": "library", 79 | "autoload": { 80 | "psr-4": { 81 | "Grpc\\": "src/lib/" 82 | } 83 | }, 84 | "notification-url": "https://packagist.org/downloads/", 85 | "license": [ 86 | "Apache-2.0" 87 | ], 88 | "description": "gRPC library for PHP", 89 | "homepage": "https://grpc.io", 90 | "keywords": [ 91 | "rpc" 92 | ], 93 | "support": { 94 | "source": "https://github.com/grpc/grpc-php/tree/v1.35.0" 95 | }, 96 | "time": "2021-01-20T20:15:34+00:00" 97 | } 98 | ], 99 | "packages-dev": [], 100 | "aliases": [], 101 | "minimum-stability": "stable", 102 | "stability-flags": [], 103 | "prefer-stable": false, 104 | "prefer-lowest": false, 105 | "platform": [], 106 | "platform-dev": [], 107 | "plugin-api-version": "2.2.0" 108 | } 109 | -------------------------------------------------------------------------------- /src/php/fingerprint_client.php: -------------------------------------------------------------------------------- 1 | -=- 4 | * @authors Dahir Muhammad Dahir 5 | * @date 2021-02-21 14:35:40 6 | * 7 | */ 8 | 9 | /* this is just a sample script to show how to 10 | interface with the generated client code, 11 | your implementation ultimately depends on your needs 12 | */ 13 | 14 | require_once(__DIR__ . "/" . "./vendor/autoload.php"); 15 | 16 | $fmd1 = ""; 17 | $fmd2 = ""; 18 | $fmd3 = ""; 19 | $fmd4 = ""; 20 | 21 | $reg_fmd1 = ""; 22 | $reg_fmd2 = ""; 23 | 24 | $pre_reg_fmd_list = array($fmd1, $fmd2, $fmd3, $fmd4); 25 | $reg_fmd_list = array($reg_fmd1, $reg_fmd2); 26 | 27 | 28 | $client = new Fingerprint\FingerPrintClient("localhost:4134", [ 29 | "credentials" => Grpc\ChannelCredentials::createInsecure(), 30 | ]); 31 | 32 | 33 | function enroll_fingerprint() { 34 | $enrollment_request = new Fingerprint\EnrollmentRequest(); 35 | 36 | $pre_enrolled_fmds = array(); 37 | 38 | global $pre_reg_fmd_list; 39 | global $client; 40 | 41 | foreach($pre_reg_fmd_list as $pre_reg_fmd) { 42 | $pre_enrollment_fmd = new Fingerprint\PreEnrolledFMD(); 43 | $pre_enrollment_fmd->setBase64PreEnrolledFMD($pre_reg_fmd); 44 | array_push($pre_enrolled_fmds, $pre_enrollment_fmd); 45 | } 46 | 47 | $enrollment_request->setFmdCandidates($pre_enrolled_fmds); 48 | 49 | list($enrolled_fmd, $status) = $client->EnrollFingerprint($enrollment_request)->wait(); 50 | 51 | if ($status->code === Grpc\STATUS_OK) { 52 | echo $enrolled_fmd->getBase64EnrolledFMD(); 53 | } 54 | else { 55 | echo "Error: " . $status->code . " " . $status->details ; 56 | } 57 | } 58 | 59 | function verify_fingerprint() { 60 | $pre_enrolled_fmd = new Fingerprint\PreEnrolledFMD(); 61 | global $fmd1; 62 | global $reg_fmd1; 63 | global $client; 64 | $pre_enrolled_fmd->setBase64PreEnrolledFMD($fmd1); 65 | 66 | $enrolled_cand_fmd = new Fingerprint\EnrolledFMD(); 67 | $enrolled_cand_fmd->setBase64EnrolledFMD($reg_fmd1); 68 | 69 | $verification_request = new Fingerprint\VerificationRequest(array("targetFMD" => $pre_enrolled_fmd)); 70 | //$verification_request->setTargetFMD($pre_enrolled_fmd); 71 | $verification_request->setFmdCandidates(array($enrolled_cand_fmd)); 72 | 73 | list($verification_response, $status) = $client->VerifyFingerprint($verification_request)->wait(); 74 | 75 | if ($status->code === Grpc\STATUS_OK) { 76 | echo $verification_response->getMatch(); 77 | } 78 | else { 79 | echo "Error: " . $status->code . " " . $status->details ; 80 | } 81 | } 82 | 83 | function check_duplicate($client) { 84 | global $fmd2; 85 | global $reg_fmd_list; 86 | $pre_enrolled_fmd = new Fingerprint\PreEnrolledFMD(array("base64PreEnrolledFMD" => $fmd2)); 87 | $verification_request = new Fingerprint\VerificationRequest(array("targetFMD" => $pre_enrolled_fmd)); 88 | 89 | $enrolled_fmds = array(); 90 | 91 | foreach($reg_fmd_list as $reg_fmd) { 92 | array_push($enrolled_fmds, new Fingerprint\EnrolledFMD(array("base64EnrolledFMD" => $reg_fmd))); 93 | } 94 | 95 | $verification_request->setFmdCandidates($enrolled_fmds); 96 | 97 | list($response, $status) = $client->CheckDuplicate($verification_request)->wait(); 98 | echo $response->getIsDuplicate(); 99 | } 100 | 101 | //enroll_fingerprint(); 102 | //verify_fingerprint(); 103 | check_duplicate($client); 104 | -------------------------------------------------------------------------------- /src/protos/fingerprint.proto: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Bismillahirrahmanirraheem 4 | Author: Dahir Muhammad Dahir 5 | Date: 22-01-2021 02:47 PM 6 | About: I will tell you later 7 | 8 | */ 9 | 10 | syntax = "proto3"; 11 | 12 | package fingerprint; 13 | 14 | service FingerPrint { 15 | 16 | rpc EnrollFingerprint(EnrollmentRequest) returns (EnrolledFMD) {}; 17 | 18 | rpc VerifyFingerprint(VerificationRequest) returns (VerificationResponse) {}; 19 | 20 | rpc CheckDuplicate(VerificationRequest) returns (CheckDuplicateResponse); 21 | 22 | } 23 | 24 | message PreEnrolledFMD { 25 | string base64PreEnrolledFMD = 1; 26 | } 27 | 28 | message EnrolledFMD { 29 | string base64EnrolledFMD = 1; 30 | } 31 | 32 | message EnrollmentRequest { 33 | repeated PreEnrolledFMD fmdCandidates = 1; 34 | } 35 | 36 | message VerificationRequest { 37 | PreEnrolledFMD targetFMD = 1; 38 | repeated EnrolledFMD fmdCandidates = 2; 39 | } 40 | 41 | message VerificationResponse { 42 | bool match = 1; 43 | } 44 | 45 | message CheckDuplicateResponse { 46 | bool isDuplicate = 1; 47 | } 48 | -------------------------------------------------------------------------------- /src/python/__pycache__/fingerprint_pb2.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alhytham-tech/grpc-fingerprint-engine/3ae83f91e3894ef57beab4f5d8f0c3cc8d8c4d8a/src/python/__pycache__/fingerprint_pb2.cpython-37.pyc -------------------------------------------------------------------------------- /src/python/__pycache__/fingerprint_pb2_grpc.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alhytham-tech/grpc-fingerprint-engine/3ae83f91e3894ef57beab4f5d8f0c3cc8d8c4d8a/src/python/__pycache__/fingerprint_pb2_grpc.cpython-37.pyc -------------------------------------------------------------------------------- /src/python/fingerprint_client.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -=-<[ Bismillahirrahmanirrahim ]>-=- 3 | # -*- coding: utf-8 -*- 4 | # @Date : 2021-02-07 16:32:54 5 | # @Author : Dahir Muhammad Dahir (dahirmuhammad3@gmail.com) 6 | # @Link : thelightfinder.blogspot.com 7 | # @Version : 0.0.1 8 | 9 | import grpc 10 | 11 | import fingerprint_pb2 as fp_pb2 12 | import fingerprint_pb2_grpc as fp_pb2_grpc 13 | from fingerprint_pb2 import (EnrolledFMD, EnrollmentRequest, VerificationRequest, VerificationResponse, PreEnrolledFMD,) 14 | 15 | """ 16 | usage notes: add url base64 encoded fmds for testing purpose below, 17 | but in real code you will be getting the fmds from some source 18 | which could be the frontend of your webapp or any source 19 | """ 20 | fmd1 = "" # todo: add a pre_enrolled fmd1 for a finger 21 | fmd2 = "" # todo: add another pre_enrolled for the same finger 22 | fmd3 = "" # todo: add another pre_enrolled for the same finger 23 | fmd4 = "" # todo: add another pre_enrolled for the same finger 24 | 25 | fmd5 = "" # todo: add a finger enrolled fmd here 26 | fmd6 = "" # todo: add a different finger erolled fmd here 27 | 28 | fmds_list = [fmd1, fmd2, fmd3, fmd4] 29 | reg_fmd_list = [fmd5, fmd6] 30 | 31 | def main(): 32 | # testing on localhost 33 | with grpc.insecure_channel("localhost:4134") as channel: 34 | stub = fp_pb2_grpc.FingerPrintStub(channel) 35 | enroll_fingerprint(stub) 36 | verify_fingerprint(stub) 37 | check_duplicate_fingerprint(stub) 38 | 39 | 40 | def enroll_fingerprint(stub): 41 | enrollment_request = EnrollmentRequest() 42 | 43 | for fmd in fmds_list: 44 | pre_enrollment_fmd = PreEnrolledFMD() 45 | pre_enrollment_fmd.base64PreEnrolledFMD = fmd 46 | enrollment_request.fmdCandidates.append(pre_enrollment_fmd) 47 | 48 | enrolled_fmd = stub.EnrollFingerprint(enrollment_request) 49 | 50 | print(enrolled_fmd.base64EnrolledFMD) 51 | 52 | 53 | def verify_fingerprint(stub): 54 | 55 | pre_enrolled_fmd = PreEnrolledFMD() 56 | pre_enrolled_fmd.base64PreEnrolledFMD = fmd1 57 | 58 | enrolled_candidate_fmd = EnrolledFMD(base64EnrolledFMD=fmd5) 59 | 60 | verification_request = VerificationRequest(targetFMD=pre_enrolled_fmd) 61 | 62 | verification_request.fmdCandidates.append(enrolled_candidate_fmd) 63 | 64 | verification_response = stub.VerifyFingerprint(verification_request) 65 | 66 | print(verification_response.match) 67 | 68 | 69 | def check_duplicate_fingerprint(stub): 70 | pre_enrolled_fmd = PreEnrolledFMD(base64PreEnrolledFMD=fmd2) 71 | 72 | verification_request = VerificationRequest(targetFMD=pre_enrolled_fmd) 73 | 74 | for reg_fmd in reg_fmd_list: 75 | verification_request.fmdCandidates.append(EnrolledFMD(base64EnrolledFMD=reg_fmd)) 76 | 77 | check_duplicate_response = stub.CheckDuplicate(verification_request) 78 | 79 | print(check_duplicate_response.isDuplicate) 80 | 81 | 82 | if __name__ == "__main__": 83 | main() 84 | -------------------------------------------------------------------------------- /src/python/fingerprint_pb2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by the protocol buffer compiler. DO NOT EDIT! 3 | # source: fingerprint.proto 4 | """Generated protocol buffer code.""" 5 | from google.protobuf import descriptor as _descriptor 6 | from google.protobuf import message as _message 7 | from google.protobuf import reflection as _reflection 8 | from google.protobuf import symbol_database as _symbol_database 9 | # @@protoc_insertion_point(imports) 10 | 11 | _sym_db = _symbol_database.Default() 12 | 13 | 14 | 15 | 16 | DESCRIPTOR = _descriptor.FileDescriptor( 17 | name='fingerprint.proto', 18 | package='fingerprint', 19 | syntax='proto3', 20 | serialized_options=None, 21 | create_key=_descriptor._internal_create_key, 22 | serialized_pb=b'\n\x11\x66ingerprint.proto\x12\x0b\x66ingerprint\".\n\x0ePreEnrolledFMD\x12\x1c\n\x14\x62\x61se64PreEnrolledFMD\x18\x01 \x01(\t\"(\n\x0b\x45nrolledFMD\x12\x19\n\x11\x62\x61se64EnrolledFMD\x18\x01 \x01(\t\"G\n\x11\x45nrollmentRequest\x12\x32\n\rfmdCandidates\x18\x01 \x03(\x0b\x32\x1b.fingerprint.PreEnrolledFMD\"v\n\x13VerificationRequest\x12.\n\ttargetFMD\x18\x01 \x01(\x0b\x32\x1b.fingerprint.PreEnrolledFMD\x12/\n\rfmdCandidates\x18\x02 \x03(\x0b\x32\x18.fingerprint.EnrolledFMD\"%\n\x14VerificationResponse\x12\r\n\x05match\x18\x01 \x01(\x08\"-\n\x16\x43heckDuplicateResponse\x12\x13\n\x0bisDuplicate\x18\x01 \x01(\x08\x32\x93\x02\n\x0b\x46ingerPrint\x12O\n\x11\x45nrollFingerprint\x12\x1e.fingerprint.EnrollmentRequest\x1a\x18.fingerprint.EnrolledFMD\"\x00\x12Z\n\x11VerifyFingerprint\x12 .fingerprint.VerificationRequest\x1a!.fingerprint.VerificationResponse\"\x00\x12W\n\x0e\x43heckDuplicate\x12 .fingerprint.VerificationRequest\x1a#.fingerprint.CheckDuplicateResponseb\x06proto3' 23 | ) 24 | 25 | 26 | 27 | 28 | _PREENROLLEDFMD = _descriptor.Descriptor( 29 | name='PreEnrolledFMD', 30 | full_name='fingerprint.PreEnrolledFMD', 31 | filename=None, 32 | file=DESCRIPTOR, 33 | containing_type=None, 34 | create_key=_descriptor._internal_create_key, 35 | fields=[ 36 | _descriptor.FieldDescriptor( 37 | name='base64PreEnrolledFMD', full_name='fingerprint.PreEnrolledFMD.base64PreEnrolledFMD', index=0, 38 | number=1, type=9, cpp_type=9, label=1, 39 | has_default_value=False, default_value=b"".decode('utf-8'), 40 | message_type=None, enum_type=None, containing_type=None, 41 | is_extension=False, extension_scope=None, 42 | serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), 43 | ], 44 | extensions=[ 45 | ], 46 | nested_types=[], 47 | enum_types=[ 48 | ], 49 | serialized_options=None, 50 | is_extendable=False, 51 | syntax='proto3', 52 | extension_ranges=[], 53 | oneofs=[ 54 | ], 55 | serialized_start=34, 56 | serialized_end=80, 57 | ) 58 | 59 | 60 | _ENROLLEDFMD = _descriptor.Descriptor( 61 | name='EnrolledFMD', 62 | full_name='fingerprint.EnrolledFMD', 63 | filename=None, 64 | file=DESCRIPTOR, 65 | containing_type=None, 66 | create_key=_descriptor._internal_create_key, 67 | fields=[ 68 | _descriptor.FieldDescriptor( 69 | name='base64EnrolledFMD', full_name='fingerprint.EnrolledFMD.base64EnrolledFMD', index=0, 70 | number=1, type=9, cpp_type=9, label=1, 71 | has_default_value=False, default_value=b"".decode('utf-8'), 72 | message_type=None, enum_type=None, containing_type=None, 73 | is_extension=False, extension_scope=None, 74 | serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), 75 | ], 76 | extensions=[ 77 | ], 78 | nested_types=[], 79 | enum_types=[ 80 | ], 81 | serialized_options=None, 82 | is_extendable=False, 83 | syntax='proto3', 84 | extension_ranges=[], 85 | oneofs=[ 86 | ], 87 | serialized_start=82, 88 | serialized_end=122, 89 | ) 90 | 91 | 92 | _ENROLLMENTREQUEST = _descriptor.Descriptor( 93 | name='EnrollmentRequest', 94 | full_name='fingerprint.EnrollmentRequest', 95 | filename=None, 96 | file=DESCRIPTOR, 97 | containing_type=None, 98 | create_key=_descriptor._internal_create_key, 99 | fields=[ 100 | _descriptor.FieldDescriptor( 101 | name='fmdCandidates', full_name='fingerprint.EnrollmentRequest.fmdCandidates', index=0, 102 | number=1, type=11, cpp_type=10, label=3, 103 | has_default_value=False, default_value=[], 104 | message_type=None, enum_type=None, containing_type=None, 105 | is_extension=False, extension_scope=None, 106 | serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), 107 | ], 108 | extensions=[ 109 | ], 110 | nested_types=[], 111 | enum_types=[ 112 | ], 113 | serialized_options=None, 114 | is_extendable=False, 115 | syntax='proto3', 116 | extension_ranges=[], 117 | oneofs=[ 118 | ], 119 | serialized_start=124, 120 | serialized_end=195, 121 | ) 122 | 123 | 124 | _VERIFICATIONREQUEST = _descriptor.Descriptor( 125 | name='VerificationRequest', 126 | full_name='fingerprint.VerificationRequest', 127 | filename=None, 128 | file=DESCRIPTOR, 129 | containing_type=None, 130 | create_key=_descriptor._internal_create_key, 131 | fields=[ 132 | _descriptor.FieldDescriptor( 133 | name='targetFMD', full_name='fingerprint.VerificationRequest.targetFMD', index=0, 134 | number=1, type=11, cpp_type=10, label=1, 135 | has_default_value=False, default_value=None, 136 | message_type=None, enum_type=None, containing_type=None, 137 | is_extension=False, extension_scope=None, 138 | serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), 139 | _descriptor.FieldDescriptor( 140 | name='fmdCandidates', full_name='fingerprint.VerificationRequest.fmdCandidates', index=1, 141 | number=2, type=11, cpp_type=10, label=3, 142 | has_default_value=False, default_value=[], 143 | message_type=None, enum_type=None, containing_type=None, 144 | is_extension=False, extension_scope=None, 145 | serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), 146 | ], 147 | extensions=[ 148 | ], 149 | nested_types=[], 150 | enum_types=[ 151 | ], 152 | serialized_options=None, 153 | is_extendable=False, 154 | syntax='proto3', 155 | extension_ranges=[], 156 | oneofs=[ 157 | ], 158 | serialized_start=197, 159 | serialized_end=315, 160 | ) 161 | 162 | 163 | _VERIFICATIONRESPONSE = _descriptor.Descriptor( 164 | name='VerificationResponse', 165 | full_name='fingerprint.VerificationResponse', 166 | filename=None, 167 | file=DESCRIPTOR, 168 | containing_type=None, 169 | create_key=_descriptor._internal_create_key, 170 | fields=[ 171 | _descriptor.FieldDescriptor( 172 | name='match', full_name='fingerprint.VerificationResponse.match', index=0, 173 | number=1, type=8, cpp_type=7, label=1, 174 | has_default_value=False, default_value=False, 175 | message_type=None, enum_type=None, containing_type=None, 176 | is_extension=False, extension_scope=None, 177 | serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), 178 | ], 179 | extensions=[ 180 | ], 181 | nested_types=[], 182 | enum_types=[ 183 | ], 184 | serialized_options=None, 185 | is_extendable=False, 186 | syntax='proto3', 187 | extension_ranges=[], 188 | oneofs=[ 189 | ], 190 | serialized_start=317, 191 | serialized_end=354, 192 | ) 193 | 194 | 195 | _CHECKDUPLICATERESPONSE = _descriptor.Descriptor( 196 | name='CheckDuplicateResponse', 197 | full_name='fingerprint.CheckDuplicateResponse', 198 | filename=None, 199 | file=DESCRIPTOR, 200 | containing_type=None, 201 | create_key=_descriptor._internal_create_key, 202 | fields=[ 203 | _descriptor.FieldDescriptor( 204 | name='isDuplicate', full_name='fingerprint.CheckDuplicateResponse.isDuplicate', index=0, 205 | number=1, type=8, cpp_type=7, label=1, 206 | has_default_value=False, default_value=False, 207 | message_type=None, enum_type=None, containing_type=None, 208 | is_extension=False, extension_scope=None, 209 | serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), 210 | ], 211 | extensions=[ 212 | ], 213 | nested_types=[], 214 | enum_types=[ 215 | ], 216 | serialized_options=None, 217 | is_extendable=False, 218 | syntax='proto3', 219 | extension_ranges=[], 220 | oneofs=[ 221 | ], 222 | serialized_start=356, 223 | serialized_end=401, 224 | ) 225 | 226 | _ENROLLMENTREQUEST.fields_by_name['fmdCandidates'].message_type = _PREENROLLEDFMD 227 | _VERIFICATIONREQUEST.fields_by_name['targetFMD'].message_type = _PREENROLLEDFMD 228 | _VERIFICATIONREQUEST.fields_by_name['fmdCandidates'].message_type = _ENROLLEDFMD 229 | DESCRIPTOR.message_types_by_name['PreEnrolledFMD'] = _PREENROLLEDFMD 230 | DESCRIPTOR.message_types_by_name['EnrolledFMD'] = _ENROLLEDFMD 231 | DESCRIPTOR.message_types_by_name['EnrollmentRequest'] = _ENROLLMENTREQUEST 232 | DESCRIPTOR.message_types_by_name['VerificationRequest'] = _VERIFICATIONREQUEST 233 | DESCRIPTOR.message_types_by_name['VerificationResponse'] = _VERIFICATIONRESPONSE 234 | DESCRIPTOR.message_types_by_name['CheckDuplicateResponse'] = _CHECKDUPLICATERESPONSE 235 | _sym_db.RegisterFileDescriptor(DESCRIPTOR) 236 | 237 | PreEnrolledFMD = _reflection.GeneratedProtocolMessageType('PreEnrolledFMD', (_message.Message,), { 238 | 'DESCRIPTOR' : _PREENROLLEDFMD, 239 | '__module__' : 'fingerprint_pb2' 240 | # @@protoc_insertion_point(class_scope:fingerprint.PreEnrolledFMD) 241 | }) 242 | _sym_db.RegisterMessage(PreEnrolledFMD) 243 | 244 | EnrolledFMD = _reflection.GeneratedProtocolMessageType('EnrolledFMD', (_message.Message,), { 245 | 'DESCRIPTOR' : _ENROLLEDFMD, 246 | '__module__' : 'fingerprint_pb2' 247 | # @@protoc_insertion_point(class_scope:fingerprint.EnrolledFMD) 248 | }) 249 | _sym_db.RegisterMessage(EnrolledFMD) 250 | 251 | EnrollmentRequest = _reflection.GeneratedProtocolMessageType('EnrollmentRequest', (_message.Message,), { 252 | 'DESCRIPTOR' : _ENROLLMENTREQUEST, 253 | '__module__' : 'fingerprint_pb2' 254 | # @@protoc_insertion_point(class_scope:fingerprint.EnrollmentRequest) 255 | }) 256 | _sym_db.RegisterMessage(EnrollmentRequest) 257 | 258 | VerificationRequest = _reflection.GeneratedProtocolMessageType('VerificationRequest', (_message.Message,), { 259 | 'DESCRIPTOR' : _VERIFICATIONREQUEST, 260 | '__module__' : 'fingerprint_pb2' 261 | # @@protoc_insertion_point(class_scope:fingerprint.VerificationRequest) 262 | }) 263 | _sym_db.RegisterMessage(VerificationRequest) 264 | 265 | VerificationResponse = _reflection.GeneratedProtocolMessageType('VerificationResponse', (_message.Message,), { 266 | 'DESCRIPTOR' : _VERIFICATIONRESPONSE, 267 | '__module__' : 'fingerprint_pb2' 268 | # @@protoc_insertion_point(class_scope:fingerprint.VerificationResponse) 269 | }) 270 | _sym_db.RegisterMessage(VerificationResponse) 271 | 272 | CheckDuplicateResponse = _reflection.GeneratedProtocolMessageType('CheckDuplicateResponse', (_message.Message,), { 273 | 'DESCRIPTOR' : _CHECKDUPLICATERESPONSE, 274 | '__module__' : 'fingerprint_pb2' 275 | # @@protoc_insertion_point(class_scope:fingerprint.CheckDuplicateResponse) 276 | }) 277 | _sym_db.RegisterMessage(CheckDuplicateResponse) 278 | 279 | 280 | 281 | _FINGERPRINT = _descriptor.ServiceDescriptor( 282 | name='FingerPrint', 283 | full_name='fingerprint.FingerPrint', 284 | file=DESCRIPTOR, 285 | index=0, 286 | serialized_options=None, 287 | create_key=_descriptor._internal_create_key, 288 | serialized_start=404, 289 | serialized_end=679, 290 | methods=[ 291 | _descriptor.MethodDescriptor( 292 | name='EnrollFingerprint', 293 | full_name='fingerprint.FingerPrint.EnrollFingerprint', 294 | index=0, 295 | containing_service=None, 296 | input_type=_ENROLLMENTREQUEST, 297 | output_type=_ENROLLEDFMD, 298 | serialized_options=None, 299 | create_key=_descriptor._internal_create_key, 300 | ), 301 | _descriptor.MethodDescriptor( 302 | name='VerifyFingerprint', 303 | full_name='fingerprint.FingerPrint.VerifyFingerprint', 304 | index=1, 305 | containing_service=None, 306 | input_type=_VERIFICATIONREQUEST, 307 | output_type=_VERIFICATIONRESPONSE, 308 | serialized_options=None, 309 | create_key=_descriptor._internal_create_key, 310 | ), 311 | _descriptor.MethodDescriptor( 312 | name='CheckDuplicate', 313 | full_name='fingerprint.FingerPrint.CheckDuplicate', 314 | index=2, 315 | containing_service=None, 316 | input_type=_VERIFICATIONREQUEST, 317 | output_type=_CHECKDUPLICATERESPONSE, 318 | serialized_options=None, 319 | create_key=_descriptor._internal_create_key, 320 | ), 321 | ]) 322 | _sym_db.RegisterServiceDescriptor(_FINGERPRINT) 323 | 324 | DESCRIPTOR.services_by_name['FingerPrint'] = _FINGERPRINT 325 | 326 | # @@protoc_insertion_point(module_scope) 327 | -------------------------------------------------------------------------------- /src/python/fingerprint_pb2_grpc.py: -------------------------------------------------------------------------------- 1 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 2 | """Client and server classes corresponding to protobuf-defined services.""" 3 | import grpc 4 | 5 | import fingerprint_pb2 as fingerprint__pb2 6 | 7 | 8 | class FingerPrintStub(object): 9 | """Missing associated documentation comment in .proto file.""" 10 | 11 | def __init__(self, channel): 12 | """Constructor. 13 | 14 | Args: 15 | channel: A grpc.Channel. 16 | """ 17 | self.EnrollFingerprint = channel.unary_unary( 18 | '/fingerprint.FingerPrint/EnrollFingerprint', 19 | request_serializer=fingerprint__pb2.EnrollmentRequest.SerializeToString, 20 | response_deserializer=fingerprint__pb2.EnrolledFMD.FromString, 21 | ) 22 | self.VerifyFingerprint = channel.unary_unary( 23 | '/fingerprint.FingerPrint/VerifyFingerprint', 24 | request_serializer=fingerprint__pb2.VerificationRequest.SerializeToString, 25 | response_deserializer=fingerprint__pb2.VerificationResponse.FromString, 26 | ) 27 | self.CheckDuplicate = channel.unary_unary( 28 | '/fingerprint.FingerPrint/CheckDuplicate', 29 | request_serializer=fingerprint__pb2.VerificationRequest.SerializeToString, 30 | response_deserializer=fingerprint__pb2.CheckDuplicateResponse.FromString, 31 | ) 32 | 33 | 34 | class FingerPrintServicer(object): 35 | """Missing associated documentation comment in .proto file.""" 36 | 37 | def EnrollFingerprint(self, request, context): 38 | """Missing associated documentation comment in .proto file.""" 39 | context.set_code(grpc.StatusCode.UNIMPLEMENTED) 40 | context.set_details('Method not implemented!') 41 | raise NotImplementedError('Method not implemented!') 42 | 43 | def VerifyFingerprint(self, request, context): 44 | """Missing associated documentation comment in .proto file.""" 45 | context.set_code(grpc.StatusCode.UNIMPLEMENTED) 46 | context.set_details('Method not implemented!') 47 | raise NotImplementedError('Method not implemented!') 48 | 49 | def CheckDuplicate(self, request, context): 50 | """Missing associated documentation comment in .proto file.""" 51 | context.set_code(grpc.StatusCode.UNIMPLEMENTED) 52 | context.set_details('Method not implemented!') 53 | raise NotImplementedError('Method not implemented!') 54 | 55 | 56 | def add_FingerPrintServicer_to_server(servicer, server): 57 | rpc_method_handlers = { 58 | 'EnrollFingerprint': grpc.unary_unary_rpc_method_handler( 59 | servicer.EnrollFingerprint, 60 | request_deserializer=fingerprint__pb2.EnrollmentRequest.FromString, 61 | response_serializer=fingerprint__pb2.EnrolledFMD.SerializeToString, 62 | ), 63 | 'VerifyFingerprint': grpc.unary_unary_rpc_method_handler( 64 | servicer.VerifyFingerprint, 65 | request_deserializer=fingerprint__pb2.VerificationRequest.FromString, 66 | response_serializer=fingerprint__pb2.VerificationResponse.SerializeToString, 67 | ), 68 | 'CheckDuplicate': grpc.unary_unary_rpc_method_handler( 69 | servicer.CheckDuplicate, 70 | request_deserializer=fingerprint__pb2.VerificationRequest.FromString, 71 | response_serializer=fingerprint__pb2.CheckDuplicateResponse.SerializeToString, 72 | ), 73 | } 74 | generic_handler = grpc.method_handlers_generic_handler( 75 | 'fingerprint.FingerPrint', rpc_method_handlers) 76 | server.add_generic_rpc_handlers((generic_handler,)) 77 | 78 | 79 | # This class is part of an EXPERIMENTAL API. 80 | class FingerPrint(object): 81 | """Missing associated documentation comment in .proto file.""" 82 | 83 | @staticmethod 84 | def EnrollFingerprint(request, 85 | target, 86 | options=(), 87 | channel_credentials=None, 88 | call_credentials=None, 89 | insecure=False, 90 | compression=None, 91 | wait_for_ready=None, 92 | timeout=None, 93 | metadata=None): 94 | return grpc.experimental.unary_unary(request, target, '/fingerprint.FingerPrint/EnrollFingerprint', 95 | fingerprint__pb2.EnrollmentRequest.SerializeToString, 96 | fingerprint__pb2.EnrolledFMD.FromString, 97 | options, channel_credentials, 98 | insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 99 | 100 | @staticmethod 101 | def VerifyFingerprint(request, 102 | target, 103 | options=(), 104 | channel_credentials=None, 105 | call_credentials=None, 106 | insecure=False, 107 | compression=None, 108 | wait_for_ready=None, 109 | timeout=None, 110 | metadata=None): 111 | return grpc.experimental.unary_unary(request, target, '/fingerprint.FingerPrint/VerifyFingerprint', 112 | fingerprint__pb2.VerificationRequest.SerializeToString, 113 | fingerprint__pb2.VerificationResponse.FromString, 114 | options, channel_credentials, 115 | insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 116 | 117 | @staticmethod 118 | def CheckDuplicate(request, 119 | target, 120 | options=(), 121 | channel_credentials=None, 122 | call_credentials=None, 123 | insecure=False, 124 | compression=None, 125 | wait_for_ready=None, 126 | timeout=None, 127 | metadata=None): 128 | return grpc.experimental.unary_unary(request, target, '/fingerprint.FingerPrint/CheckDuplicate', 129 | fingerprint__pb2.VerificationRequest.SerializeToString, 130 | fingerprint__pb2.CheckDuplicateResponse.FromString, 131 | options, channel_credentials, 132 | insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 133 | -------------------------------------------------------------------------------- /src/python/requirements.txt: -------------------------------------------------------------------------------- 1 | grpcio==1.35.0 2 | grpcio-tools==1.35.0 --------------------------------------------------------------------------------