inline Uint32 ConfigValues::pack(UtilBuffer& buf) const { Uint32 len = getPackedSize(); void * tmp = buf.append(len); if(tmp == 0){ return 0; } return pack(tmp, len); }
inline bool Properties::pack(UtilBuffer &buf) const { Uint32 size = getPackedSize(); void *tmp_buf = buf.append(size); if(tmp_buf == 0) return false; bool ret = pack((Uint32 *)tmp_buf); if(ret == false) return false; return true; }
void MgmApiSession::getConfig(Parser_t::Context &, const class Properties &args) { Uint32 version, node = 0; args.get("version", &version); args.get("node", &node); const Config *conf = m_mgmsrv.getConfig(); if(conf == NULL) { m_output->println("get config reply"); m_output->println("result: Could not fetch configuration"); m_output->println(""); return; } if(node != 0){ bool compatible; switch (m_mgmsrv.getNodeType(node)) { case NDB_MGM_NODE_TYPE_NDB: compatible = ndbCompatible_mgmt_ndb(NDB_VERSION, version); break; case NDB_MGM_NODE_TYPE_API: case NDB_MGM_NODE_TYPE_MGM: compatible = ndbCompatible_mgmt_api(NDB_VERSION, version); break; default: m_output->println("get config"); m_output->println("result: unrecognignized node type"); m_output->println(""); return; } if (!compatible){ m_output->println("get config"); m_output->println("result: incompatible version mgmt 0x%x and node 0x%x", NDB_VERSION, version); m_output->println(""); return; } } NdbMutex_Lock(m_mgmsrv.m_configMutex); const ConfigValues * cfg = &conf->m_configValues->m_config; UtilBuffer src; cfg->pack(src); NdbMutex_Unlock(m_mgmsrv.m_configMutex); char *tmp_str = (char *) malloc(base64_needed_encoded_length(src.length())); (void) base64_encode(src.get_data(), src.length(), tmp_str); SLEEP_ERROR_INSERTED(1); m_output->println("get config reply"); m_output->println("result: Ok"); m_output->println("Content-Length: %d", strlen(tmp_str)); m_output->println("Content-Type: ndbconfig/octet-stream"); SLEEP_ERROR_INSERTED(2); m_output->println("Content-Transfer-Encoding: base64"); m_output->println(""); if(ERROR_INSERTED(3)) { int l= strlen(tmp_str); tmp_str[l/2]='\0'; m_output->println(tmp_str); NdbSleep_SecSleep(10); } m_output->println(tmp_str); free(tmp_str); return; }
inline bool Properties::unpack(UtilBuffer &buf) { return unpack((const Uint32 *)buf.get_data(), buf.length()); }
inline bool ConfigValuesFactory::unpack(const UtilBuffer& buf){ return unpack(buf.get_data(), buf.length()); }