Mistake on this page? Email us
protocol_api.h File Reference

Edge RPC API. More...

#include "jsonrpc/jsonrpc.h"
#include "common/pt_api_error_codes.h"
#include "edge-core/server.h"
#include "est_defs.h"
#include "certificate-enrollment-client/ce_status.h"
#include "certificate-enrollment-client/ce_defs.h"

Go to the source code of this file.

typedef struct edgeclient_request_context edgeclient_request_context_t
 The edgeclient request context data.
 
void init_protocol ()
 Initialize Edge RPC API.
 
int protocol_translator_register (json_t *request, json_t *json_params, json_t **result, void *userdata)
 Register the protocol translator to Edge. More...
 
int device_register (json_t *request, json_t *json_params, json_t **result, void *userdata)
 Register an endpoint device to Edge. More...
 
int device_unregister (json_t *request, json_t *json_params, json_t **result, void *userdata)
 Unregister an endpoint device from Edge. More...
 
int write_value (json_t *request, json_t *json_params, json_t **result, void *userdata)
 Write endpoint device values. More...
 
int certificate_renewal_list_set (json_t *request, json_t *json_params, json_t **result, void *userdata)
 Set list of certificates to receive renewal status updates for. More...
 
int renew_certificate (json_t *request, json_t *json_params, json_t **result, void *userdata)
 Initiate certificate renewal operation for a certificate. More...
 
int est_request_enrollment (json_t *request, json_t *json_params, json_t **result, void *userdata)
 Requests an EST enrollment for a certificate. More...
 
int write_to_pt (edgeclient_request_context_t *ctx, void *userdata)
 Writes the updated values to the protocol translator. More...
 
int certificate_renewal_notifier (const char *certificate_name, ce_status_e status, ce_initiator_e initiator, void *ctx)
 Writes the certificate renewal status to the protocol translator. More...
 
int est_enrollment_result_notifier (est_enrollment_result_e result, struct cert_chain_context_s *cert_chain, void *ctx)
 Sends the EST enrollment result to the protocol translator. More...
 

Detailed Description

Edge RPC API.

Definition of the Edge RPC API.

RPC API provides functions to:

  • register and unregister the protocol translator.
  • register and unregister endpoint devices.
  • update the endpoint device state.
  • write the endpoint device value changes.

Function Documentation

int certificate_renewal_list_set ( json_t *  request,
json_t *  json_params,
json_t **  result,
void *  userdata 
)

Set list of certificates to receive renewal status updates for.

Parameters
requestThe jsonrpc request.
json_paramsThe parameter portion of the jsonrpc request.
resultThe jsonrpc result object to fill.
userdataThe user-supplied context data pointer.
Returns
0 if setting the list succeeded.
1 if an error occurred. Details are in the result parameter.
int certificate_renewal_notifier ( const char *  certificate_name,
ce_status_e  status,
ce_initiator_e  initiator,
void *  ctx 
)

Writes the certificate renewal status to the protocol translator.

Parameters
certificate_nameName of certificate whose renewal process finished.
statusStatus of the finished renewal process.
initiatorInitiator of the renewal process.
0 for PT initiated renew 1 for cloud initiated renew
ctxContext pointer passed from server when initializing the client.
Returns
0 if status was written successfully.
1 if the status couldn't be written.
int device_register ( json_t *  request,
json_t *  json_params,
json_t **  result,
void *  userdata 
)

Register an endpoint device to Edge.

Parameters
requestThe jsonrpc request.
json_paramsThe parameter portion of the jsonrpc request.
resultThe jsonrpc result object to fill.
userdataThe user-supplied context data pointer.
Returns
0 if the device registration succeeded.
1 if an error occurred. Details are in the result parameter.
int device_unregister ( json_t *  request,
json_t *  json_params,
json_t **  result,
void *  userdata 
)

Unregister an endpoint device from Edge.

Parameters
requestThe jsonrpc request.
json_paramsThe parameter portion of the jsonrpc request.
resultThe jsonrpc result object to fill.
userdataThe user-supplied context data pointer.
Returns
0 if the device unregistration succeeded.
1 if an error occurred.
Details are in the result parameter of the function call.
int est_enrollment_result_notifier ( est_enrollment_result_e  result,
struct cert_chain_context_s cert_chain,
void *  ctx 
)

Sends the EST enrollment result to the protocol translator.

Parameters
resultResult of the finished EST enrollment process.
cert_chainStructure containing the enrolled certificate or certificates.
ctxContext pointer passed from server when initializing the client.
Returns
0 if status was written successfully.
1 if the status couldn't be written.
int est_request_enrollment ( json_t *  request,
json_t *  json_params,
json_t **  result,
void *  userdata 
)

Requests an EST enrollment for a certificate.

Parameters
requestThe jsonrpc request.
json_paramsThe parameter portion of the jsonrpc request.
resultThe jsonrpc result object to fill.
Returns
0 if the EST enrollment operation started successfully.
1 if an error occurred. Details are in the result parameter.
int protocol_translator_register ( json_t *  request,
json_t *  json_params,
json_t **  result,
void *  userdata 
)

Register the protocol translator to Edge.

Parameters
requestThe jsonrpc request.
json_paramsThe parameter portion of the jsonrpc request.
resultThe jsonrpc result object to fill.
userdataThe user-supplied context data pointer.
Returns
0 if the protocol translator registration succeeded.
1 if an error occurred. Details are in the result parameter.
int renew_certificate ( json_t *  request,
json_t *  json_params,
json_t **  result,
void *  userdata 
)

Initiate certificate renewal operation for a certificate.

Parameters
requestThe jsonrpc request.
json_paramsThe parameter portion of the jsonrpc request.
resultThe jsonrpc result object to fill.
userdataThe user-supplied context data pointer.
Returns
0 if the renewal operation started successfully.
1 if an error occurred. Details are in the result parameter.
int write_to_pt ( edgeclient_request_context_t ctx,
void *  userdata 
)

Writes the updated values to the protocol translator.

Parameters
ctxThe user-supplied write context.
userdataThe user-supplied data.
Returns
0 if values were written successfully.
1 if the values couldn't be written.
int write_value ( json_t *  request,
json_t *  json_params,
json_t **  result,
void *  userdata 
)

Write endpoint device values.

Parameters
requestThe jsonrpc request.
json_paramsThe parameter portion of the jsonrpc request.
resultThe jsonrpc result object to fill.
userdataThe user-supplied context data pointer.
Returns
0 if the write value succeeded.
1 if an error occurred. Details are in the result parameter.