static qeo_retcode_t fwd_server_register(qeo_factory_t *factory) { qeo_retcode_t rc = QEO_OK; if (!qeocore_parameter_get_number("FWD_DISABLE_LOCATION_SERVICE")) { qeo_security_hndl qeo_sec = factory->qeo_sec; qeo_mgmt_client_retcode_t mgmt_rc = QMGMTCLIENT_EFAIL; qeo_mgmt_client_ctx_t *mgmt_client_ctx = NULL; qeo_mgmt_client_locator_t locator={QMGMT_LOCATORTYPE_TCPV4, factory->fwd.locator->address, factory->fwd.locator->port}; int nrOfLocators = 1; do { if ((rc = qeo_security_get_mgmt_client_ctx(qeo_sec, &mgmt_client_ctx)) != QEO_OK) { qeo_log_e("register_forwarder get security mgmt client failed (rc=%d)", rc); break; } /* Now register the forwarder. */ qeo_log_i("register the forwarder with locator address %s:port %d\n", locator.address, locator.port); if ((mgmt_rc = qeo_mgmt_client_register_forwarder(mgmt_client_ctx, factory->qeo_id.url, &locator, nrOfLocators, ssl_ctx_cb, qeo_sec)) != QMGMTCLIENT_OK) { qeo_log_e("register forwarder failed (rc=%d)", mgmt_rc); rc = QEO_EFAIL; break; } } while (0); } return rc; }
static void on_qeocore_on_factory_init_done(qeo_factory_t *factory, bool success) { uintptr_t puserdata = 0; factory_dispatcher_cookie *dc = NULL; qeo_json_factory_listener_t *listener = NULL; do { if ((qeocore_factory_get_user_data(factory, &puserdata)) != QEO_OK) { qeo_log_e("qeocore_factory_get_user_data failed"); return; } dc = (factory_dispatcher_cookie *)puserdata; if (dc == NULL) { qeo_log_e("dc == NULL"); return; } listener = (qeo_json_factory_listener_t *)dc->listener; if (listener == NULL) { qeo_log_e("listener == NULL"); return; } if (success) { listener->on_factory_init_done(factory, dc->userdata); } else { listener->on_factory_init_done(NULL, dc->userdata); qeocore_factory_close(factory); free(dc); } } while (0); }
static char* get_qeo_dir(void) { char *qeo_dir = NULL; const struct passwd *pwd; do { qeo_dir = qeo_strdup_ret(getenv("QEO_STORAGE_DIR")); if (qeo_dir != NULL){ break; } pwd = getpwuid(getuid()); if (pwd == NULL || pwd->pw_dir == NULL) { qeo_log_e("Failed in getting the home directory"); break; } if (asprintf(&qeo_dir, "%s/%s", pwd->pw_dir, LINUX_STORAGE_DIR) == -1){ qeo_log_e("No mem"); break; } } while(0); qeo_log_i("Qeo directory is %s", qeo_dir); return (char*)qeo_dir; }
static qeo_util_retcode_t remote_registration(qeo_platform_security_context_t context, const char *rrf){ qeo_util_retcode_t ret = QEO_UTIL_EFAIL; FILE *f = NULL; do { char suggested_username[64]; unsigned long registration_window; /* file/fifo should be created in advance */ if ((f = fopen(rrf, "r")) == NULL){ qeo_log_e("Could not open remote registration file for reading"); break; } if (fscanf(f, "%63s %lu", suggested_username, ®istration_window) != 2){ qeo_log_e("Could not read from remote_registration file"); break; } ret = qeo_platform_set_remote_registration_params(context, suggested_username, registration_window); } while (0); if (f != NULL){ fclose(f); } return ret; }
static qeo_retcode_t fwd_server_unregister(qeo_factory_t *factory) { qeo_retcode_t rc = QEO_OK; if (!qeocore_parameter_get_number("FWD_DISABLE_LOCATION_SERVICE")) { qeo_security_hndl qeo_sec = factory->qeo_sec; qeo_mgmt_client_retcode_t mgmt_rc = QMGMTCLIENT_EFAIL; qeo_mgmt_client_ctx_t *mgmt_client_ctx = NULL; int nrOfLocators = 0; do { if (QEO_OK != (rc = qeo_security_get_mgmt_client_ctx(qeo_sec, &mgmt_client_ctx))) { qeo_log_e("unregister_forwarder get security mgmt client failed (rc=%d)", rc); break; } /* Now register the forwarder. */ qeo_log_i("unregister the forwarder"); if ((mgmt_rc = qeo_mgmt_client_register_forwarder(mgmt_client_ctx, factory->qeo_id.url, NULL, nrOfLocators, ssl_ctx_cb, qeo_sec)) != QMGMTCLIENT_OK) { qeo_log_e("unregister forwarder failed (rc=%d)", mgmt_rc); rc = QEO_EFAIL; break; } } while (0); } return rc; }
static char* get_uuid(const char* path) { if (path == NULL ) return strdup(""); FILE* file = NULL; char temp[128]; /* e9cabebc-923b-4932-a534-9578a6904bf8 */ char* result = NULL; file = fopen(path, "rb"); if (file == NULL ) { qeo_log_e("Could not open file: %s", path); return strdup(""); } if (fgets(temp, sizeof(temp), file) == NULL){ fclose(file); qeo_log_e("Could not get UUID"); return strdup(""); } fclose(file); result = strdup(temp); if (result == NULL ) { qeo_log_e("Could not allocate memory.."); return strdup(""); } return result; }
void dump_openssl_error_stack(const char *msg) { unsigned long err; const char *file, *data; int line, flags; char buf[256]; qeo_log_e("%s", msg); while ((err = ERR_get_error_line_data(&file, &line, &data, &flags))) { qeo_log_e("err %lu @ %s:%d -- %s\n", err, file, line, ERR_error_string(err, buf)); } ERR_clear_error(); }
qeo_json_state_writer_t *qeo_json_factory_create_state_writer(const qeo_factory_t *factory, const char *json_type, const qeo_json_state_writer_listener_t *listener, uintptr_t userdata) { qeo_json_state_writer_t *writer = NULL; qeojson_writer_t *jsonwriter = NULL; if ((NULL == factory) || (json_type == NULL)) { return NULL; } do { jsonwriter = qeojson_writer_open( factory, QEOJSON_WRITER_TYPE_STATE_WRITER, (void *) listener, json_type, userdata); if (jsonwriter == NULL) { qeo_log_e("qeojson_writer_open failed"); break; } writer = (qeo_json_state_writer_t *) jsonwriter; } while (0); return writer; }
qeo_retcode_t qeo_json_state_change_reader_policy_update(const qeo_json_state_change_reader_t *reader, const char *json_policy) { qeo_retcode_t rc = QEO_EINVAL; qeojson_reader_t *jsonreader = (qeojson_reader_t *) reader; if (NULL == reader) { return rc; } do { if (NULL != json_policy) { qeojson_policy_lock(&jsonreader->policy_mutex); rc = qeojson_policy_update(jsonreader->policy_cache, json_policy); qeojson_policy_unlock(&jsonreader->policy_mutex); if (rc != QEO_OK) { qeo_log_e("qeojson_policy_update failed"); break; } } rc = qeocore_reader_policy_update(jsonreader->reader); } while (0); return rc; }
qeo_json_state_change_reader_t *qeo_json_factory_create_state_change_reader(const qeo_factory_t *factory, const char *json_type, const qeo_json_state_change_reader_listener_t *listener, uintptr_t userdata) { qeo_json_state_change_reader_t *reader = NULL; qeojson_reader_t *jsonreader = NULL; if ((NULL == json_type) || (NULL == factory) || (NULL == listener) || ((NULL == listener->on_data) && (NULL == listener->on_remove))) { return NULL; } do { jsonreader = qeojson_reader_open( factory, QEOJSON_READER_TYPE_STATE_CHANGE_READER, (void *) listener, json_type, userdata); if (jsonreader == NULL) { qeo_log_e("qeojson_reader_open failed"); break; } reader = (qeo_json_state_change_reader_t *) jsonreader; } while (0); return reader; }
static void on_di_data_available(const qeocore_reader_t *reader, const qeocore_data_t *data, uintptr_t userdata){ qeo_retcode_t ret = QEO_OK; switch (qeocore_data_get_status(data)) { case QEOCORE_NOTIFY: qeo_log_d("Notify received"); break; case QEOCORE_DATA: qeo_log_d("Data received"); ret = qeo_walk_tsm_for_unmarshal(_types, org_qeo_system_DeviceInfo_type, data, (uintptr_t)&_rcvd_di, QEO_T2D_FLAGS_ALL, &_di_ucbs); break; case QEOCORE_NO_MORE_DATA: qeo_log_d("No more data received"); break; case QEOCORE_REMOVE: qeo_log_d("remove received"); break; case QEOCORE_ERROR: qeo_log_e("no callback called due to prior error"); break; } ck_assert_int_eq(ret, QEO_OK); }
static bool simplechat_ChatMessage_get_val_cb(uintptr_t in_data, const char *name, CDR_TypeCode_t type, qeo_t2d_types_t *value){ const org_qeo_sample_simplechat_ChatMessage_t *chat_msg = (const org_qeo_sample_simplechat_ChatMessage_t *)in_data; if (strcmp(name, "from") == 0){ value->string_val = chat_msg->from; } else if (strcmp(name, "fromExtra") == 0){ value->typeref.ref = (uintptr_t)&chat_msg->fromExtra; value->typeref.mcbs = &_uuid_mcbs; } else if (strcmp(name, "message") == 0){ value->string_val = chat_msg->message; } else if (strcmp(name, "extraInfo") == 0){ value->seq.seq_ref = (uintptr_t)&chat_msg->extraInfo; value->seq.seq_size = DDS_SEQ_LENGTH(chat_msg->extraInfo); value->seq.mcbs = &_sc_extraInfo_mcbs; } else if (strcmp(name, "list") == 0){ value->seq.seq_ref = (uintptr_t)&chat_msg->list; value->seq.seq_size = DDS_SEQ_LENGTH(chat_msg->list); value->seq.mcbs = &_sc_list_mcbs; } else if (strcmp(name, "maincolor") == 0){ ck_assert_int_eq(type, CDR_TYPECODE_ENUM); value->enum_val = chat_msg->maincolor; } else if (strcmp(name, "colorlist") == 0){ ck_assert_int_eq(type, CDR_TYPECODE_SEQUENCE); value->seq.seq_ref = (uintptr_t)&chat_msg->colorlist; value->seq.seq_size = DDS_SEQ_LENGTH(chat_msg->colorlist); value->seq.mcbs = &_sc_colorlist_mcbs; } else { qeo_log_e("unknown field %s", name); return false; } return true; }
/** * This function assigns to each of the passed in qeo_platform_device_info struct constituents the respective * information fetched somehow, mainly with qeo_get_linux_dev_prop. * */ const qeo_platform_device_info *get_default_device_info(void) { char* path = NULL; if (_init == true) { return &_default_device_info; } if ((asprintf(&path, "%s/%s", get_default_device_storage_path(), LINUX_UUID_STORAGE_FILE) < 0) || (path == NULL )) { qeo_log_e("Failed to allocate memory for the UUID storage path string !"); return NULL; } _default_device_info.qeoDeviceId = qeo_get_device_uuid(path, UUID_GENERATOR); _default_device_info.manufacturer = qeo_get_linux_dev_prop(LINUX_MANUFACTURER); _default_device_info.modelName = qeo_get_linux_dev_prop(LINUX_MODEL_NAME); _default_device_info.productClass = qeo_get_linux_dev_prop(LINUX_PRODUCT_CLASS); _default_device_info.hardwareVersion = qeo_get_linux_dev_prop(LINUX_HW_VERSION); _default_device_info.softwareVersion = qeo_get_linux_dev_prop(LINUX_SW_VERSION); _default_device_info.userFriendlyName = qeo_get_linux_dev_prop(LINUX_USER_FRIENDLY_NAME); _default_device_info.serialNumber = qeo_get_linux_dev_prop(LINUX_SERIAL_NUMBER); _default_device_info.configURL = qeo_get_linux_dev_prop(LINUX_CONFIG_URL); _init = true; free(path); return &_default_device_info; }
/*####################################################################### # DeviceInfo ########################################################################*/ static bool deviceinfo_get_val_cb(uintptr_t in_data, const char *name, CDR_TypeCode_t type, qeo_t2d_types_t *value){ const org_qeo_system_DeviceInfo_t *di = (const org_qeo_system_DeviceInfo_t *)in_data; if (strcmp(name, "deviceId") == 0){ value->typeref.ref = (uintptr_t)&di->deviceId; value->typeref.mcbs = &_deviceid_mcbs; } else if (strcmp(name, "manufacturer") == 0){ value->string_val = di->manufacturer; } else if (strcmp(name, "modelName") == 0){ value->string_val = di->modelName; } else if (strcmp(name, "productClass") == 0){ value->string_val = di->productClass; } else if (strcmp(name, "serialNumber") == 0){ value->string_val = di->serialNumber; } else if (strcmp(name, "hardwareVersion") == 0){ value->string_val = di->hardwareVersion; } else if (strcmp(name, "softwareVersion") == 0){ value->string_val = di->softwareVersion; } else if (strcmp(name, "userFriendlyName") == 0){ value->string_val = di->userFriendlyName; } else if (strcmp(name, "configURL") == 0){ value->string_val = di->configURL; } else { qeo_log_e("unknown field %s", name); return false; } return true; }
void fwd_destroy(qeo_factory_t *factory) { lock(&factory->mutex); if (true == factory->fwd.rqst_pending) { /* Wait untill the fwd request is finished before continuing. */ qeo_log_i("waiting for the fwd request to finish."); pthread_cond_wait(&factory->fwd.wait_rqst_finished, &factory->mutex); } unlock(&factory->mutex); if (factory->flags.is_forwarder) { fwd_server_unregister(factory); if (FWD_STATE_ENABLED == factory->fwd.u.server.state) { if (QEO_OK != fwd_server_instance_remove(factory)) { qeo_log_e("failed to remove instance from forwarder topic"); } } if (NULL != factory->fwd.u.server.writer) { qeocore_writer_close(factory->fwd.u.server.writer); } } if (NULL != factory->fwd.reader) { qeocore_reader_close(factory->fwd.reader); } if (NULL != factory->fwd.timer) { DDS_Timer_delete(factory->fwd.timer); } pthread_cond_destroy(&factory->fwd.wait_rqst_finished); fwd_locator_destroy(factory); }
static qeo_retcode_t object_add_member(const qeo_factory_t *factory, qeocore_type_t *type, const char *member_name, json_t *member) { qeo_retcode_t result = QEO_EFAIL; qeocore_type_t *qeoType = NULL; qeocore_member_id_t qeo_member_id = QEOCORE_MEMBER_ID_DEFAULT; json_t *member_key = json_object_get(member, KEY_KEY); // optional => BOOLEAN json_t *member_id = json_object_get(member, KEY_ID); // optional => INTxx assert(factory != NULL); if (((NULL != member_key) && !json_is_boolean(member_key)) || ((NULL != member_id) && !json_is_integer(member_id)) || (NULL == member_name)) { // syntax error return QEO_EINVAL; } qeo_log_d("Processing %s", member_name); qeoType = build_member_type(factory, member); if (NULL == qeoType) { qeo_log_e("Could not build member_type"); return result; } bool is_key = (member_key && json_is_true(member_key)); do { result = qeocore_type_struct_add(type, // container qeoType, // new member to add member_name, // name of member &qeo_member_id, // member id is_key ? QEOCORE_FLAG_KEY : 0); // flag if (QEO_OK != result) { qeo_log_e("qeocore_type_struct_add failed for member %s", member_name); break; } qeocore_type_free(qeoType); // Modify the json member to add/update the qeo member id json_object_set_new(member, KEY_ID, json_integer(qeo_member_id)); } while (0); return result; }
static qeo_retcode_t fwd_get_list(qeo_factory_t *factory) { qeo_retcode_t rc = QEO_OK; if (!qeocore_parameter_get_number("FWD_DISABLE_LOCATION_SERVICE")) { qeo_security_hndl qeo_sec = factory->qeo_sec; qeo_mgmt_client_retcode_t mgmt_rc = QMGMTCLIENT_EFAIL; qeo_mgmt_client_ctx_t *mgmt_client_ctx = NULL; do { if ((rc = qeo_security_get_mgmt_client_ctx(qeo_sec, &mgmt_client_ctx)) != QEO_OK) { qeo_log_e("get_forwarders get security mgmt client failed (rc=%d)", rc); break; } /* Factory is already locked when calling this function. */ if (true == factory->fwd.rqst_pending) { /* Just break, we will retry later. */ qeo_log_i("no need to send request (previous fwd request still ongoing)"); break; } /* Now get the list of forwarders. */ factory->fwd.rqst_pending = true; mgmt_rc = qeo_mgmt_client_get_forwarders(mgmt_client_ctx, factory->qeo_id.url, forwarder_cb, result_cb, factory, ssl_ctx_cb, qeo_sec); if (mgmt_rc == QMGMTCLIENT_OK) { qeo_log_d("get_forwarders succeeded"); } else { factory->fwd.rqst_pending = false; /* result callback will not be called. */ if ((mgmt_rc == QMGMTCLIENT_ESSL) || (mgmt_rc == QMGMTCLIENT_ENOTALLOWED)) { qeo_log_e("get_forwarders failed (rc=%d), aborting", mgmt_rc); rc = QEO_EFAIL; break; } else { qeo_log_e("get_forwarders failed (rc=%d), ignoring", mgmt_rc); } } } while (0); } return rc; }
static qeo_platform_device_id qeo_get_device_uuid(const char* platform_storage_filepath, const char* generator_path) { FILE* file = NULL; char* result_uuid = NULL; do { file = fopen(platform_storage_filepath, "r"); if (file != NULL ) { fclose(file); qeo_log_i("Fetching the existing UUID"); result_uuid = get_uuid(platform_storage_filepath); break; } qeo_log_i("Creating a new UUID, because %s not found", platform_storage_filepath); result_uuid = get_uuid(generator_path); if (NULL == result_uuid) { qeo_log_e("Failed to get UUID"); break; } FILE* fp = fopen(platform_storage_filepath, "w"); if (fp != NULL ) { qeo_log_i("Writing the new UUID"); fprintf(fp, "%s", result_uuid); fclose(fp); } else { qeo_log_e("Failed to open %s", platform_storage_filepath); } } while (0); qeo_platform_device_id res = char_to_struct(result_uuid); free(result_uuid); return res; }
char* qeo_strdup_ret(const char* ret_str) { char *ret = NULL; if (ret_str) { if ((ret = strdup(ret_str)) == NULL ) { qeo_log_e("Failed to duplicate string"); } } return ret; }
static qeo_retcode_t object_to_data(const json_t *typedesc, json_t *json_data, qeocore_data_t *data) { qeo_retcode_t result = QEO_OK; json_t *properties = json_object_get(typedesc, KEY_PROPERTIES); if ((NULL != properties) && (json_is_object(properties))) { const char *prop_name = NULL; json_t *prop_value = NULL; void *iter = json_object_iter(properties); while (iter) { // Get type name and value prop_name = json_object_iter_key(iter); prop_value = json_object_iter_value(iter); if ((NULL == prop_value) || (!json_is_object(prop_value))) { result = QEO_EFAIL; break; } // Get the corresponding value from the json_data json_t *value = json_object_get(json_data, prop_name); if (NULL == value) { qeo_log_e("json_object_get failed for property: %s", prop_name); result = QEO_EFAIL; break; } if (QEO_OK != member_to_data(prop_value, value, data)) { qeo_log_e("member_to_data failed for property: %s", prop_name); result = QEO_EFAIL; break; } iter = json_object_iter_next(properties, iter); } } return result; }
void __attribute__ ((constructor)) default_impl_init(void){ #else void __attribute__ ((constructor(1000))) default_impl_init(void){ #endif qeo_util_retcode_t ret; if ((ret = qeo_platform_init(0, &_default_platform_cbs)) != QEO_UTIL_OK){ qeo_log_e("Could not init qeo platform layer with default implementation"); return; } if (qeo_platform_set_device_info(get_default_device_info()) != QEO_UTIL_OK){ qeo_log_e("Could not set device info"); return; } if (qeo_platform_set_device_storage_path(get_default_device_storage_path()) != QEO_UTIL_OK){ qeo_log_e("Could not set device storage path"); return; } }
qeo_retcode_t qeo_json_get_device_id(char **json_device_id) { qeo_retcode_t ret = QEO_EINVAL; const qeo_platform_device_info *qeo_dev_info = NULL; json_t *device_id = NULL; char *upper = NULL; char *lower = NULL; do { if (NULL == json_device_id) { qeo_log_e("NULL == json_device_id"); break; } qeo_dev_info = qeo_platform_get_device_info(); if (qeo_dev_info == NULL) { qeo_log_d("qeo_platform_get_device_info failed"); ret = QEO_EFAIL; break; } device_id = json_object(); if (NULL == device_id) { qeo_log_e("unable to create new JSON object"); break; } if (-1 == asprintf(&upper, "%" PRId64, qeo_dev_info->qeoDeviceId.upperId)) { qeo_log_e("asprintf failed"); break; } if (-1 == asprintf(&lower, "%" PRId64, qeo_dev_info->qeoDeviceId.lowerId)) { qeo_log_e("asprintf failed"); break; } if (0 != json_object_set_new(device_id, "upper", json_string(upper))) { qeo_log_e("json_object_set_new failed"); break; } if (0 != json_object_set_new(device_id, "lower", json_string(lower))) { qeo_log_e("json_object_set_new failed"); break; } *json_device_id = json_dumps(device_id, JSON_INDENT(4)); ret = QEO_OK; } while (0); free(upper); free(lower); return ret; }
qeo_retcode_t fwd_init_pre_auth(qeo_factory_t *factory) { qeo_retcode_t rc = QEO_OK; factory->flags.is_forwarder = (NULL != factory->listener.on_fwdfactory_get_public_locator ? 1 : 0); do { pthread_cond_init(&factory->fwd.wait_rqst_finished, NULL); factory->fwd.timer = DDS_Timer_create("qeofwd"); if (NULL == factory->fwd.timer) { rc = QEO_ENOMEM; qeo_log_e("failed to create forwarder timer"); break; } if (factory->flags.is_forwarder) { /* enable forwarder logic */ rc = ddsrc_to_qeorc(DDS_parameter_set("FORWARD", "15")); if (QEO_OK != rc) { qeo_log_e("failed to enable FORWARD"); break; } } } while (0); return rc; }
static qeo_retcode_t fwd_server_start_forwarding(qeo_factory_t *factory) { qeo_retcode_t rc = QEO_EFAIL; char buf[64]; snprintf(buf, sizeof(buf), "%s:%d", factory->fwd.locator->address, factory->fwd.locator->port); if (DDS_RETCODE_OK != DDS_parameter_set("TCP_PUBLIC", buf)) { qeo_log_e("failed to set public IP address"); } else { rc = fwd_server_instance_publish(factory); if (QEO_OK != rc) { qeo_log_e("failed to publish instance on forwarder topic"); } else { rc = fwd_server_register(factory); if (QEO_OK != rc) { qeo_log_e("failed to register at location service"); } } } return rc; }
void qeo_mgmt_curl_util_shutdown_connections(qeo_mgmt_client_ctx_t* ctx) { qeo_log_d("qeo_mgmt_curl_util_shutdown_connections"); if (ctx) { if (_lock_fd_mutex(ctx)) { qeo_mgmt_fd_link_t* fd_link = ctx->fd_list; while (fd_link) { shutdown(fd_link->fd, SHUT_RDWR); fd_link = fd_link->next; } ctx->is_closed = true; _unlock_fd_mutex(ctx); } else { qeo_log_e("Can't take mgmt ctx lock"); } } }
static bool simplechat_ChatMessage_colorlist_set_seq_val_cb(uintptr_t out_data, int index, CDR_TypeCode_t type, qeo_t2d_types_t *value){ DDS_VoidPtrSeq *seq = (DDS_VoidPtrSeq *)out_data; switch(type){ case CDR_TYPECODE_ENUM: ((qeo_enum_value_t *)DDS_SEQ_DATA(*seq))[index] = value->enum_val; break; default: qeo_log_e("Unsupported type %d", type); return false; } return true; }
/*####################################################################### # STATIC FUNCTION IMPLEMENTATION # ########################################################################*/ static int verify_server_cb(int ok, X509_STORE_CTX *ctx) { qeo_log_d("Verifying server, pre-verify is %s", ok ? "ok" : "not ok"); if (!ok) { X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx); int err = X509_STORE_CTX_get_error(ctx); int depth = X509_STORE_CTX_get_error_depth(ctx); char subj[256], issuer[256]; X509_NAME_oneline(X509_get_subject_name(err_cert), subj, sizeof(subj)); X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), issuer, sizeof(issuer)); qeo_log_e("peer certificate verification failed: %s (@depth=%d, subject=%s, issuer=%s)", X509_verify_cert_error_string(err), depth, subj, issuer); } /* no extra verification needed */ return ok; }
qeo_retcode_t data_from_json(const json_t *typedesc, json_t *json_data, qeocore_data_t *data) { qeo_retcode_t ret = QEO_EINVAL; do { if ((NULL == typedesc) || (NULL == json_data) || (NULL == data)) { break; } ret = object_to_data(typedesc, json_data, data); if (ret != QEO_OK) { qeo_log_e("Could not convert object to data"); break; } } while (0); return ret; }
qeocore_type_t *types_from_json(const qeo_factory_t *factory, json_t *typedesc) { qeocore_type_t *qeocore_top_type = NULL; do { if ((NULL == typedesc) || (NULL == factory)){ break; } qeocore_top_type = build_object(factory, typedesc); if (NULL == qeocore_top_type) { qeo_log_e("build_object failed"); break; } } while (0); return qeocore_top_type; }
static bool simplechat_ChatMessage_list_set_seq_val_cb(uintptr_t out_data, int index, CDR_TypeCode_t type, qeo_t2d_types_t *value){ org_qeo_wifi_ScanList_list_seq *listEntry = (org_qeo_wifi_ScanList_list_seq *)out_data; switch(type){ case CDR_TYPECODE_STRUCT: ck_assert_str_eq(value->typeref.name, org_qeo_wifi_ScanListEntry_type[0].name); value->typeref.ref = (uintptr_t)(DDS_SEQ_ITEM_PTR(*listEntry, index)); value->typeref.ucbs = &_sl_ucbs; break; default: qeo_log_e("Unsupported type %d", type); return false; } return true; }