AppDynamics IoT C++ SDK
AppDynamics IoT C++ library contains code that facilitates capturing availability, usage, network performance and errors of an IoT Application.
appd_iot_def.h File Reference
#include <stdint.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  appd_iot_sdk_config_t
 AppDynamics SDK Configuration
Mandatory: All Fields. More...
 
struct  appd_iot_device_config_t
 AppDynamics Device Information
Mandatory: Device Type and Device ID Fields. More...
 
struct  appd_iot_data_t
 AppDynamics Associative Array Data Structure
Underlying implementation is a Sequential List of <key, value> pairs. More...
 
struct  appd_iot_custom_event_t
 AppDynamics Custom Event
Mandatory: type, summary and timestamp_ms Fields. More...
 
struct  appd_iot_network_request_event_t
 AppDynamics Network Request Event
Mandatory: url and timestamp_ms Fields. More...
 
struct  appd_iot_stack_frame_t
 AppDynamics Stack Frame
This structure captures a single element in the stack frame
Each stack frame should have atlease one of symbol_name, package_name or file_name. More...
 
struct  appd_iot_stack_trace_t
 AppDynamics Stack Trace
This structure captures the strack trace. More...
 
struct  appd_iot_error_event_t
 AppDynamics Error Event
This structure can be used to send error or exception or a crash.
Mandatory: name and timestamp_ms Fields. More...
 
struct  appd_iot_http_req_t
 AppDynamics HTTP Request Structure
Mandatory: All Fields
Data is provided in raw format. If data is sent in gzip format then add the http request header
"Content-Encoding: gzip". It is recommended to gzip data for efficient use of resources. More...
 
struct  appd_iot_http_resp_t
 AppDynamics HTTP Response Structure
Mandatory: One of the resp_code or error fields should be populated. More...
 
struct  appd_iot_http_cb_t
 AppDynamics HTTP Callback list
Mandatory: http_req_send_cb and http_resp_done_cb fields. More...
 

Macros

#define APPD_IOT_NUM_SERVER_CORRELATION_HEADERS   2
 

Typedefs

typedef void(* appd_iot_log_write_cb_t) (const char *logmsg, size_t logmsg_len)
 Log Write Callback implements the functionality to process log messages
The callback implementation reads log message and writes it to disk or prints to std terminal. More...
 
typedef void(* appd_iot_sdk_state_change_cb_t) (appd_iot_sdk_state_t sdk_state)
 This Callback function gets triggered whenever sdk state changes. SDK states are given in appd_iot_sdk_state_t.
SDK inital state is set to UNINITIALIZED. SDK state is set to ENABLED after init function (appd_iot_init_sdk(void)) is called. SDK state is set to DISABLED when APPDYNAMICS Collector indicates IoT application on the Controller is disabled due to license expiry, kill switch or data limit exceeded.
Users should periodically check on application status with APPDYNAMICS Collector and re-enable SDK using the API appd_iot_check_app_status(void). More...
 
typedef appd_iot_http_resp_t *(* appd_iot_http_req_send_cb_t) (const appd_iot_http_req_t *http_req)
 Http Request Send Callback implements the functionality to send HTTP Request
The callback implementation reads in http_req parameters, executes http request and populates http response params. Any server redirections (http status: 3xx) must be handled by the http client library. More...
 
typedef void(* appd_iot_http_resp_done_cb_t) (appd_iot_http_resp_t *http_resp)
 Http Response Done Callback is triggered after http send callback returns
and http response is processed by SDK.Any cleanup work can be part of this function
which includes freeing the memory allocated to http_resp struct.
This callback will be called even if send callback returns error code. More...
 

Enumerations

