Guardtime KSI c SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Typedefs | Functions
Network Interface

Data Structures

struct  KSI_RequestHandleStatus_st
 

Typedefs

typedef struct
KSI_RequestHandleStatus_st 
KSI_RequestHandleStatus
 

Functions

int KSI_AbstractNetworkClient_new (KSI_CTX *ctx, KSI_NetworkClient **client)
 
void KSI_RequestHandle_free (KSI_RequestHandle *handle)
 
int KSI_AbstractNetEndpoint_new (KSI_CTX *ctx, KSI_NetEndpoint **endp)
 
void KSI_NetEndpoint_free (KSI_NetEndpoint *endp)
 
int KSI_NetEndpoint_setImplContext (KSI_NetEndpoint *endp, void *implCtx, void(*implCtx_free)(void *))
 
int KSI_NetEndpoint_setPass (KSI_NetEndpoint *endp, const char *ksi_pass)
 
int KSI_NetEndpoint_setUser (KSI_NetEndpoint *endp, const char *ksi_user)
 
int KSI_NetEndpoint_getUser (const KSI_NetEndpoint *endp, const char **ksi_user)
 
int KSI_NetEndpoint_getPass (const KSI_NetEndpoint *endp, const char **ksi_pass)
 
void KSI_NetworkClient_free (KSI_NetworkClient *provider)
 
int KSI_NetworkClient_sendSignRequest (KSI_NetworkClient *provider, KSI_AggregationReq *request, KSI_RequestHandle **handle)
 
int KSI_NetworkClient_sendExtendRequest (KSI_NetworkClient *provider, KSI_ExtendReq *request, KSI_RequestHandle **handle)
 
int KSI_NetworkClient_sendPublicationsFileRequest (KSI_NetworkClient *provider, KSI_RequestHandle **handle)
 
int KSI_RequestHandle_setImplContext (KSI_RequestHandle *handle, void *netCtx, void(*netCtx_free)(void *))
 
int KSI_RequestHandle_getNetContext (const KSI_RequestHandle *handle, void **c)
 
int KSI_RequestHandle_getRequest (const KSI_RequestHandle *handle, const unsigned char **request, size_t *request_len)
 
int KSI_RequestHandle_setResponse (KSI_RequestHandle *handle, const unsigned char *response, size_t response_len)
 
int KSI_RequestHandle_getResponse (const KSI_RequestHandle *handle, const unsigned char **response, size_t *response_len)
 
int KSI_RequestHandle_getExtendResponse (const KSI_RequestHandle *handle, KSI_ExtendResp **resp)
 
int KSI_RequestHandle_getAggregationResponse (const KSI_RequestHandle *handle, KSI_AggregationResp **resp)
 
KSI_CTXKSI_RequestHandle_getCtx (const KSI_RequestHandle *handle)
 
int KSI_RequestHandle_new (KSI_CTX *ctx, const unsigned char *request, size_t request_length, KSI_RequestHandle **handle)
 
int KSI_RequestHandle_setReadResponseFn (KSI_RequestHandle *handle, int(*fn)(KSI_RequestHandle *))
 
int KSI_RequestHandle_perform (KSI_RequestHandle *handle)
 
int KSI_RequestHandle_getResponseStatus (const KSI_RequestHandle *handle, const KSI_RequestHandleStatus **err)
 
int KSI_NetworkClient_setNetCtx (KSI_NetworkClient *client, void *netCtx, void(*netCtx_free)(void *))
 
int KSI_NetworkClient_setSendSignRequestFn (KSI_NetworkClient *client, int(*fn)(KSI_NetworkClient *, KSI_AggregationReq *, KSI_RequestHandle **))
 
int KSI_NetworkClient_setSendExtendRequestFn (KSI_NetworkClient *client, int(*fn)(KSI_NetworkClient *, KSI_ExtendReq *, KSI_RequestHandle **))
 
int KSI_NetworkClient_setSendPublicationRequestFn (KSI_NetworkClient *client, int(*fn)(KSI_NetworkClient *, KSI_RequestHandle **))
 
int KSI_NetworkClient_setExtenderUser (KSI_NetworkClient *net, const char *val)
 
int KSI_NetworkClient_setExtenderPass (KSI_NetworkClient *net, const char *val)
 
int KSI_NetworkClient_setAggregatorUser (KSI_NetworkClient *net, const char *val)
 
