zoukankan      html  css  js  c++  java
  • ovs处理openflow消息的流程

    捕获


    OVS处理各个openflow消息的详细代码在 ofproto/ofproto.c 中:

    static enum ofperr
    handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg)
    {
        const struct ofp_header *oh = msg->data;
        enum ofptype type;
        enum ofperr error;
    
        error = ofptype_decode(&type, oh);
        if (error) {
            return error;
        }
    
        switch (type) {
            /* OpenFlow requests. */
        case OFPTYPE_ECHO_REQUEST:
            return handle_echo_request(ofconn, oh);
    
        case OFPTYPE_FEATURES_REQUEST:
            return handle_features_request(ofconn, oh);
    
        case OFPTYPE_GET_CONFIG_REQUEST:
            return handle_get_config_request(ofconn, oh);
    
        case OFPTYPE_SET_CONFIG:  
            return handle_set_config(ofconn, oh);
    
        case OFPTYPE_PACKET_OUT:
            return handle_packet_out(ofconn, oh);
    
        case OFPTYPE_PORT_MOD:
            return handle_port_mod(ofconn, oh);
    
        case OFPTYPE_FLOW_MOD:
            return handle_flow_mod(ofconn, oh);
    
        case OFPTYPE_BARRIER_REQUEST:
            return handle_barrier_request(ofconn, oh);
    
            /* OpenFlow replies. */
        case OFPTYPE_ECHO_REPLY:
            return 0;
    
            /* Nicira extension requests. */
        case OFPTYPE_ROLE_REQUEST:
            return handle_role_request(ofconn, oh);
    
        case OFPTYPE_FLOW_MOD_TABLE_ID:
            return handle_nxt_flow_mod_table_id(ofconn, oh);
    
        case OFPTYPE_SET_FLOW_FORMAT:
            return handle_nxt_set_flow_format(ofconn, oh);
    
        case OFPTYPE_SET_PACKET_IN_FORMAT:
            return handle_nxt_set_packet_in_format(ofconn, oh);
    
        case OFPTYPE_SET_CONTROLLER_ID:
            return handle_nxt_set_controller_id(ofconn, oh);
    
        case OFPTYPE_FLOW_AGE:
            /* Nothing to do. */
            return 0;
    
        case OFPTYPE_FLOW_MONITOR_CANCEL:
            return handle_flow_monitor_cancel(ofconn, oh);
    
        case OFPTYPE_SET_ASYNC_CONFIG:
            return handle_nxt_set_async_config(ofconn, oh);
    
            /* Statistics requests. */
        case OFPTYPE_DESC_STATS_REQUEST:
            return handle_desc_stats_request(ofconn, oh);
    
        case OFPTYPE_FLOW_STATS_REQUEST:
            return handle_flow_stats_request(ofconn, oh);
    
        case OFPTYPE_AGGREGATE_STATS_REQUEST:
            return handle_aggregate_stats_request(ofconn, oh);
    
        case OFPTYPE_TABLE_STATS_REQUEST:
            return handle_table_stats_request(ofconn, oh);
    
        case OFPTYPE_PORT_STATS_REQUEST:
            return handle_port_stats_request(ofconn, oh);
    
        case OFPTYPE_QUEUE_STATS_REQUEST:
            return handle_queue_stats_request(ofconn, oh);
    
        case OFPTYPE_PORT_DESC_STATS_REQUEST:
            return handle_port_desc_stats_request(ofconn, oh);
    
        case OFPTYPE_FLOW_MONITOR_STATS_REQUEST:
            return handle_flow_monitor_request(ofconn, oh);
    
        case OFPTYPE_HELLO:
        case OFPTYPE_ERROR:
        case OFPTYPE_FEATURES_REPLY:
        case OFPTYPE_GET_CONFIG_REPLY:
        case OFPTYPE_PACKET_IN:
        case OFPTYPE_FLOW_REMOVED:
        case OFPTYPE_PORT_STATUS:
        case OFPTYPE_BARRIER_REPLY:
        case OFPTYPE_DESC_STATS_REPLY:
        case OFPTYPE_FLOW_STATS_REPLY:
        case OFPTYPE_QUEUE_STATS_REPLY:
        case OFPTYPE_PORT_STATS_REPLY:
        case OFPTYPE_TABLE_STATS_REPLY:
        case OFPTYPE_AGGREGATE_STATS_REPLY:
        case OFPTYPE_PORT_DESC_STATS_REPLY:
        case OFPTYPE_ROLE_REPLY:
        case OFPTYPE_FLOW_MONITOR_PAUSED:
        case OFPTYPE_FLOW_MONITOR_RESUMED:
        case OFPTYPE_FLOW_MONITOR_STATS_REPLY:
        default:
            return OFPERR_OFPBRC_BAD_TYPE;
        }
    }
    




    http://blog.csdn.net/vonzhoufz/article/details/29190281


  • 相关阅读:
    JS 利用数组拼接html字符串
    IE浏览器下读取客户端上传的文件大小
    PrintWriter out = response.getWriter() 输出中文乱码问题
    非常有用的Java程序片段
    sql之left join、right join、inner join的区别
    JAVA 数组常用技巧
    java 图片文件格式转换(多页tif转jpg 、jpg转tif)
    SQL Server 字段状态判断语句
    sql server 2008中id如何设为自增
    java基于xml配置的通用excel单表数据导入组件(五、Action处理类)
  • 原文地址:https://www.cnblogs.com/mfrbuaa/p/3988535.html
Copyright © 2011-2022 走看看