当前位置: 首页>>代码示例>>C++>>正文


C++ OFL_LOG_WARN函数代码示例

本文整理汇总了C++中OFL_LOG_WARN函数的典型用法代码示例。如果您正苦于以下问题:C++ OFL_LOG_WARN函数的具体用法?C++ OFL_LOG_WARN怎么用?C++ OFL_LOG_WARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OFL_LOG_WARN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ofl_structs_meter_band_unpack

ofl_err
ofl_structs_meter_band_unpack(struct ofp_meter_band_header *src, size_t *len, struct ofl_meter_band_header **dst){
    struct ofl_meter_band_header *mb;

    if(*len < sizeof(struct ofp_meter_band_header)){
        OFL_LOG_WARN(LOG_MODULE, "Received meter band is too short (%zu).", *len);
        return ofl_error(OFPET_BAD_ACTION, OFPBAC_BAD_LEN);
    }
    mb = (struct ofl_meter_band_header *) malloc(sizeof(struct ofl_meter_band_header));
    switch (ntohs(src->type)){
        case OFPMBT_DROP:{
            struct ofl_meter_band_drop *b = (struct ofl_meter_band_drop *)malloc(sizeof(struct ofl_meter_band_drop));
            b->type = ntohs(src->type);
            b->rate = ntohl(src->rate);
            b->burst_size = ntohl(src->burst_size);
            mb = (struct ofl_meter_band_header *)b;
            *dst = mb;
            break;
        }
        case OFPMBT_DSCP_REMARK:{
            struct ofl_meter_band_dscp_remark *b = (struct ofl_meter_band_dscp_remark *)malloc(sizeof(struct ofl_meter_band_dscp_remark));
            struct ofp_meter_band_dscp_remark *s = (struct ofp_meter_band_dscp_remark*)src;
            b->type = ntohs(s->type);
            b->rate = ntohl(s->rate);
            b->burst_size = ntohl(s->burst_size);
            b->prec_level = s->prec_level;
            mb = (struct ofl_meter_band_header *)b;
            *dst = mb;
            break;
        }
        case OFPMBT_SET_COLOR:
        case OFPMBT_EXPERIMENTER:{
            struct ofl_meter_band_experimenter_color_set *b = (struct ofl_meter_band_experimenter_color_set *)malloc(sizeof(struct ofl_meter_band_experimenter_color_set));
            struct ofp_meter_band_experimenter_color_set *s = (struct ofp_meter_band_experimenter_color_set*) src;
            b->type = ntohs(s->type);
            b->rate = ntohl(s->rate);
            b->burst_size = ntohl(s->burst_size);
            b->experimenter = ntohl(s->experimenter);
            b->exp_type = ntohs(s->exp_type);
            b->mode = s->mode;
            b->color_aware = s->color_aware;
            b->color = s->color;
            mb = (struct ofl_meter_band_header *)b;
            *dst = mb;
            break;
        }
    }
    *len -= ntohs(src->len);
    return 0;
}
开发者ID:macauleycheng,项目名称:aos-dpctl,代码行数:50,代码来源:ofl-structs-unpack.c

示例2: ofl_structs_port_unpack

ofl_err
ofl_structs_port_unpack(struct ofp_port *src, size_t *len, struct ofl_port **dst) {
    struct ofl_port *p;

    if (*len < sizeof(struct ofp_port)) {
        OFL_LOG_WARN(LOG_MODULE, "Received port has invalid length (%zu).", *len);
        return ofl_error(OFPET_BAD_ACTION, OFPBRC_BAD_LEN);
    }

    if (ntohl(src->port_no) == 0 ||
        (ntohl(src->port_no) > OFPP_MAX && ntohl(src->port_no) != OFPP_LOCAL)) {
        if (OFL_LOG_IS_WARN_ENABLED(LOG_MODULE)) {
            char *ps = ofl_port_to_string(ntohl(src->port_no));
            OFL_LOG_WARN(LOG_MODULE, "Received port has invalid port_id (%s).", ps);
            free(ps);
        }
        return ofl_error(OFPET_BAD_ACTION, OFPBRC_BAD_LEN);
    }
    *len -= sizeof(struct ofp_port);

    p = (struct ofl_port *)malloc(sizeof(struct ofl_port));

    p->port_no = ntohl(src->port_no);
    memcpy(p->hw_addr, src->hw_addr, ETH_ADDR_LEN);
    p->name = strcpy((char *)malloc(strlen(src->name) + 1), src->name);
    p->config = ntohl(src->config);
    p->state = ntohl(src->state);
    p->curr = ntohl(src->curr);
    p->advertised = ntohl(src->advertised);
    p->supported = ntohl(src->supported);
    p->peer = ntohl(src->peer);
    p->curr_speed = ntohl(src->curr_speed);
    p->max_speed = ntohl(src->max_speed);

    *dst = p;
    return 0;
}
开发者ID:rrdenicol,项目名称:nox11oflib,代码行数:37,代码来源:ofl-structs-unpack.c

