本文整理汇总了C++中MSG_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ MSG_ERROR函数的具体用法?C++ MSG_ERROR怎么用?C++ MSG_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MSG_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fwd_src_mapping_set
/**
* \brief Set a mapping of private Template ID to shared Template ID
* \param[in,out] src Flow source
* \param[in] old_id Private Template ID
* \param[in] new_id Shared Template ID
*/
static void fwd_src_mapping_set(fwd_source_t *src, uint16_t old_id,
uint16_t new_id)
{
// Set the mapping
uint16_t *group = src->map[old_id / GROUP_SIZE];
if (!group) {
// Not found -> create a new group
uint16_t **new_grp = &src->map[old_id / GROUP_SIZE];
*new_grp = calloc(GROUP_SIZE, sizeof(*group));
if (*new_grp == NULL) {
MSG_ERROR(msg_module, "Memory allocation failed (%s:%d)",
__FILE__, __LINE__);
return;
}
group = *new_grp;
}
if (fwd_odid_template_increment(src->maintainer, new_id)) {
MSG_ERROR(msg_module, "Unable to update a number of references to "
"a template (ID: %" PRIu16 ").", new_id);
}
MSG_DEBUG(msg_module, "A new template mapping of a source with ODID "
"%" PRIu32 " (private: %" PRIu16 " -> share: %" PRIu16 ").",
src->odid, old_id, new_id);
group[old_id % GROUP_SIZE] = new_id;
}
示例2: calloc
/**
* \brief Create a template record
* \param[in] rec Binary template record
* \param[in] length Length of the binary template record (octets)
* \param[in] type Type of the template (#TM_TEMPLATE or #TM_OPTIONS_TEMPLATE)
* \param[in] new_id New Template ID
* \return Pointer or NULL
*/
static fwd_tmplt_t *fwd_tmplt_create(const struct ipfix_template_record *rec,
size_t length, int type, uint16_t new_id)
{
fwd_tmplt_t *res = calloc(1, sizeof(*res));
if (!res) {
MSG_ERROR(msg_module, "Memory allocation failed (%s:%d)",
__FILE__, __LINE__);
return NULL;
}
// Copy the template record
res->rec = malloc(length);
if (!res->rec) {
MSG_ERROR(msg_module, "Memory allocation failed (%s:%d)",
__FILE__, __LINE__);
free(res);
return NULL;
}
memcpy(res->rec, rec, length);
res->rec->template_id = htons(new_id);
res->length = length;
res->id = new_id;
res->ref_cnt = 0;
res->type = type;
return res;
}
示例3: sql_query
int KULLANICILAR_FORMU::CHECK_UPDATE (int p_kullanici_id )
{
SQL_QUERY sql_query ( G_YONETIM_DB );
sql_query.PREPARE_SELECT ( "ynt_kullanicilar","kullanici_id","kullanici_kodu = :kullanici_kodu "
"AND silinmis_mi = :silinmis_mi ","" );
sql_query.SET_VALUE ( ":kullanici_kodu" , m_ui->lineEdit_kullanici_kodu->text() );
sql_query.SET_VALUE ( ":silinmis_mi" ,0 );
if ( sql_query.SELECT() > 0 ) {
sql_query.NEXT();
if ( sql_query.VALUE(0).toInt() NE p_kullanici_id ) {
MSG_ERROR(tr ( "There are registered users in the system with this code." ) , NULL);//bu kodla kullanıcı sistemde mevcut
return ADAK_FAIL;
}
}
if ( m_ui->check_box_sifre->isChecked() EQ true ) {
if ( m_ui->line_edit_yeni_sifre->text() NE m_ui->line_edit_yeni_sifre_tekrar->text() ) {
MSG_ERROR("New and repeat passwords do not match,Please check.",m_ui->line_edit_yeni_sifre);//Girdiğiniz yeni şifre ve tekrarı uyuşmuyor Lütfen kontrol ediniz.
return ADAK_FAIL;
}
}
ADAK_MSG_ENUM answer = MSG_YES_NO_CANCEL( tr ( "Do you approve of the changes you made?" ) , NULL);//Yapılan değişiklikleri onaylıyor musunuz?
if ( answer EQ ADAK_CANCEL OR answer EQ ADAK_NO ) {
return ADAK_FAIL;
}
return ADAK_OK;
}
示例4: ip_init
/**
* \brief Initialize Intermediate Process.
*/
int ip_init(struct intermediate *conf, uint32_t ip_id)
{
int ret;
/* Initialize plugin */
xmlChar *ip_params = NULL;
xmlDocDumpMemory(conf->xml_conf->xmldata, &ip_params, NULL);
conf->intermediate_init((char *) ip_params, conf, ip_id, template_mgr, &(conf->plugin_config));
if (conf->plugin_config == NULL) {
MSG_ERROR(msg_module, "Unable to initialize intermediate process");
return -1;
}
free(ip_params);
/* start main thread */
ret = pthread_create(&(conf->thread_id), NULL, ip_loop, (void *)conf);
if (ret != 0) {
MSG_ERROR(msg_module, "Unable to create thread for intermediate process");
return -1;
}
return 0;
}
示例5: secapi_oem_csprng_seed_get
/*===========================================================================
*
* FUNCTION: secapi_oem_csprng_seed_get ()
*
* DESCRIPTION:
*
* See header file
*
===========================================================================*/
secerrno_enum_type secapi_oem_csprng_seed_get (uint8* seed_ptr, uint16 seed_len)
{
secerrno_enum_type stat = E_NOT_AVAILABLE;
uint8 *_seed_ptr = (uint8*)seed_ptr;
if ((NULL == seed_ptr) || (0 == seed_len))
{
return E_INVALID_ARG;
}
stat = secutil_get_nv_item( NV_SEC_CSPRNG_INIT_SEED_I,
_seed_ptr,
seed_len );
if( E_SUCCESS == stat )
{
MSG_MED("sec_oem_util: nv data for csprng! retrieved", 0, 0, 0);
}
else if( stat == E_NO_DATA )
{
MSG_ERROR("sec_oem_util: no nv data for csprng!", 0, 0, 0);
}
else
{
MSG_ERROR("sec_oem_util: error reading nv data for csprng (%d)!", stat, 0, 0);
}
return stat;
}
示例6: group_init
/**
* \brief Initialize a group structure for channels or profiles
*
* \param[out] grp Pointer to the group
* \param[in] items_cnt Number of items (can be re-sized in the future)
* \return On success returns 0. Otherwise returns a non-zero value and the
* content of the structure is undefined.
*/
static int
group_init(struct pevents_group *grp, size_t items_cnt)
{
if (items_cnt == 0) {
return 1;
}
// Clear everything
memset(grp, 0, sizeof(*grp));
// Allocate an array of items
grp->all_prealloc = items_cnt;
grp->all_ptr = calloc(items_cnt, sizeof(*(grp->all_ptr)));
if (!grp->all_ptr) {
MSG_ERROR(msg_module, "Unable to allocate memory (%s:%d)",
__FILE__, __LINE__);
return 1;
}
// Prepare a bitset
grp->bitset = bitset_create(items_cnt);
if (!grp->bitset) {
MSG_ERROR(msg_module, "Unable to allocate memory (%s:%d)",
__FILE__, __LINE__);
free(grp->all_ptr);
return 1;
}
return 0;
}
示例7: fwd_odid_template_remove
/**
* \brief Remove a template definition
* \param[in,out] odid Observation Domain (ODID) maintainer
* \param[in] id Template ID
*/
static void fwd_odid_template_remove(fwd_odid_t *odid, uint16_t id)
{
fwd_tmplt_t **group = odid->tmplts[id / GROUP_SIZE];
fwd_tmplt_t *rec = NULL;
if (group) {
rec = group[id % GROUP_SIZE];
}
if (!rec) {
MSG_ERROR(msg_module, "Unable to find and delete a shared template "
"record (ID %" PRIu16 ") from ODID %" PRIu32 ".", id, odid->odid);
return;
}
MSG_DEBUG(msg_module, "A template (ID: %" PRIu16 ") removed from ODID "
"%" PRIu32 ".", id, odid->odid);
switch (rec->type) {
case TM_TEMPLATE:
odid->templates_normal--;
break;
case TM_OPTIONS_TEMPLATE:
odid->templates_options--;
break;
default:
MSG_ERROR(msg_module, "Internal error: Invalid type (%d) of a template "
"(ODID: %" PRIu32 ", Template ID: %" PRIu16 ")", rec->type,
odid->odid, rec->id);
break;
}
fwd_tmplt_destroy(rec);
group[id % GROUP_SIZE] = NULL;
}
示例8: ic_init
/**
* \brief Initiate internal configuration file - open, get xmlDoc and prepare
* XPathContext. Also register namespace "urn:cesnet:params:xml:ns:yang:ipfixcol-internals"
* with given namespace name.
*
* @param[in] ns_name Name for the "urn:cesnet:params:xml:ns:yang:ipfixcol-internals"
* namespace in xpath queries.
* @return XPath Context for the internal XML configuration. Caller will need to
* free it including separated free of return->doc.
*/
static xmlXPathContextPtr ic_init(xmlChar* ns_name, char *internal_cfg)
{
int fd;
xmlDocPtr doc = NULL;
xmlXPathContextPtr ctxt = NULL;
/* open and prepare internal XML configuration file */
if ((fd = open(internal_cfg, O_RDONLY)) == -1) {
MSG_ERROR(msg_module, "Unable to open internal configuration file %s (%s)", internal_cfg, strerror(errno));
return (NULL);
}
if ((doc = xmlReadFd(fd, NULL, NULL, XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NOBLANKS)) == NULL) {
MSG_ERROR(msg_module, "Unable to parse internal configuration file %s", internal_cfg);
close(fd);
return (NULL);
}
close(fd);
/* create xpath evaluation context of internal configuration file */
if ((ctxt = xmlXPathNewContext(doc)) == NULL) {
MSG_ERROR(msg_module, "Unable to create XPath context for internal configuration (%s:%d)", __FILE__, __LINE__);
xmlFreeDoc(doc);
return (NULL);
}
/* register namespace for the context of internal configuration file */
if (xmlXPathRegisterNs (ctxt, ns_name, BAD_CAST "urn:cesnet:params:xml:ns:yang:ipfixcol-internals") != 0) {
MSG_ERROR(msg_module, "Unable to register namespace for internal configuration file (%s:%d)", __FILE__, __LINE__);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(doc);
return (NULL);
}
return (ctxt);
}
示例9: output_manager_start
/**
* \brief Start Output Manager's thread(s)
*
* @return 0 on success
*/
int output_manager_start()
{
int retval;
/* Create Output Manager thread */
retval = pthread_create(&(conf->thread_id), NULL, &output_manager_plugin_thread, (void *) conf);
if (retval != 0) {
MSG_ERROR(msg_module, "Unable to create Output Manager thread");
free(conf);
return -1;
}
conf->running = 1;
if (conf->stat_interval > 0) {
retval = pthread_create(&(conf->stat_thread), NULL, &statistics_thread, (void *) conf);
if (retval != 0) {
MSG_ERROR(msg_module, "Unable to create statistics thread");
free(conf);
return -1;
}
}
return 0;
}
示例10: storage_init
/**
* \brief Storage plugin initialization.
*
* \param[in] params parameters for this storage plugin
* \param[out] config the plugin specific configuration structure
* \return 0 on success, negative value otherwise
*/
int storage_init(char *params, void **config)
{
MSG_INFO(msg_module, "Dummy plugin: storage_init called");
struct dummy_config *conf;
xmlDocPtr doc;
xmlNodePtr cur;
/* allocate space for config structure */
conf = (struct dummy_config *) malloc(sizeof(*conf));
if (conf == NULL) {
MSG_ERROR(msg_module, "Not enough memory (%s:%d)", __FILE__, __LINE__);
return -1;
}
/* try to parse configuration file */
doc = xmlReadMemory(params, strlen(params), "nobase.xml", NULL, 0);
if (doc == NULL) {
MSG_ERROR(msg_module, "Plugin configuration parsing failed");
goto err_read_conf;
}
cur = xmlDocGetRootElement(doc);
if (cur == NULL) {
MSG_ERROR(msg_module, "Empty configuration");
goto err_init;
}
if (xmlStrcmp(cur->name, (const xmlChar *) "fileWriter")) {
MSG_ERROR(msg_module, "Root node != fileWriter");
goto err_init;
}
/* default delay */
conf->delay = 0;
cur = cur->xmlChildrenNode;
while (cur != NULL) {
/* find out the desired delay */
if ((!xmlStrcmp(cur->name, (const xmlChar *) "delay"))) {
conf->delay = atoi((char *) xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
break;
}
cur = cur->next;
}
MSG_INFO(msg_module, "Dummy plugin: delay set to %ius", conf->delay);
/* we don't need this xml tree anymore */
xmlFreeDoc(doc);
/* pass config to core */
*config = conf;
return 0;
err_init:
xmlFreeDoc(doc);
err_read_conf:
free(conf);
return -1;
}
示例11: fwd_src_withdraw_type
/**
* \brief Remove all templates of a defined type from a Flow source
* \param[in,out] src Flow source
* \param[in] type Type of the templates (#TM_TEMPLATE or #TM_OPTIONS_TEMPLATE)
*/
static void fwd_src_withdraw_type(fwd_source_t *src, int type)
{
const unsigned int min = IPFIX_MIN_RECORD_FLOWSET_ID;
const unsigned int max = FWD_MAX_RECORD_FLOWSET_ID;
if (type != TM_TEMPLATE && type != TM_OPTIONS_TEMPLATE) {
MSG_ERROR(msg_module, "Trying to delete invalid type of templates.");
return;
}
unsigned int private_id;
for (private_id = min; private_id <= max; ++private_id) {
// Get a mapping of the ID
uint16_t shared_id = fwd_src_mapping_get(src, private_id);
if (shared_id == 0) {
continue;
}
// Check a type of a template
const fwd_tmplt_t *tmplt;
tmplt = fwd_odid_template_get(src->maintainer, shared_id);
if (!tmplt) {
MSG_ERROR(msg_module, "Unable to get a reference to a shared "
"template (ID: %" PRIu16 ").", shared_id);
continue;
}
if (tmplt->type != type) {
continue;
}
fwd_src_mapping_remove(src, private_id);
}
}
示例12: load_types_from_xml
int load_types_from_xml(struct fastbit_config *conf) {
pugi::xml_document doc;
pugi::xml_parse_result result;
uint32_t en;
uint16_t id;
enum store_type type;
std::string str_value;
result = doc.load_file("/etc/ipfixcol/ipfix-elements.xml");
/* Check for errors */
if (!result) {
MSG_ERROR(MSG_MODULE, "/etc/ipfixcol/ipfix-elements.xml parsed with errors!");
MSG_ERROR(MSG_MODULE, "Error description: %s", result.description());
return -1;
}
pugi::xpath_node_set elements = doc.select_nodes("/ipfix-elements/element");
for (pugi::xpath_node_set::const_iterator it = elements.begin(); it != elements.end(); ++it)
{
//pugi::xpath_node node = *it;
str_value = it->node().child_value("enterprise");
en = strtoul(str_value.c_str(),NULL,0);
str_value = it->node().child_value("id");
id = strtoul(str_value.c_str(),NULL,0);
str_value = it->node().child_value("dataType");
if (str_value =="unsigned8" or str_value =="unsigned16" or str_value =="unsigned32" or str_value =="unsigned64" or \
str_value =="dateTimeSeconds" or str_value =="dateTimeMilliseconds" or str_value =="dateTimeMicroseconds" or \
str_value =="dateTimeNanoseconds" or str_value =="ipv4Address" or str_value =="macAddress" or str_value == "boolean") {
type =UINT;
} else if (str_value =="signed8" or str_value =="signed16" or str_value =="signed32" or str_value =="signed64" ) {
type = INT;
} else if (str_value =="ipv6Address") {
type = IPv6;
} else if (str_value =="float32" or str_value =="float64") {
type = FLOAT;
} else if (str_value =="string") {
type = TEXT;
} else if (str_value =="octetArray" or str_value =="basicList" or str_value =="subTemplateList" or str_value=="subTemplateMultiList") {
type = BLOB;
} else {
type = UNKNOWN;
}
//conf->elements_types->insert(std::make_pair(en , std::make_pair(id, type)));
(*conf->elements_types)[en][id] = type;
//std::cout << "el loaded: " << en << ":" << id <<":"<< type << std::endl;
}
return 0;
}
示例13: MSG_ERROR
int KULLANICILAR_FORMU::CHECK_EMPTY ()
{
if ( m_ui->lineEdit_kullanici_kodu->text().isEmpty() EQ true ) {
MSG_ERROR(tr ( "User code can not be empty." ) , m_ui->lineEdit_kullanici_kodu );//Kullanıcı kodu boş bırakılamaz
return ADAK_FAIL;
}
if ( m_ui->lineEdit_kullanici_adi->text().isEmpty() EQ true ) {
MSG_ERROR(tr ( "User name can not be empty." ) , m_ui->lineEdit_kullanici_adi);
return ADAK_FAIL;
}
return ADAK_OK;
}
示例14: fwd_odid_template_insert
/**
* \brief Insert a template definition
*
* Find an unused Template ID among shared templates in ODID and then insert
* the template with this new ID to the ODID maintainer.
* \param[in,out] odid Observation Domain (ODID) maintainer
* \param[in] rec Template record
* \param[in] rec_len Length of the template record
* \param[in] rec_type Type of the template (#TM_TEMPLATE or #TM_OPTIONS_TEMPLATE)
* \return On success returns new Template ID assigned to the template (>= 256).
* Otherwise returns 0.
*/
static uint16_t fwd_odid_template_insert(fwd_odid_t *odid,
const struct ipfix_template_record *rec, size_t rec_len, int rec_type)
{
// Create a template record
const uint16_t old_id = ntohs(rec->template_id);
const uint16_t new_id = fwd_odid_template_unused_id(odid, old_id);
if (new_id == 0) {
MSG_ERROR(msg_module, "Unable to add a new template to the Observation "
"Domain ID %" PRIu32 ". All available Template IDs are already "
"used. Some flows will be definitely lost.", odid->odid);
return 0;
}
if (rec_type != TM_TEMPLATE && rec_type != TM_OPTIONS_TEMPLATE) {
MSG_ERROR(msg_module, "Unable to add a new template to the Observation "
"Domain ID %" PRIu32 ". Invalid type (%d) of the template .",
odid->odid, rec_type);
return 0;
}
fwd_tmplt_t *tmplt = fwd_tmplt_create(rec, rec_len, rec_type, new_id);
if (!tmplt) {
return 0;
}
// Store the template
fwd_tmplt_t **group = odid->tmplts[new_id / GROUP_SIZE];
if (!group) {
// Not found -> create a new group
fwd_tmplt_t ***new_grp = &odid->tmplts[new_id / GROUP_SIZE];
*new_grp = calloc(GROUP_SIZE, sizeof(*group));
if (*new_grp == NULL) {
MSG_ERROR(msg_module, "Memory allocation failed (%s:%d)",
__FILE__, __LINE__);
fwd_tmplt_destroy(tmplt);
return 0;
}
group = *new_grp;
}
odid->to_remove++; // There are no references to this template yet
if (rec_type == TM_TEMPLATE) {
odid->templates_normal++;
} else {
odid->templates_options++;
}
MSG_DEBUG(msg_module, "New template (ID: %" PRIu16 ") added to ODID "
"%" PRIu32 ".", new_id, odid->odid);
group[new_id % GROUP_SIZE] = tmplt;
return new_id;
}
示例15: gstk_send_ss_cnf_cleanup
/*===========================================================================
FUNCTION gstk_send_ss_cnf_cleanup
DESCRIPTION
This function cleans up any allocated pointer on the stack.
PARAMETERS
send_ss_cnf_ptr: [Input] Pointer to message that is required to
be processed and sent to UIM
STK_response_ptr: [Input] Pointer to the STK intermediate message
has_cc : [Input] has call control
has_ussd_string : [Input] contains ussd string
DEPENDENCIES
None
RETURN VALUE
None
COMMENTS
None
SIDE EFFECTS
None
SEE ALSO
None
===========================================================================*/
static void gstk_send_ss_cnf_cleanup(
gstk_send_ss_cnf_type *send_ss_cnf_ptr,
setup_call_send_ss_terminal_response_type *STK_response_ptr,
boolean has_cc,
boolean has_ussd_string)
{
if(STK_response_ptr == NULL)
{
MSG_ERROR("STK_response_ptr ERR:NULL",0,0,0);
return;
}
if(send_ss_cnf_ptr == NULL)
{
MSG_ERROR("send_ss_cnf_ptr ERR:NULL",0,0,0);
return;
}
/* free the text string byte pointer from STK_response_ptr and send_ss_cnf_ptr */
/* STK_response_ptr:
cc_req_action: ussd string, alpha
text string 2
result 2's additional info */
gstk_util_release_upper_layer_cmd_memory(
(gstk_cmd_type*)send_ss_cnf_ptr);/*lint !e826 area too small */
if (has_cc) {
if (STK_response_ptr->cc_req_action.alpha.alpha != NULL) {
gstk_free(STK_response_ptr->cc_req_action.alpha.alpha);
STK_response_ptr->cc_req_action.alpha.alpha = NULL;
}
if (STK_response_ptr->result2_for_cc.additional_info != NULL) {
gstk_free(STK_response_ptr->result2_for_cc.additional_info);
STK_response_ptr->result2_for_cc.additional_info = NULL;
}
if (has_ussd_string) {
if (STK_response_ptr->cc_req_action.gstk_address_string_tlv.ussd_string.text != NULL) {
gstk_free(STK_response_ptr->cc_req_action.gstk_address_string_tlv.ussd_string.text);
STK_response_ptr->cc_req_action.gstk_address_string_tlv.ussd_string.text = NULL;
}
if (STK_response_ptr->cc_mod_text2.text != NULL) {
gstk_free(STK_response_ptr->cc_mod_text2.text);
STK_response_ptr->cc_mod_text2.text = NULL;
}
}
}
if (STK_response_ptr->header.result.additional_info != NULL) {
gstk_free(STK_response_ptr->header.result.additional_info);
}
} /* gstk_send_ss_cnf_cleanup */