enum  appd_iot_error_code_t {
  APPD_IOT_SUCCESS, APPD_IOT_ERR_INVALID_INPUT, APPD_IOT_ERR_MAX_LIMIT, APPD_IOT_ERR_NETWORK_ERROR,
  APPD_IOT_ERR_NETWORK_REJECT, APPD_IOT_ERR_NETWORK_UNREACHABLE, APPD_IOT_ERR_NETWORK_NOT_AVAILABLE, APPD_IOT_ERR_NULL_PTR,
  APPD_IOT_ERR_INTERNAL, APPD_IOT_ERR_NOT_SUPPORTED, APPD_IOT_ERR_SDK_NOT_ENABLED, APPD_IOT_MAX_ERROR_CODES
}
 Error Code Enums for SDK log. More...
 
enum  appd_iot_sdk_state_t {
  APPD_IOT_SDK_UNINITIALIZED, APPD_IOT_SDK_ENABLED, APPD_IOT_SDK_DISABLED_KILL_SWITCH, APPD_IOT_SDK_DISABLED_LICENSE_EXPIRED,
  APPD_IOT_SDK_DISABLED_DATA_LIMIT_EXCEEDED, APPD_IOT_MAX_SDK_STATES
}
 Enums for SDK State. More...
 
enum  appd_iot_error_severity_t { APPD_IOT_ERR_SEVERITY_ALERT, APPD_IOT_ERR_SEVERITY_CRITICAL, APPD_IOT_ERR_SEVERITY_FATAL, APPD_IOT_ERR_MAX_SEVERITY_LEVELS }
 Severity of the errors occured in the application. More...
 
enum  appd_iot_log_level_t {
  APPD_IOT_LOG_OFF, APPD_IOT_LOG_ERROR, APPD_IOT_LOG_WARN, APPD_IOT_LOG_INFO,
  APPD_IOT_LOG_DEBUG, APPD_IOT_LOG_VERBOSE, APPD_IOT_LOG_ALL, APPD_IOT_MAX_LOG_LEVELS
}
 Log Level Enums returned for all API calls. More...
 
enum  appd_iot_data_types_t {
  APPD_IOT_INTEGER, APPD_IOT_DOUBLE, APPD_IOT_STRING, APPD_IOT_BOOLEAN,
  APPD_IOT_DATETIME
}
 AppDynamics Data Types. More...
 

Functions

static void appd_iot_data_set_integer (appd_iot_data_t *data, const char *key, int64_t value)
 Sets data field attributes for 64 bit integer value. More...
 
static void appd_iot_data_set_double (appd_iot_data_t *data, const char *key, double value)
 Sets data field attributes for double value. More...
 
static void appd_iot_data_set_datetime (appd_iot_data_t *data, const char *key, int64_t value)
 Sets data field attributes for datetime value. More...
 
static void appd_iot_data_set_boolean (appd_iot_data_t *data, const char *key, bool value)
 Sets data field attributes for boolean value. More...
 
static void appd_iot_data_set_string (appd_iot_data_t *data, const char *key, const char *value)
 Sets data field attributes for string value. More...
 
static void appd_iot_init_to_zero (void *ptr, size_t size)
 Initializes memory block pointed by ptr to zero. More...
 
const char * appd_iot_error_code_to_str (appd_iot_error_code_t error_code) __APPD_IOT_API
 Convert error code to string. More...
 
const char * appd_iot_sdk_state_to_str (appd_iot_sdk_state_t sdk_state) __APPD_IOT_API
 Convert sdk state to string. More...
 
const appd_iot_data_tappd_iot_get_server_correlation_headers (void) __APPD_IOT_API
 Get Server Correlation headers in {key,value} format that need to be added to every outgoing http request to enable capturing Business Transaction (BT). More...
 

Macro Definition Documentation

◆ APPD_IOT_NUM_SERVER_CORRELATION_HEADERS

#define APPD_IOT_NUM_SERVER_CORRELATION_HEADERS   2

Number of Server Correlation Headers

Typedef Documentation

◆ appd_iot_log_write_cb_t

typedef void(* appd_iot_log_write_cb_t) (const char *logmsg, size_t logmsg_len)

Log Write Callback implements the functionality to process log messages
The callback implementation reads log message and writes it to disk or prints to std terminal.