示例3: ofl_exp_openflow_msg_to_string

char *
ofl_exp_openflow_msg_to_string(struct ofl_msg_experimenter *msg) {
    char *str;
    size_t str_size;
    FILE *stream = open_memstream(&str, &str_size);

    if (msg->experimenter_id == OPENFLOW_VENDOR_ID) {
        struct ofl_exp_openflow_msg_header *exp = (struct ofl_exp_openflow_msg_header *)msg;
        switch (exp->type) {
            case (OFP_EXT_QUEUE_MODIFY):
            case (OFP_EXT_QUEUE_DELETE): {
                struct ofl_exp_openflow_msg_queue *q = (struct ofl_exp_openflow_msg_queue *)exp;
                fprintf(stream, "%squeue{port=\"", exp->type == OFP_EXT_QUEUE_MODIFY ? "mod" : "del");
                ofl_port_print(stream, q->port_id);
                fprintf(stream, "\", queue=");
                ofl_structs_queue_print(stream, q->queue);
                fprintf(stream, "}");
                break;
            }
            case (OFP_EXT_SET_DESC): {
                struct ofl_exp_openflow_msg_set_dp_desc *s = (struct ofl_exp_openflow_msg_set_dp_desc *)exp;
                fprintf(stream, "setdesc{desc=\"%s\"}", s->dp_desc);
                break;
            }
            default: {
                OFL_LOG_WARN(LOG_MODULE, "Trying to print unknown Openflow Experimenter message.");
                fprintf(stream, "ofexp{type=\"%u\"}", exp->type);
            }
        }
    } else {
        OFL_LOG_WARN(LOG_MODULE, "Trying to print non-Openflow Experimenter message.");
        fprintf(stream, "exp{exp_id=\"%u\"}", msg->experimenter_id);
    }

    fclose(stream);
    return str;
}
开发者ID:BiangHoo,项目名称:ofsoftswitch13,代码行数:37,代码来源:ofl-exp-openflow.c

示例4: ofl_exp_msg_pack

int
ofl_exp_msg_pack(struct ofl_msg_experimenter *msg, uint8_t **buf, size_t *buf_len) {
    switch (msg->experimenter_id) {
        case (OPENFLOW_VENDOR_ID): {
            return ofl_exp_openflow_msg_pack(msg, buf, buf_len);
        }
        case (NX_VENDOR_ID): {
            return ofl_exp_nicira_msg_pack(msg, buf, buf_len);
        }
        default: {
            OFL_LOG_WARN(LOG_MODULE, "Trying to pack unknown EXPERIMENTER message (%u).", msg->experimenter_id);
            return -1;
        }
    }
}
开发者ID:gord1306,项目名称:oftest-dpctl,代码行数:15,代码来源:ofl-exp.c

示例5: ofl_exp_msg_unpack

ofl_err
ofl_exp_msg_unpack(struct ofp_header *oh, size_t *len, struct ofl_msg_experimenter **msg) {
    struct ofp_experimenter_header *exp;

    if (*len < sizeof(struct ofp_experimenter_header)) {
        OFL_LOG_WARN(LOG_MODULE, "Received EXPERIMENTER message is shorter than ofp_experimenter_header.");
        return ofl_error(OFPET_BAD_REQUEST, OFPBRC_BAD_LEN);
    }

    exp = (struct ofp_experimenter_header *)oh;

    switch (htonl(exp->experimenter)) {
        case (OPENFLOW_VENDOR_ID): {
            return ofl_exp_openflow_msg_unpack(oh, len, msg);
        }
        case (NX_VENDOR_ID): {
            return ofl_exp_nicira_msg_unpack(oh, len, msg);
        }
        default: {
            OFL_LOG_WARN(LOG_MODULE, "Trying to unpack unknown EXPERIMENTER message (%u).", htonl(exp->experimenter));
            return ofl_error(OFPET_BAD_REQUEST, OFPBRC_BAD_EXPERIMENTER);
        }
    }
}
开发者ID:gord1306,项目名称:oftest-dpctl,代码行数:24,代码来源:ofl-exp.c

示例6: ofl_exp_tno_msg_pack

