aboutsummaryrefslogtreecommitdiffstats
path: root/library/go/yandex/tvm/tvmauth/tvm.h
diff options
context:
space:
mode:
authorhcpp <hcpp@ydb.tech>2023-11-08 12:09:41 +0300
committerhcpp <hcpp@ydb.tech>2023-11-08 12:56:14 +0300
commita361f5b98b98b44ea510d274f6769164640dd5e1 (patch)
treec47c80962c6e2e7b06798238752fd3da0191a3f6 /library/go/yandex/tvm/tvmauth/tvm.h
parent9478806fde1f4d40bd5a45e7cbe77237dab613e9 (diff)
downloadydb-a361f5b98b98b44ea510d274f6769164640dd5e1.tar.gz
metrics have been added
Diffstat (limited to 'library/go/yandex/tvm/tvmauth/tvm.h')
-rw-r--r--library/go/yandex/tvm/tvmauth/tvm.h235
1 files changed, 235 insertions, 0 deletions
diff --git a/library/go/yandex/tvm/tvmauth/tvm.h b/library/go/yandex/tvm/tvmauth/tvm.h
new file mode 100644
index 0000000000..189ba02f6e
--- /dev/null
+++ b/library/go/yandex/tvm/tvmauth/tvm.h
@@ -0,0 +1,235 @@
+#pragma once
+
+#include <util/system/types.h>
+
+#include <stdint.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef struct _TVM_String {
+ char* Data;
+ int Size;
+ } TVM_String;
+
+ typedef struct {
+ ui64 Uid;
+ ui64 CurrentPorgId;
+ } TVM_UserExtFields;
+
+ // MemPool owns memory allocated by C.
+ typedef struct {
+ char* ErrorStr;
+ void* TicketStr;
+ void* RawRolesStr;
+ TVM_String* Scopes;
+ void* CheckedUserTicket;
+ void* CheckedServiceTicket;
+ char* DbgInfo;
+ char* LogInfo;
+ char* LoginId;
+ TVM_UserExtFields* UidsExtFields;
+ TVM_UserExtFields* DefaultUidExtFields;
+ TVM_String LastError;
+ } TVM_MemPool;
+
+ void TVM_DestroyMemPool(TVM_MemPool* pool);
+
+ typedef struct {
+ int Code;
+ int Retriable;
+
+ TVM_String Message;
+ } TVM_Error;
+
+ typedef struct {
+ int Status;
+
+ ui64 DefaultUid;
+
+ ui64* Uids;
+ int UidsSize;
+
+ int Env;
+
+ TVM_String* Scopes;
+ int ScopesSize;
+
+ TVM_String DbgInfo;
+ TVM_String LogInfo;
+
+ TVM_String LoginId;
+
+ TVM_UserExtFields* UidsExtFields;
+ int UidsExtFieldsSize;
+
+ TVM_UserExtFields* DefaultUidExtFields;
+ } TVM_UserTicket;
+
+ typedef struct {
+ int Status;
+
+ ui32 SrcId;
+ ui32 DstId;
+
+ ui64 IssuerUid;
+
+ TVM_String DbgInfo;
+ TVM_String LogInfo;
+ } TVM_ServiceTicket;
+
+ typedef struct {
+ ui32 SelfId;
+
+ int EnableServiceTicketChecking;
+
+ int EnableUserTicketChecking;
+ int BlackboxEnv;
+
+ unsigned char* SelfSecret;
+ int SelfSecretSize;
+ unsigned char* DstAliases;
+ int DstAliasesSize;
+
+ unsigned char* IdmSystemSlug;
+ int IdmSystemSlugSize;
+ int DisableSrcCheck;
+ int DisableDefaultUIDCheck;
+
+ unsigned char* TVMHost;
+ int TVMHostSize;
+ int TVMPort;
+ unsigned char* TiroleHost;
+ int TiroleHostSize;
+ int TirolePort;
+ ui32 TiroleTvmId;
+
+ unsigned char* DiskCacheDir;
+ int DiskCacheDirSize;
+
+ int DisableDstCheck;
+ } TVM_ApiSettings;
+
+ typedef struct {
+ unsigned char* Alias;
+ int AliasSize;
+
+ int Port;
+
+ unsigned char* Hostname;
+ int HostnameSize;
+
+ unsigned char* AuthToken;
+ int AuthTokenSize;
+
+ int DisableSrcCheck;
+ int DisableDefaultUIDCheck;
+ int DisableDstCheck;
+ } TVM_ToolSettings;
+
+ typedef struct {
+ ui32 SelfId;
+ int BlackboxEnv;
+ } TVM_UnittestSettings;
+
+ typedef struct {
+ int Status;
+ TVM_String LastError;
+ } TVM_ClientStatus;
+
+ // First argument must be passed by value. "Go code may pass a Go pointer to C
+ // provided the Go memory to which it points does not contain any Go pointers."
+ void TVM_NewApiClient(
+ TVM_ApiSettings settings,
+ int loggerHandle,
+ void** handle,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_NewDynamicApiClient(
+ TVM_ApiSettings settings,
+ int loggerHandle,
+ void** handle,
+ void** dynHandle,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_NewToolClient(
+ TVM_ToolSettings settings,
+ int loggerHandle,
+ void** handle,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_NewUnittestClient(
+ TVM_UnittestSettings settings,
+ void** handle,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_DestroyClient(void* handle);
+
+ void TVM_GetStatus(
+ void* handle,
+ TVM_ClientStatus* status,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_CheckUserTicket(
+ void* handle,
+ unsigned char* ticketStr, int ticketSize,
+ int* env,
+ TVM_UserTicket* ticket,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_CheckServiceTicket(
+ void* handle,
+ unsigned char* ticketStr, int ticketSize,
+ TVM_ServiceTicket* ticket,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_GetServiceTicket(
+ void* handle,
+ ui32 dstId,
+ char** ticket,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_GetServiceTicketForAlias(
+ void* handle,
+ unsigned char* alias, int aliasSize,
+ char** ticket,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_GetRoles(
+ void* handle,
+ unsigned char* currentRevision, int currentRevisionSize,
+ char** raw,
+ int* rawSize,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_AddDsts(
+ void* dynHandle,
+ ui32* dsts,
+ int size,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ void TVM_GetOptionalServiceTicketFor(
+ void* dynHandle,
+ ui32 dstId,
+ char** ticket,
+ TVM_Error* err,
+ TVM_MemPool* pool);
+
+ const char* TVM_TicketStatusToString(int status);
+
+#ifdef __cplusplus
+}
+#endif