int KSI_NetworkClient_setAggregatorPass (KSI_NetworkClient *net, const char *val)
 
int KSI_NetworkClient_getExtenderUser (const KSI_NetworkClient *net, const char **val)
 
int KSI_NetworkClient_getExtenderPass (const KSI_NetworkClient *net, const char **val)
 
int KSI_NetworkClient_getAggregatorUser (const KSI_NetworkClient *net, const char **val)
 
int KSI_NetworkClient_getAggregatorPass (const KSI_NetworkClient *net, const char **val)
 
int KSI_convertAggregatorStatusCode (const KSI_Integer *statusCode)
 
int KSI_convertExtenderStatusCode (const KSI_Integer *statusCode)
 
int KSI_UriSplitBasic (const char *uri, char **scheme, char **host, unsigned *port, char **path)
 
int KSI_NetworkClient_getAggregatorEndpoint (const KSI_NetworkClient *net, KSI_NetEndpoint **endp)
 
int KSI_NetworkClient_getExtenderEndpoint (const KSI_NetworkClient *net, KSI_NetEndpoint **endp)
 
int KSI_NetworkClient_getPublicationsFileEndpoint (const KSI_NetworkClient *net, KSI_NetEndpoint **endp)
 
int KSI_NetworkClient_setAggregatorEndpoint (KSI_NetworkClient *net, KSI_NetEndpoint *endp)
 
int KSI_NetworkClient_setExtenderEndpoint (KSI_NetworkClient *net, KSI_NetEndpoint *endp)
 
int KSI_NetworkClient_setPublicationsFileEndpoint (KSI_NetworkClient *net, KSI_NetEndpoint *endp)
 
KSI_RequestHandleKSI_RequestHandle_ref (KSI_RequestHandle *o)
 
int KSI_AbstractAsyncService_new (KSI_CTX *ctx, KSI_AsyncService **service)
 

Detailed Description

This module contains two networking concepts used in this API:

Typedef Documentation

Function Documentation

int KSI_AbstractAsyncService_new ( KSI_CTX ctx,
KSI_AsyncService **  service 
)

Construct an abstract async service object.

Parameters
[in]ctxKSI context.
[out]servicePointer to the receiving pointer.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
See also
KSI_AsyncService_free
KSI_SigningAsyncService_new
int KSI_AbstractNetEndpoint_new ( KSI_CTX ctx,
KSI_NetEndpoint **  endp 
)

Constructor for abstract network endpoint object. The implementations must be configured (

See also
KSI_NetEndpoint_setImplContext).
Parameters
[in]ctxKSI context.
[out]endpPointer to the receiving network endpoint pointer.
Returns
status code (KSI_OK, when operation succeeded, otherwise and error code).
int KSI_AbstractNetworkClient_new ( KSI_CTX ctx,
KSI_NetworkClient **  client 
)

Constructor for the abstract network client.

Parameters
[in]ctxKSI context.
[out]clientAbstract network client.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_convertAggregatorStatusCode ( const KSI_Integer statusCode)

This function converts the aggregator response status code into a KSI status code.

See also
KSI_StatusCode
int KSI_convertExtenderStatusCode ( const KSI_Integer statusCode)

This function converts the extender response status code into a KSI status code.

See also
KSI_StatusCode
void KSI_NetEndpoint_free ( KSI_NetEndpoint endp)

Free network endpoint object.

Parameters
[in]endpNetwork endpoint.
int KSI_NetEndpoint_getPass ( const KSI_NetEndpoint endp,
const char **  ksi_pass 
)
int KSI_NetEndpoint_getUser ( const KSI_NetEndpoint endp,
const char **  ksi_user 
)
int KSI_NetEndpoint_setImplContext ( KSI_NetEndpoint endp,
void *  implCtx,
void(*)(void *)  implCtx_free 
)

Setter for the implementation specific endpoint context.

Parameters
[in]endpEndpoint.
[in]implCtxImplementation specific context.
[in]implCtx_freePointer to the implementation specific network endpoint cleanup method.
Returns
status code (KSI_OK, when operation succeeded, otherwise and error code).
int KSI_NetEndpoint_setPass ( KSI_NetEndpoint endp,
const char *  ksi_pass 
)
int KSI_NetEndpoint_setUser ( KSI_NetEndpoint endp,
const char *  ksi_user 
)
void KSI_NetworkClient_free ( KSI_NetworkClient provider)

