static lagopus_result_t ofp_role_channel_write_wrap(struct channel **channels, struct ofp_header *xid_headers, struct pbuf *pbuf) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; uint64_t dpid = 0xabc; uint8_t reason = 0x01; int i; (void) channels; (void) xid_headers; for (i = 0; i < CHANNEL_MAX_NUM; i++) { channel_role_mask_set(channels[i], &test_role_mask); } ret = ofp_role_channel_write(pbuf, dpid, OFPT_PACKET_IN, reason); return ret; }
lagopus_result_t ofp_set_async_handle(struct channel *channel, struct pbuf *pbuf, struct ofp_header *xid_header, struct ofp_error *error) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; struct ofp_async_config async_config; if (channel != NULL && pbuf != NULL && xid_header != NULL && error != NULL) { ret = pbuf_plen_check(pbuf, xid_header->length); if (ret == LAGOPUS_RESULT_OK) { /* Parse packet. */ ret = ofp_async_config_decode(pbuf, &async_config); if (ret == LAGOPUS_RESULT_OK) { /* dump trace. */ set_async_trace(&async_config); /* Copy packet_in_mask, port_status_mask, flow_removed_mask. */ channel_role_mask_set(channel, &async_config); } else { lagopus_msg_warning("FAILED : ofp_config_decode (%s).\n", lagopus_error_get_string(ret)); ofp_error_set(error, OFPET_BAD_REQUEST, OFPBRC_BAD_LEN); ret = LAGOPUS_RESULT_OFP_ERROR; } } else { lagopus_msg_warning("bad length.\n"); ofp_error_set(error, OFPET_BAD_REQUEST, OFPBRC_BAD_LEN); ret = LAGOPUS_RESULT_OFP_ERROR; } } else { ret = LAGOPUS_RESULT_INVALID_ARGS; } return ret; }