// Copyright 2013, Big Switch Networks, Inc.
//
// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
// the following special exception:
//
// LOXI Exception
//
// As a special exception to the terms of the EPL, you may distribute libraries
// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
// that copyright and licensing notices generated by LoxiGen are not altered or removed
// from the LoxiGen Libraries and the notice provided below is (i) included in
// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
// documentation for the LoxiGen Libraries, if distributed in binary form.
//
// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
//
// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
// a copy of the EPL at:
//
// http://www.eclipse.org/legal/epl-v10.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// EPL for the specific language governing permissions and limitations
// under the EPL.

#version any

// BSN mirror action
struct of_action_bsn_mirror {
    uint16_t type;      // OF_ACTION_TYPE_EXPERIMENTER
    uint16_t len;
    uint32_t experimenter;    // OF_EXPERIMENTER_ID_BSN 
    uint32_t subtype;   // ACTION_BSN_MIRROR 
    uint32_t dest_port; // mirror destination port
    uint32_t vlan_tag;  // VLAN tag for mirrored packet (TPID+TCI) (0 == none)
    uint8_t copy_stage; // 0 == ingress, 1 == egress 
    pad(3);
};

// BSN mirroring messages
struct of_bsn_set_mirroring {
    uint8_t version;
    uint8_t type;
    uint16_t length;
    uint32_t xid;
    uint32_t experimenter;    // OF_EXPERIMENTER_ID_BSN
    uint32_t subtype;   // BSN_MIRRORING_SET
    uint8_t report_mirror_ports;
    pad(3);
};

struct of_bsn_get_mirroring_request {
    uint8_t version;
    uint8_t type;
    uint16_t length;
    uint32_t xid;
    uint32_t experimenter;    // OF_EXPERIMENTER_ID_BSN
    uint32_t subtype;   // BSN_MIRRORING_GET_REQUEST
    uint8_t report_mirror_ports;
    pad(3);
};

struct of_bsn_get_mirroring_reply {
    uint8_t version;
    uint8_t type;
    uint16_t length;
    uint32_t xid;
    uint32_t experimenter;    // OF_EXPERIMENTER_ID_BSN
    uint32_t subtype;   // BSN_MIRRORING_GET_REPLY
    uint8_t report_mirror_ports;
    pad(3);
};