int
ofl_exp_tno_msg_pack(struct ofl_msg_experimenter *msg, uint8_t **buf, size_t *buf_len) {
    if (msg->experimenter_id == TNO_VENDOR_ID) {
        struct ofl_exp_tno_msg_header *exp = (struct ofl_exp_tno_msg_header *)msg;
        switch (exp->type) {
            case (TNO_PUT_BPF): {
				OFL_LOG_WARN(LOG_MODULE, "Trying to print unknown TNO Experimenter message.");
            	return -1; }
            case (TNO_DEL_BPF): {
				OFL_LOG_WARN(LOG_MODULE, "Trying to print unknown TNO Experimenter message.");
            	return -1; }
            case (TNO_GET_BPF): {
				OFL_LOG_WARN(LOG_MODULE, "Trying to print unknown TNO Experimenter message.");
            	return -1; }
            default: {
                OFL_LOG_WARN(LOG_MODULE, "Trying to print unknown TNO Experimenter message.");
                return -1;
            }
        }
    } else {
        OFL_LOG_WARN(LOG_MODULE, "Trying to print non-TNO Experimenter message.");
        return -1;
    }
}
开发者ID:b0rg3rt,项目名称:ofsoftswitch13,代码行数:24,代码来源:ofl-exp-tno.c

示例7: ofl_structs_meter_band_ofp_len

size_t
ofl_structs_meter_band_ofp_len(struct ofl_meter_band_header *meter_band) {
    switch (meter_band->type) {
        case OFPMBT_DROP:
            return sizeof(struct ofp_meter_band_drop);
        case OFPMBT_DSCP_REMARK:
            return sizeof(struct ofp_meter_band_dscp_remark);
        case OFPMBT_SET_COLOR:
        case OFPMBT_EXPERIMENTER:
            return sizeof(struct ofp_meter_band_experimenter_color_set);
        default:
             OFL_LOG_WARN(LOG_MODULE, "Trying to len unknown meter type.");
            return 0;
    }
}
开发者ID:macauleycheng,项目名称:aos-dpctl,代码行数:15,代码来源:ofl-structs-pack.c

示例8: ofl_exp_stats_reply_pack

int 
ofl_exp_stats_reply_pack (struct ofl_msg_multipart_reply_header *msg, uint8_t **buf, size_t *buf_len, struct ofl_exp *exp){
    struct ofl_msg_multipart_reply_experimenter *ext = (struct ofl_msg_multipart_reply_experimenter *) msg;
    switch (ext->experimenter_id) {

        case (OPENSTATE_VENDOR_ID): {
            return ofl_exp_openstate_stats_reply_pack(ext, buf, buf_len, exp);
        }
                
        default: {
            OFL_LOG_WARN(LOG_MODULE, "Trying to pack unknown multipart EXPERIMENTER message (%u).", ext->experimenter_id);
            return -1;
        }
    }
}
开发者ID:Tesi-Luca-Davide,项目名称:ofsoftswitch13,代码行数:15,代码来源:ofl-exp.c

示例9: ofl_structs_match_ofp_len

size_t
ofl_structs_match_ofp_len(struct ofl_match_header *match, struct ofl_exp *exp) {
    switch (match->type) {
        case (OFPMT_STANDARD): {
            return (sizeof(struct ofp_match));
        }
        default: {
            if (exp == NULL || exp->match == NULL || exp->match->ofp_len == NULL) {
                OFL_LOG_WARN(LOG_MODULE, "Trying to len experimenter match, but no callback was given.");
                return 0;
            }
            return exp->match->ofp_len(match);
        }
    }
}
开发者ID:CPqD,项目名称:nox12oflib,代码行数:15,代码来源:ofl-structs-pack.c

示例10: ofl_exp_stats_reply_free

int
ofl_exp_stats_reply_free (struct ofl_msg_multipart_reply_header *msg)
{
    struct ofl_msg_multipart_reply_experimenter *exp = (struct ofl_msg_multipart_reply_experimenter *) msg;
    switch (exp->experimenter_id) {
        case (BEBA_VENDOR_ID): {
            return ofl_exp_beba_stats_reply_free(msg);
        }
        default: {
            OFL_LOG_WARN(LOG_MODULE, "Trying to free unknown EXPERIMENTER message (%u).", exp->experimenter_id);
            free(msg);
            return -1;
        }
    }
}
开发者ID:beba-eu,项目名称:beba-switch,代码行数:15,代码来源:ofl-exp.c

示例11: ofl_structs_table_stats_unpack