Free network provider object.

Parameters
[in]providerNetwork provider.
int KSI_NetworkClient_getAggregatorEndpoint ( const KSI_NetworkClient net,
KSI_NetEndpoint **  endp 
)
int KSI_NetworkClient_getAggregatorPass ( const KSI_NetworkClient net,
const char **  val 
)
int KSI_NetworkClient_getAggregatorUser ( const KSI_NetworkClient net,
const char **  val 
)
int KSI_NetworkClient_getExtenderEndpoint ( const KSI_NetworkClient net,
KSI_NetEndpoint **  endp 
)
int KSI_NetworkClient_getExtenderPass ( const KSI_NetworkClient net,
const char **  val 
)
int KSI_NetworkClient_getExtenderUser ( const KSI_NetworkClient net,
const char **  val 
)
int KSI_NetworkClient_getPublicationsFileEndpoint ( const KSI_NetworkClient net,
KSI_NetEndpoint **  endp 
)
int KSI_NetworkClient_sendExtendRequest ( KSI_NetworkClient provider,
KSI_ExtendReq request,
KSI_RequestHandle **  handle 
)

Sends a non-blocking extending request or initialize the handle.

Parameters
[in]providerNetwork provider.
[in]requestExtend request.
[in]handleNetwork handle.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_NetworkClient_sendPublicationsFileRequest ( KSI_NetworkClient provider,
KSI_RequestHandle **  handle 
)

Sends a non-blocking publicationsfile request or initialize the handle.

Parameters
[in]providerNetwork provider.
[in]handleNetwork handle.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_NetworkClient_sendSignRequest ( KSI_NetworkClient provider,
KSI_AggregationReq request,
KSI_RequestHandle **  handle 
)

Sends a non-blocking signing request or initialize the handle.

Parameters
[in]providerNetwork provider.
[in]requestRequest object.
[out]handleNetwork handle.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_NetworkClient_setAggregatorEndpoint ( KSI_NetworkClient net,
KSI_NetEndpoint endp 
)
int KSI_NetworkClient_setAggregatorPass ( KSI_NetworkClient net,
const char *  val 
)
int KSI_NetworkClient_setAggregatorUser ( KSI_NetworkClient net,
const char *  val 
)
int KSI_NetworkClient_setExtenderEndpoint ( KSI_NetworkClient net,
KSI_NetEndpoint endp 
)
int KSI_NetworkClient_setExtenderPass ( KSI_NetworkClient net,
const char *  val 
)
int KSI_NetworkClient_setExtenderUser ( KSI_NetworkClient net,
const char *  val 
)
int KSI_NetworkClient_setNetCtx ( KSI_NetworkClient client,
void *  netCtx,
void(*)(void *)  netCtx_free 
)

Setter for the implementation specific networking context.

Parameters
[in]clientNetwork client.
[in]netCtxImplementation specific context.
[in]netCtx_freePointer to the implementation specific network context cleanup method.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_NetworkClient_setPublicationsFileEndpoint ( KSI_NetworkClient net,
KSI_NetEndpoint endp 
)
int KSI_NetworkClient_setSendExtendRequestFn ( KSI_NetworkClient client,
int(*)(KSI_NetworkClient *, KSI_ExtendReq *, KSI_RequestHandle **)  fn 
)

Setter for sign request function.

Parameters
[in]clientNetwork client.
[in]fnPointer to extend request function.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_NetworkClient_setSendPublicationRequestFn ( KSI_NetworkClient client,
int(*)(KSI_NetworkClient *, KSI_RequestHandle **)  fn 
)

Setter for sign request function.

Parameters
[in]clientNetwork client.
[in]fnPointer to publicationsfile request function.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_NetworkClient_setSendSignRequestFn ( KSI_NetworkClient client,
int(*)(KSI_NetworkClient *, KSI_AggregationReq *, KSI_RequestHandle **)  fn 
)

Setter for sign request function.

Parameters
[in]clientNetwork client.
[in]fnPointer to sign request function.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
void KSI_RequestHandle_free ( KSI_RequestHandle handle)

Free network handle object.

Parameters
[in]handleNetwork handle.
int KSI_RequestHandle_getAggregationResponse ( const KSI_RequestHandle handle,
KSI_AggregationResp **  resp 
)

TODO!

KSI_CTX* KSI_RequestHandle_getCtx ( const KSI_RequestHandle handle)

