Sha256: 3bd75416abb998d3c0767c36db963f7e5b96eb65904c67295865a482f17b5e64

Contents?: true

Size: 1.6 KB

Versions: 18

Compression:

Stored size: 1.6 KB

Contents

/*
 * A simple OpenFlow controller for "cbench" benchmark.
 *
 * Copyright (C) 2008-2013 NEC Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2, as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */


#include "trema.h"


static void
handle_packet_in( uint64_t datapath_id, packet_in message ) {
  openflow_actions *actions = create_actions();
  append_action_output( actions, ( uint16_t ) ( message.in_port + 1 ), UINT16_MAX );

  struct ofp_match match;
  set_match_from_packet( &match, message.in_port, 0, message.data );

  buffer *flow_mod = create_flow_mod(
    get_transaction_id(),
    match,
    get_cookie(),
    OFPFC_ADD,
    0,
    0,
    UINT16_MAX,
    message.buffer_id,
    OFPP_NONE,
    0,
    actions
  );
  send_openflow_message( datapath_id, flow_mod );

  free_buffer( flow_mod );
  delete_actions( actions );
}


int
main( int argc, char *argv[] ) {
  init_trema( &argc, &argv );
  set_packet_in_handler( handle_packet_in, NULL );
  start_trema();
  return 0;
}


/*
 * Local variables:
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * End:
 */

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
trema-0.4.5 src/examples/cbench_switch/cbench_switch.c
trema-0.4.4 src/examples/cbench_switch/cbench_switch.c
trema-0.4.3 src/examples/cbench_switch/cbench_switch.c
trema-0.4.2 src/examples/cbench_switch/cbench_switch.c
trema-0.4.1 src/examples/cbench_switch/cbench_switch.c
trema-0.4.0 src/examples/cbench_switch/cbench_switch.c
trema-0.3.21 src/examples/cbench_switch/cbench_switch.c
trema-0.3.20 src/examples/cbench_switch/cbench_switch.c
trema-0.3.19 src/examples/cbench_switch/cbench_switch.c
trema-0.3.18 src/examples/cbench_switch/cbench_switch.c
trema-0.3.17 src/examples/cbench_switch/cbench_switch.c
trema-0.3.16 src/examples/cbench_switch/cbench_switch.c
trema-0.3.15 src/examples/cbench_switch/cbench_switch.c
trema-0.3.14 src/examples/cbench_switch/cbench_switch.c
trema-0.3.13 src/examples/cbench_switch/cbench_switch.c
trema-0.3.12 src/examples/cbench_switch/cbench_switch.c
trema-0.3.11 src/examples/cbench_switch/cbench_switch.c
trema-0.3.10 src/examples/cbench_switch/cbench_switch.c