Rate This Document
Findability
Accuracy
Completeness
Readability

Usage Flow

The standard usage flow of the kdc_proxy dynamic library is as follows:

  1. Load the dynamic library.
    #include "kdc_proxy.h"
    void *handle = dlopen("libkdc_proxy.so", RTLD_LAZY);
    if (!handle) {
    // Handle the error.
    return;
    }
  2. Obtain the function pointers.
    SetLogCallback_t setLogCallback = (SetLogCallback_t)dlsym(handle, "SetLogCallback");
    SetRAAgentTokenUrl_t setRaUrl = (SetRAAgentTokenUrl_t)dlsym(handle, "SetRAAgentTokenUrl");
    SetKdcAgentUrl_t setKdcUrl = (SetKdcAgentUrl_t)dlsym(handle, "SetKdcAgentUrl");
    SetCaFile_t setCa = (SetCaFile_t)dlsym(handle, "SetCaFile");
    SetTlsCertAndKeyFile_t setTlsCert = (SetTlsCertAndKeyFile_t)dlsym(handle, "SetTlsCertAndKeyFile");
    KdcProxyIdentityRegister_t identityRegister = (KdcProxyIdentityRegister_t)dlsym(handle, "KdcProxyIdentityRegister");
    KdcTrustedRequest_t kdcRequest = (KdcTrustedRequest_t)dlsym(handle, "KdcTrustedRequest");
    KdcFreePtr_t freePtr = (KdcFreePtr_t)dlsym(handle, "KdcFreePtr");
  3. Configure the URLs and certificates.
    setLogCallback(connector_log);
    setRaUrl("https://api.example.com/global-trust-authority/agent/v1/tokens");
    setKdcUrl("https://127.0.0.1:26068/rest/kdc_agent/v1/proxy");
    setCa("/path/to/ca.crt");
    setTlsCert("/path/to/tls.crt", "/path/to/tls.key", NULL);
  4. Register the identity (called once at startup).
    uint32_t ret = identityRegister();
    if (ret != 0) {
    // Handle the error.
    return;
    }
  5. Initiate a request.
    char *output = NULL;
    uint32_t outputLen = 0;
    kdcRequest(35, input, inputLen, &output, &outputLen);
  6. Handle the result.
    if (output) {
    freePtr(output);
    }
  7. Closes the dynamic library.
    dlclose(handle);