ofl_err
ofl_structs_table_stats_unpack(struct ofp_table_stats *src, size_t *len, struct ofl_table_stats **dst) {
    struct ofl_table_stats *p;

    if (*len < sizeof(struct ofp_table_stats)) {
        OFL_LOG_WARN(LOG_MODULE, "Received table stats has invalid length (%zu).", *len);
        return ofl_error(OFPET_BAD_ACTION, OFPBRC_BAD_LEN);
    }

    if (src->table_id == 0xff) {
        if (OFL_LOG_IS_WARN_ENABLED(LOG_MODULE)) {
            char *ts = ofl_table_to_string(src->table_id);
            OFL_LOG_WARN(LOG_MODULE, "Received table stats has invalid table_id (%s).", ts);
            free(ts);
        }
        return ofl_error(OFPET_BAD_ACTION, OFPBRC_BAD_LEN);
    }
    *len -= sizeof(struct ofp_table_stats);

    p = (struct ofl_table_stats *)malloc(sizeof(struct ofl_table_stats));
    p->table_id =      src->table_id;
    p->name =          strcpy((char *)malloc(strlen(src->name) + 1), src->name);
    p->wildcards =     ntohl(src->wildcards);
    p->match =         ntohl(src->match);
    p->instructions =  ntohl(src->instructions);
    p->write_actions = ntohl(src->write_actions);
    p->apply_actions = ntohl(src->apply_actions);
    p->config =        ntohl(src->config);
    p->max_entries =   ntohl(src->max_entries);
    p->active_count =  ntohl(src->active_count);
    p->lookup_count =  ntoh64(src->lookup_count);
    p->matched_count = ntoh64(src->matched_count);

    *dst = p;
    return 0;
}
开发者ID:rrdenicol,项目名称:nox11oflib,代码行数:36,代码来源:ofl-structs-unpack.c

示例12: ofl_exp_stats_req_pack

int
ofl_exp_stats_req_pack (struct ofl_msg_multipart_request_header const *msg, uint8_t **buf, size_t *buf_len, struct ofl_exp const *exp)
{
    struct ofl_msg_multipart_request_experimenter *ext = (struct ofl_msg_multipart_request_experimenter *) msg;

    switch (ext->experimenter_id) {

        case (BEBA_VENDOR_ID):
            return ofl_exp_beba_stats_req_pack(ext, buf, buf_len, exp);

        default: {
            OFL_LOG_WARN(LOG_MODULE, "Trying to pack unknown multipart EXPERIMENTER message (%u).", ext->experimenter_id);
            return -1;
        }
    }
}
开发者ID:beba-eu,项目名称:beba-switch,代码行数:16,代码来源:ofl-exp.c

示例13: ofl_exp_msg_free

int
ofl_exp_msg_free(struct ofl_msg_experimenter *msg) {
    switch (msg->experimenter_id) {
        case (OPENFLOW_VENDOR_ID): {
            return ofl_exp_openflow_msg_free(msg);
        }
        case (NX_VENDOR_ID): {
            return ofl_exp_nicira_msg_free(msg);
        }
        default: {
            OFL_LOG_WARN(LOG_MODULE, "Trying to free unknown EXPERIMENTER message (%u).", msg->experimenter_id);
            free(msg);
            return -1;
        }
    }
}
开发者ID:gord1306,项目名称:oftest-dpctl,代码行数:16,代码来源:ofl-exp.c

示例14: ofl_structs_match_unpack

ofl_err
ofl_structs_match_unpack(struct ofp_match *src,uint8_t * buf, size_t *len, struct ofl_match_header **dst, struct ofl_exp *exp) {

    switch (ntohs(src->type)) {
        case (OFPMT_OXM): {
             return ofl_structs_oxm_match_unpack(src, buf, len, (struct ofl_match**) dst );               
        }
        default: {
            if (exp == NULL || exp->match == NULL || exp->match->unpack == NULL) {
                OFL_LOG_WARN(LOG_MODULE, "Received match is experimental, but no callback was given.");
                return ofl_error(OFPET_BAD_MATCH, OFPBMC_BAD_TYPE);
            }
            return exp->match->unpack(src, len, dst);
        }
    }
}
开发者ID:BiangHoo,项目名称:ofsoftswitch13,代码行数:16,代码来源:ofl-structs-unpack.c

示例15: ofl_structs_table_features_properties_ofp_total_len

size_t
ofl_structs_table_features_properties_ofp_total_len(struct ofl_table_feature_prop_header **props, size_t features_num, struct ofl_exp *exp){
    int i;
    size_t sum = 0;
    size_t sum_check;
    for(i = 0; i < features_num; i++){
        /* Length is padded to 8  bytes */
        sum += ROUND_UP(props[i]->length, 8);

	/* Sanity check ! Jean II */
	sum_check = ofl_structs_table_features_properties_ofp_len(props[i], exp);
	if(props[i]->length != sum_check)
	  OFL_LOG_WARN(LOG_MODULE, "Table feature property %X has unexpected length, %u != %zu.", props[i]->type, props[i]->length, sum_check);

    }
	return sum;
}
开发者ID:macauleycheng,项目名称:aos-dpctl,代码行数:17,代码来源:ofl-structs-pack.c


注:本文中的OFL_LOG_WARN函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。