// 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

enum ofp_bsn_vport_status {
    OF_BSN_VPORT_STATUS_OK = 0,
    OF_BSN_VPORT_STATUS_FAILED = 1,
};

// When the ingress or egress VID has this value, no outer tag should be used.
// In this case, the corresponding TPID is ignored.

enum ofp_bsn_vport_q_in_q_untagged(wire_type=uint16_t, complete=False) {
    OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 0xffff,
};

// BSN Virtual port object header
// FIXME For now, inheritance is not exercised.  See below.
struct of_bsn_vport {
    uint16_t type == ?;  /* Discriminate virtual port type */
    of_port_name_t if_name;  /* Name to use in create operation */
    uint16_t length; /* Length in bytes of this structure with this header */
    /* Remainder of data is specific to the port type */
};


// Q-in-Q virtual port specification

struct of_bsn_vport_q_in_q : of_bsn_vport {
    uint16_t type == 0;
    of_port_name_t if_name;
    uint16_t length;  /* 32 */
    uint32_t port_no;     /* OF port number of parent; usually phys port */
    uint16_t ingress_tpid;
    uint16_t ingress_vlan_id;
    uint16_t egress_tpid;
    uint16_t egress_vlan_id;
};

// Request from controller to switch to create vport
struct of_bsn_virtual_port_create_request : of_bsn_header {
    uint8_t version;
    uint8_t type == 4;
    uint16_t length;
    uint32_t xid;
    uint32_t experimenter == 0x5c16c7;
    uint32_t subtype == 15;
    // FIXME This should be an instance of the inheritance superclass
    of_bsn_vport_q_in_q_t vport;   // Description of vport to create
    // Additional data follows depending on header type
};

// Reply from switch to controller indicating port number created
// vport_no must be 16 bits to be compatible with 1.0
struct of_bsn_virtual_port_create_reply : of_bsn_header {
    uint8_t version;
    uint8_t type == 4;
    uint16_t length;
    uint32_t xid;           // Must match create_request
    uint32_t experimenter == 0x5c16c7;
    uint32_t subtype == 16;
    uint32_t status;        // 0 means success
    uint32_t vport_no;      // The OF port number created.  16-bits for OF 1.0
};

// Request from controller to switch to remove a vport
struct of_bsn_virtual_port_remove_request : of_bsn_header {
    uint8_t version;
    uint8_t type == 4;
    uint16_t length;
    uint32_t xid;
    uint32_t experimenter == 0x5c16c7;
    uint32_t subtype == 17;
    uint32_t vport_no;      // The OF port number to be removed
};

// Request from controller to switch to remove a vport
struct of_bsn_virtual_port_remove_reply : of_bsn_header {
    uint8_t version;
    uint8_t type == 4;
    uint16_t length;
    uint32_t xid;           // Must match request xid
    uint32_t experimenter == 0x5c16c7;
    uint32_t subtype == 26;
    uint32_t status;        // 0 means success
};
