Ziti C SDK
Loading...
Searching...
No Matches
enroll.h File Reference
#include <stdbool.h>
#include "ziti_model.h"
#include <uv.h>

Go to the source code of this file.

Data Structures

struct  ziti_enroll_opts
 

Typedefs

typedef void(* ziti_enroll_cb) (const ziti_config *cfg, int status, const char *err_message, void *enroll_ctx)
 Callback called after ziti_enroll() is complete.
 

Functions

int ziti_enroll (const ziti_enroll_opts *opts, uv_loop_t *loop, ziti_enroll_cb enroll_cb, void *enroll_ctx)
 Performs a Ziti enrollment.
 
int ziti_enroll_url (const char *url, uv_loop_t *loop, ziti_enroll_cb enroll_cb, void *enroll_ctx)
 Bootstrap a ziti_config from a controller URL.
 

Typedef Documentation

◆ ziti_enroll_cb

typedef void(* ziti_enroll_cb) (const ziti_config *cfg, int status, const char *err_message, void *enroll_ctx)

Callback called after ziti_enroll() is complete.

This callback is invoked on the conclusion of the ziti_enroll() function. The result of the ziti_enroll() function may be an error condition so it is important to verify the provided status code in this callback.

This callback also receives a Ziti identity json salvo if the enrollment was successful. This identity should be persisted into a file, and used in subsequent calls to ziti_load_config().

Parameters
cfgidentity config object, NULL if enrollment fails for any reason
statusenrollment success or error code
err_messagedescription of error, or NULL if enrollment succeeded
enroll_ctxadditional context to be passed into ziti_enroll_cb callback
See also
ziti_enroll(), ZITI_ERRORS

Function Documentation

◆ ziti_enroll()

int ziti_enroll ( const ziti_enroll_opts opts,
uv_loop_t *  loop,
ziti_enroll_cb  enroll_cb,
void *  enroll_ctx 
)
extern

Performs a Ziti enrollment.

This function is used to enroll a Ziti Edge identity. [enroll_cb] is called once enrollment process is complete unless the error is returned.

Parameters
optsenrollment options
loopevent loop
enroll_cbcallback to be called when enrollment is complete
enroll_ctxadditional context to be passed into ziti_enroll_cb callback
Returns
ZITI_OK or corresponding #ZITI_ERRORS

◆ ziti_enroll_url()

int ziti_enroll_url ( const char *  url,
uv_loop_t *  loop,
ziti_enroll_cb  enroll_cb,
void *  enroll_ctx 
)
extern

Bootstrap a ziti_config from a controller URL.

Fetches the network JWT from the controller's /network-jwts endpoint, verifies the controller identity using the JWT signature, then fetches the CA bundle over the verified connection.

Requires the controller's TLS certificate to be verifiable by the OS trust store (publicly-trusted CA). For privately-signed controllers, obtain the network JWT out of band and pass it via ziti_enroll_opts.token to ziti_enroll() instead.

Parameters
urlcontroller URL (e.g., "https://ctrl.example.com:1280")
loopevent loop
enroll_cbcallback invoked with the bootstrapped config
enroll_ctxadditional context passed to the callback
Returns
ZITI_OK or corresponding #ZITI_ERRORS