Parameters
logmsgcontains log message. Newline is not appended to the log message.
Each logmsg is appended with a tag "E/APPDYNAMICS:".
First Letter in the tag indicates log level as given in appd_iot_log_level_t.
logmsg not to be freed in the log write callback. It is freed by the caller of log write cb.
logmsg_lencontains the length of log message

◆ appd_iot_sdk_state_change_cb_t

typedef void(* appd_iot_sdk_state_change_cb_t) (appd_iot_sdk_state_t sdk_state)

This Callback function gets triggered whenever sdk state changes. SDK states are given in appd_iot_sdk_state_t.
SDK inital state is set to UNINITIALIZED. SDK state is set to ENABLED after init function (appd_iot_init_sdk(void)) is called. SDK state is set to DISABLED when APPDYNAMICS Collector indicates IoT application on the Controller is disabled due to license expiry, kill switch or data limit exceeded.
Users should periodically check on application status with APPDYNAMICS Collector and re-enable SDK using the API appd_iot_check_app_status(void).

Parameters
sdk_stateindicates the new state of SDK.

◆ appd_iot_http_req_send_cb_t

typedef appd_iot_http_resp_t*(* appd_iot_http_req_send_cb_t) (const appd_iot_http_req_t *http_req)

Http Request Send Callback implements the functionality to send HTTP Request
The callback implementation reads in http_req parameters, executes http request and populates http response params. Any server redirections (http status: 3xx) must be handled by the http client library.

Parameters
http_reqcontains request parameters. The caller allocates memory and caller will free it.
Returns
appd_iot_http_resp_t contains response parameters. Memory is allocated within
callback function and can be freed as part of appd_iot_http_resp_done_cb_t callback function.

◆ appd_iot_http_resp_done_cb_t

typedef void(* appd_iot_http_resp_done_cb_t) (appd_iot_http_resp_t *http_resp)

Http Response Done Callback is triggered after http send callback returns
and http response is processed by SDK.Any cleanup work can be part of this function
which includes freeing the memory allocated to http_resp struct.
This callback will be called even if send callback returns error code.

Parameters
http_respcontains response parameters. This pointer is passed to free the memory
it points to. http_resp also has user_data field which is populated in http send callback
for internal purposes.

Enumeration Type Documentation

◆ appd_iot_error_code_t

Error Code Enums for SDK log.

Enumerator
APPD_IOT_SUCCESS 

Success

APPD_IOT_ERR_INVALID_INPUT 

Invalid Input Passed as Param

APPD_IOT_ERR_MAX_LIMIT 

Max Limit Reached

APPD_IOT_ERR_NETWORK_ERROR 

Network Request Error (Could be Client Error or Server Error)

APPD_IOT_ERR_NETWORK_REJECT 

Network Request Rejected

APPD_IOT_ERR_NETWORK_UNREACHABLE 

Host Not Reachable

APPD_IOT_ERR_NETWORK_NOT_AVAILABLE 

No Network Connectivity

APPD_IOT_ERR_NULL_PTR 

Encountered a NULL ptr

APPD_IOT_ERR_INTERNAL 

Internal Application Error

APPD_IOT_ERR_NOT_SUPPORTED 

Not Supported Functionality

APPD_IOT_ERR_SDK_NOT_ENABLED 

SDK is not in Enabled State

APPD_IOT_MAX_ERROR_CODES 

MAX Error Codes