TODO!

int KSI_RequestHandle_getExtendResponse ( const KSI_RequestHandle handle,
KSI_ExtendResp **  resp 
)

TODO!

int KSI_RequestHandle_getNetContext ( const KSI_RequestHandle handle,
void **  c 
)

Getter method for the network request implementation context.

Parameters
[in]handleNetwork handle.
[out]cPointer to the receiving pointer.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
Note
The caller may not free the output object.
int KSI_RequestHandle_getRequest ( const KSI_RequestHandle handle,
const unsigned char **  request,
size_t *  request_len 
)

Getter for the request. The request can be set only while creating the network handle object (

See also
KSI_RequestHandle_new).
Parameters
[in]handleNetwork handle.
[out]requestPointer to the receiving pointer.
[out]request_lenPointer to the receiving length value.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
Note
The output memory may not be freed by the caller.
int KSI_RequestHandle_getResponse ( const KSI_RequestHandle handle,
const unsigned char **  response,
size_t *  response_len 
)

A blocking function to read the response to the request. The function is blocking only for the first call on one handle. If the first call succeeds following calls output the same value.

Parameters
[in]handleNetwork handle.
[out]responsePointer to the receiving response pointer.
[out]response_lenPointer to the receiving response length value.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_RequestHandle_getResponseStatus ( const KSI_RequestHandle handle,
const KSI_RequestHandleStatus **  err 
)

Returns the status of the handle.

Parameters
[in]handleNetwork handle.
[out]errPointer to the status structure.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
Note
The pointer to the err structure is only valid as long as the handle itself is valid.
int KSI_RequestHandle_new ( KSI_CTX ctx,
const unsigned char *  request,
size_t  request_length,
KSI_RequestHandle **  handle 
)

Constructor for network handle object.

Parameters
[in]ctxKSI context.
[in]requestPointer to request.
[in]request_lengthLength of the request.
[out]handlePointer to the receiving network handle pointer.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
Note
The request value may be freed after a successful call to this function as its contents is copied internally.
int KSI_RequestHandle_perform ( KSI_RequestHandle handle)

Performs the request. This can be called on a handle several times - this is useful if the previous call was unsuccessful or the caller wishes to send the request again.

Parameters
[in]handleNetwork handle.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
KSI_RequestHandle* KSI_RequestHandle_ref ( KSI_RequestHandle o)
  • Increases the inner reference count of that object. *
    Parameters
    [in]oPointer to KSI_RequestHandle *
    Returns
    Returns the input pointer on success or NULL on error. *
    See also
    KSI_RequestHandle_free
int KSI_RequestHandle_setImplContext ( KSI_RequestHandle handle,
void *  netCtx,
void(*)(void *)  netCtx_free 
)

Setter for network request implementation context.

Parameters
[in]handleNetwork handle.
[in]netCtxNetwork implementation context.
[in]netCtx_freeCleanup method for the network context.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_RequestHandle_setReadResponseFn ( KSI_RequestHandle handle,
int(*)(KSI_RequestHandle *)  fn 
)

As network handles may be created by using several KSI contexts with different network providers and/or the network provider of a KSI context may be changed during runtime, it is necessary to state the function to be called to receive the response.

Parameters
[in]handleNetwork handle.
[in]fnPointer to response reader function.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_RequestHandle_setResponse ( KSI_RequestHandle handle,
const unsigned char *  response,
size_t  response_len 
)

Response value setter. Should be called only by the actual network provider implementation.

Parameters
[in]handleNetwork handle.
[in]responsePointer to the response.
[in]response_lenResponse length.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
Note
The response memory may be freed after a successful call to this method, as the contents is copied internally.
int KSI_UriSplitBasic ( const char *  uri,
char **  scheme,
char **  host,
unsigned *  port,
char **  path 
)

Function to split the given uri into three parts: schema, host and port. If the part is missing from the uri, the output parameter will receive NULL or 0 for port as the value. If the output pointers are set to NULL, the value is not returned.

Parameters
[in]uriPointer to the URI.
[out]schemePointer to the receiving pointer of the scheme (may be NULL).
[out]hostPointer to the receiving pointer of the host (may be NULL).
[out]portPointer to the receiving variable (may be NULL).
[out]pathPointer to the receiving pointer of the path (may be NULL).
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
Note
All aquired pointers have to be freed by the caller using KSI_free.