java.lang.Object
com.itemis.jscdlib.internal.NativeBase
com.itemis.jscdlib.internal.ScDaemonNativeBridge
- All Implemented Interfaces:
AutoCloseable
ScDaemonNativeBridge relies on preview features of the Java platform:
ScDaemonNativeBridgerefers to one or more preview APIs:Arena,MemorySegment,SymbolLookup.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance. -
Method Summary
Modifier and TypeMethodDescriptionlongassuanNew(MemorySegmentPREVIEW p_ctx) Create a new assuan context with default arguments.voidRelease all resources associated withctx.longassuanSocketConnect(MemorySegmentPREVIEW ctx, MemorySegmentPREVIEW name, int server_pid, int flags) Connect to an assuan socket (to the scdaemon).longassuanTransact(MemorySegmentPREVIEW ctx, MemorySegmentPREVIEW command, MemorySegmentPREVIEW data_cb, MemorySegmentPREVIEW data_cb_arg, MemorySegmentPREVIEW inquire_cb, MemorySegmentPREVIEW inquire_cb_arg, MemorySegmentPREVIEW status_cb, MemorySegmentPREVIEW status_cb_arg) Send a command to the smart card daemon (scdaemon).voidclose()
-
Constructor Details
-
ScDaemonNativeBridge
Create a new instance.- Parameters:
libSup- - Creates a "Connection" to the underlying native library in form of aSymbolLookupPREVIEW. The connection will be closed ifclose()is called.
-
-
Method Details
-
assuanNew
Create a new assuan context with default arguments.- Parameters:
p_ctx- Pointer of pointer segment. Will hold the pointer to the created ctx upon successful return.- Returns:
- gpg_error_t - 0 for success, error code else.
-
assuanRelease
Release all resources associated withctx.- Parameters:
ctx- Pointer to ctx created with.invalid reference
#assuanNew(MemoryAddress)
-
assuanSocketConnect
public long assuanSocketConnect(MemorySegmentPREVIEW ctx, MemorySegmentPREVIEW name, int server_pid, int flags) Connect to an assuan socket (to the scdaemon).- Parameters:
ctx- Pointer to ctx created with.invalid reference
#assuanNew(MemoryAddress)name- Unix domain socket to connect to. May be a URI to a file.server_pid- Currently unused. Use ASSUAN_INVALID_PID (-1)flags- Undocumented. Use ASSUAN_SOCKET_CONNECT_FDPASSING (1)- Returns:
- gpg_error_t - 0 for success, error code else.
-
assuanTransact
public long assuanTransact(MemorySegmentPREVIEW ctx, MemorySegmentPREVIEW command, MemorySegmentPREVIEW data_cb, MemorySegmentPREVIEW data_cb_arg, MemorySegmentPREVIEW inquire_cb, MemorySegmentPREVIEW inquire_cb_arg, MemorySegmentPREVIEW status_cb, MemorySegmentPREVIEW status_cb_arg) Send a command to the smart card daemon (scdaemon).
Use
to provide proper callbacks.invalid reference
CLinker#upcallStub(java.lang.invoke.MethodHandle, jdk.incubator.foreign.FunctionDescriptor)Required callback signatures are:
- gpg_error_t (*data_cb)(void *, const void *, size_t)
- gpg_error_t (*inquire_cb)(void*, const char *)
- gpg_error_t (*status_cb)(void*, const char *)
- Parameters:
ctx- Pointer to Assuan ctxcommand- Pointer to command stringdata_cb- Callback method for returned data.data_cb_arg- Will be passed to the callback along other things. May be.invalid reference
MemoryAddress#NULLinquire_cb- Callback method if the daemon needs more information from the client.inquire_cb_arg- Will be passed to the callback along other things. May be.invalid reference
MemoryAddress#NULLstatus_cb- Called for status lines returned from the daemon.status_cb_arg- Will be passed to the callback along other things. May be.invalid reference
MemoryAddress#NULL- Returns:
- gpg_error_t
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
ScDaemonNativeBridgewhen preview features are enabled.