28 {
Definition: appd_iot_def.h:50
Definition: appd_iot_def.h:44
Definition: appd_iot_def.h:42
Definition: appd_iot_def.h:36
Definition: appd_iot_def.h:40
Definition: appd_iot_def.h:38
Definition: appd_iot_def.h:48
appd_iot_error_code_t
Error Code Enums for SDK log.
Definition: appd_iot_def.h:27
Definition: appd_iot_def.h:52
Definition: appd_iot_def.h:32
Definition: appd_iot_def.h:30
Definition: appd_iot_def.h:46
Definition: appd_iot_def.h:34

◆ appd_iot_sdk_state_t

Enums for SDK State.

Enumerator
APPD_IOT_SDK_UNINITIALIZED 

SDK is Uninitialized

APPD_IOT_SDK_ENABLED 

SDK is Enabled

APPD_IOT_SDK_DISABLED_KILL_SWITCH 

SDK is Disabled by Controller by manually turning off Instrumentation

APPD_IOT_SDK_DISABLED_LICENSE_EXPIRED 

SDK is Disabled by Controller due to License Expiry

APPD_IOT_SDK_DISABLED_DATA_LIMIT_EXCEEDED 

SDK is Disabled by Controller due to Data Limit Exceeded

APPD_IOT_MAX_SDK_STATES 

MAX SDK States

60 {
appd_iot_sdk_state_t
Enums for SDK State.
Definition: appd_iot_def.h:59
Definition: appd_iot_def.h:62
Definition: appd_iot_def.h:64
Definition: appd_iot_def.h:68
Definition: appd_iot_def.h:66
Definition: appd_iot_def.h:72
Definition: appd_iot_def.h:70

◆ appd_iot_error_severity_t

Severity of the errors occured in the application.

Enumerator
APPD_IOT_ERR_SEVERITY_ALERT 

Errors that do not affect application

APPD_IOT_ERR_SEVERITY_CRITICAL 

Errors that affect application functionality

APPD_IOT_ERR_SEVERITY_FATAL 

Errors that result in application hang/resets

APPD_IOT_ERR_MAX_SEVERITY_LEVELS 

Max Number of Severity Levels

79 {
Definition: appd_iot_def.h:85
Definition: appd_iot_def.h:81
appd_iot_error_severity_t
Severity of the errors occured in the application.
Definition: appd_iot_def.h:78
Definition: appd_iot_def.h:87
Definition: appd_iot_def.h:83

◆ appd_iot_log_level_t

Log Level Enums returned for all API calls.

Enumerator
APPD_IOT_LOG_OFF 

No Logs generated by SDK

APPD_IOT_LOG_ERROR 

Error Messages only, this is default

APPD_IOT_LOG_WARN 

Warning Messages or higher

APPD_IOT_LOG_INFO 

Information, may be useful to developer

APPD_IOT_LOG_DEBUG 

Debug, useful for support personnel and developers

APPD_IOT_LOG_VERBOSE 

Verbose, useful for support personnel

APPD_IOT_LOG_ALL 

All messages

APPD_IOT_MAX_LOG_LEVELS 

Max Log Levels

95 {
Definition: appd_iot_def.h:111
Definition: appd_iot_def.h:107
Definition: appd_iot_def.h:97
Definition: appd_iot_def.h:101
appd_iot_log_level_t
Log Level Enums returned for all API calls.
Definition: appd_iot_def.h:94
Definition: appd_iot_def.h:109
Definition: appd_iot_def.h:103
Definition: appd_iot_def.h:105
Definition: appd_iot_def.h:99

◆ appd_iot_data_types_t

AppDynamics Data Types.

Enumerator
APPD_IOT_INTEGER 

Integer Value

APPD_IOT_DOUBLE 

Double Value

APPD_IOT_STRING 

String Value

APPD_IOT_BOOLEAN 

Boolean Value

APPD_IOT_DATETIME 

DateTime Value

186 {
Definition: appd_iot_def.h:192
Definition: appd_iot_def.h:194
Definition: appd_iot_def.h:188
Definition: appd_iot_def.h:190
Definition: appd_iot_def.h:196
appd_iot_data_types_t
AppDynamics Data Types.
Definition: appd_iot_def.h:185

Function Documentation

◆ appd_iot_data_set_integer()

static void appd_iot_data_set_integer ( appd_iot_data_t data,
const char *  key,
int64_t  value 
)
inlinestatic

Sets data field attributes for 64 bit integer value.

429 {
430  data->key = key;
431  data->intval = value;
433 }
const char * key
Definition: appd_iot_def.h:206
Definition: appd_iot_def.h:188
appd_iot_data_types_t value_type
Definition: appd_iot_def.h:215
int64_t intval
Definition: appd_iot_def.h:211

◆ appd_iot_data_set_double()

static void appd_iot_data_set_double ( appd_iot_data_t data,
const char *  key,
double  value 
)
inlinestatic

Sets data field attributes for double value.

439 {
440  data->key = key;
441  data->doubleval = value;
442  data->value_type = APPD_IOT_DOUBLE;
443 }
double doubleval
Definition: appd_iot_def.h:212
const char * key
Definition: appd_iot_def.h:206
Definition: appd_iot_def.h:190
appd_iot_data_types_t value_type
Definition: appd_iot_def.h:215

◆ appd_iot_data_set_datetime()

static void appd_iot_data_set_datetime ( appd_iot_data_t data,
const char *  key,
int64_t  value 
)
inlinestatic

Sets data field attributes for datetime value.

449 {
450  data->key = key;
451  data->datetimeval = value;
453 }
int64_t datetimeval
Definition: appd_iot_def.h:213
const char * key
Definition: appd_iot_def.h:206
appd_iot_data_types_t value_type
Definition: appd_iot_def.h:215
Definition: appd_iot_def.h:196

◆ appd_iot_data_set_boolean()

static void appd_iot_data_set_boolean ( appd_iot_data_t data,
const char *  key,
bool  value 
)
inlinestatic

Sets data field attributes for boolean value.

459 {
460  data->key = key;
461  data->boolval = value;
463 }
bool boolval
Definition: appd_iot_def.h:210
const char * key
Definition: appd_iot_def.h:206
Definition: appd_iot_def.h:194
appd_iot_data_types_t value_type
Definition: appd_iot_def.h:215

◆ appd_iot_data_set_string()

static void appd_iot_data_set_string ( appd_iot_data_t data,
const char *  key,
const char *  value 
)
inlinestatic

Sets data field attributes for string value.

469 {
470  data->key = key;
471  data->strval = value;
472  data->value_type = APPD_IOT_STRING;
473 }
Definition: appd_iot_def.h:192
const char * key
Definition: appd_iot_def.h:206
const char * strval
Definition: appd_iot_def.h:209
appd_iot_data_types_t value_type
Definition: appd_iot_def.h:215

◆ appd_iot_init_to_zero()

static void appd_iot_init_to_zero ( void *  ptr,
size_t  size 
)
inlinestatic

Initializes memory block pointed by ptr to zero.

479 {
480  memset(ptr, 0, size);
481 }

◆ appd_iot_error_code_to_str()

const char* appd_iot_error_code_to_str ( appd_iot_error_code_t  error_code)

Convert error code to string.

Parameters
error_codethat is to be converted to string
Returns
string representation of the error code
194 {
195  return error_code_to_str[error_code];
196 }
static const char * error_code_to_str[APPD_IOT_MAX_ERROR_CODES]
Definition: log.cpp:43

◆ appd_iot_sdk_state_to_str()

const char* appd_iot_sdk_state_to_str ( appd_iot_sdk_state_t  sdk_state)

Convert sdk state to string.

Parameters
sdk_statethat is to be converted to string
Returns
string representation of the sdk state
204 {
205  return sdk_state_to_str[sdk_state];
206 }
static const char * sdk_state_to_str[APPD_IOT_MAX_SDK_STATES]
Definition: log.cpp:70

◆ appd_iot_get_server_correlation_headers()

const appd_iot_data_t* appd_iot_get_server_correlation_headers ( void  )

Get Server Correlation headers in {key,value} format that need to be added to every outgoing http request to enable capturing Business Transaction (BT).

Returns
Server Correlation Headers. Total number of headers present is given by macro APPD_IOT_NUM_SERVER_CORRELATION_HEADERS. Do not modify or free returned headers.
205 {
207 }
static const appd_iot_data_t global_correlation_headers[APPD_IOT_NUM_SERVER_CORRELATION_HEADERS]
Definition: config.cpp:29