This section contains global and lifecycle functions. More...
Macros | |
#define | dvDefaultConnectTimeoutSeconds 8 |
The default number of seconds to wait for a connection. More... | |
#define | dvDefaultSecretPlaceHolder "^^^SECRET^^^" |
Typedefs | |
typedef void * | dvCtx |
typedef int32_t(* | dvSetHeaderFn) (void *ctx, const char *name, const char *value) |
typedef int32_t(* | dvHeaderCb) (void *usrCtx, dvSetHeaderFn setHeader, void *headerCtx) |
typedef int32_t(* | dvSetPostFn) (void *ctx, const char *name, void *buf, size_t len) |
typedef int32_t(* | dvPostCb) (void *usrCtx, dvSetPostFn setPostField, void *postCtx) |
Enumerations | |
enum | dvCtxOpt { DV_PROXY = (uint32_t)57 , DV_PROXY_USER , DV_PROXY_PASS , DV_SERVICE_URL , DV_APP_ID , DV_CONNECT_TIMEOUT , DV_APPNAME , DV_APPVERSION , DV_CERT_PATH , DV_SKIP_CERT_CHECK , DV_CURL_LOGGING } |
Constants used to set DataVaccinator Client context parameters. More... | |
Functions | |
DVAPI int32_t | dvNew (dvCtx *dc, const char *serviceUrl, const char *appId, KvStore *cache) |
DVAPI void | dvFree (dvCtx dc) |
DVAPI int32_t | dvSetHeaderCb (dvCtx dc, dvHeaderCb callback, void *cbCtx) |
DVAPI int32_t | dvSetPostCb (dvCtx dc, dvPostCb callback, void *cbCtx) |
DVAPI const char * | dvVersion (void) |
Returns the build version of this package. More... | |
DVAPI int | dvSetProp (dvCtx dc, enum dvCtxOpt opt, const char *value) |
Sets a DataVaccinator Client context dvCtxOpt option. More... | |
DVAPI const char * | dvLastError (void) |
Returns an English textual representation of the last error this thread generated. More... | |
This section contains global and lifecycle functions.
#define dvDefaultConnectTimeoutSeconds 8 |
The default number of seconds to wait for a connection.
#define dvDefaultSecretPlaceHolder "^^^SECRET^^^" |
The default place holder for any secret specified in dvSetProp with DV_SECRET when DV_SECRET_PLACE_HOLDER has not been specified.
typedef void* dvCtx |
Opaque pointer to a datavaccinator object.
typedef int32_t(* dvHeaderCb) (void *usrCtx, dvSetHeaderFn setHeader, void *headerCtx) |
Interface of function to be called when it's time to set request headers.
usrCtx | Opaque context passed as cbCtx to the dvSetHeaderCb function. |
setHeader | The dvSetHeaderFn function to call in order to set the desired headers. |
headerCtx | Opaque context to be passed as ctx to the given dvSetHeaderFn function. |
typedef int32_t(* dvPostCb) (void *usrCtx, dvSetPostFn setPostField, void *postCtx) |
Interface of function to be called when it's time to set the post fields.
This function can be used to send additional post fields and their associated values to a Service Provider in order to facilitate their particular functionality.
The usage of this callback is subject to the following rules:
usrCtx | Opaque context passed as cbCtx to the dvSetPostCb function. |
setPostField | The dvSetPostFn function to call in order to set the desired post fields. |
postCtx | Opaque context to be passed as ctx to the given dvSetPostFn function. |
typedef int32_t(* dvSetHeaderFn) (void *ctx, const char *name, const char *value) |
Header setter function interface. When this function is called a header is set or removed. If a header matches a header that is already set, the given header takes precedence. To remove an existing header set its name with a null value. To set an empty header set its name with the value of an empty string. The header name must not include a colon. The caller is responsible for header encoding. The header value must not include line endings such as CRLF.
ctx | Opaque context to be passed to the function. |
name | Name of the header to be set. Must only persist for the duration of this function call. |
value | Value of the header in unencoded format. Must only persist for the duration of this function call. |
typedef int32_t(* dvSetPostFn) (void *ctx, const char *name, void *buf, size_t len) |
Post field setter function interface.
ctx | Opaque context to be passed to the function. |
name | Name of the header to be set. Must only persist for the duration of this function call. |
buf | Data for the value of the field in unencoded format. Must only persist for the duration of this function call. |
len | Length of the given buf parameter. |
enum dvCtxOpt |
Constants used to set DataVaccinator Client context parameters.
Enumerator | |
---|---|
DV_PROXY | Proxy URL in the form of protocol://hostname:port |
DV_PROXY_USER | Proxy username |
DV_PROXY_PASS | Proxy password |
DV_SERVICE_URL | The service provider URL |
DV_APP_ID | The app-id |
DV_CONNECT_TIMEOUT | Timeout in seconds used for network connections. Defaults to vaccinator. |
DV_APPNAME | The name this client claims to be during connect. Defaults to dvDefaultConnectTimeoutSeconds |
DV_APPVERSION | The version this client claims to be during connect. Defaults to 1.1.0. |
DV_CERT_PATH | File path to certificate authority file or directory. |
DV_SKIP_CERT_CHECK | This will disable SSL certificate verification when set to non 0. Helpful when developing. |
DV_CURL_LOGGING | This will turn on cURL debug logging e when set to non 0 and the general log level is at RU_LOG_VERB. |
DVAPI void dvFree | ( | dvCtx | dc | ) |
DVAPI const char* dvLastError | ( | void | ) |
Returns an English textual representation of the last error this thread generated.
Note, not all functions use this, so this function should only be called after a function that does use it is called, else misleading information will appear.
Creates a new Datavaccinator context object.
dc | Where the new dvCtx will be stored. Free with dvFree. |
serviceUrl | The URL of the Service Provider that this DataVaccinator Client talks to. This may also be the DataVaccinator Vault URL directly if you use the dvSetPostCb to supply the required SID / SPW credentials. |
appId | This is the end users application password for data encryption. |
cache | A KvStore instance that can be used as a local data cache. The caller must preserve the KvStore instance for the life of this context and may/should free it afterwards. If NULL no caching will be done. |
DVAPI int32_t dvSetHeaderCb | ( | dvCtx | dc, |
dvHeaderCb | callback, | ||
void * | cbCtx | ||
) |
Sets the function to call when the request headers are being written.
dc | The dvCtx to work with. |
callback | The dvHeaderCb to call. |
cbCtx | An optional context that will be passed into the dvHeaderCb as the usrCtx parameter. |
Example
Sets the function to call when the post fields are being written.
dc | The dvCtx to work with. |
callback | The dvPostCb to call. |
cbCtx | An optional context that will be passed into the dvPostCb as the usrCtx parameter. |
Example
Sets a DataVaccinator Client context dvCtxOpt option.
[in] | dc | The dvCtx to set the option for. |
[in] | opt | The dvCtxOpt option to set. |
[in] | value | The value to set it to or NULL to unset it. The given string will be copied. |
DVAPI const char* dvVersion | ( | void | ) |
Returns the build version of this package.
This is the actual build version and should not be confused with DV_APPVERSION which is sent to the service providers.