Ejemplo n.º 1
0
// FIXME: Copy & Paste from hello_switch.c
static void
handle_features_request( uint32_t xid, void *user_data ) {
    UNUSED( user_data );

    uint32_t supported = ( ( 1 << OFPAT_OUTPUT ) |
                           ( 1 << OFPAT_SET_VLAN_VID ) |
                           ( 1 << OFPAT_SET_VLAN_PCP ) |
                           ( 1 << OFPAT_STRIP_VLAN ) |
                           ( 1 << OFPAT_SET_DL_SRC ) |
                           ( 1 << OFPAT_SET_DL_DST ) |
                           ( 1 << OFPAT_SET_NW_SRC ) |
                           ( 1 << OFPAT_SET_NW_DST ) |
                           ( 1 << OFPAT_SET_NW_TOS ) |
                           ( 1 << OFPAT_SET_TP_SRC ) |
                           ( 1 << OFPAT_SET_TP_DST ) );

    buffer *msg = create_features_reply( xid, get_datapath_id(), 0, 1, 0, supported, NULL );

    switch_send_openflow_message( msg );
}
Ejemplo n.º 2
0
static void
_handle_features_request( const uint32_t transaction_id, void *user_data ) {
  assert( user_data );
  struct protocol *protocol = user_data;

  switch_features features;
  memset( &features, 0, sizeof( switch_features ) );
  get_switch_features( &features );
  /*
   * The n_buffers field specifies the maximum number of packets the switch can
   * buffer when sending packets to the controller using packet-in messages.
   */
  buffer *features_reply = create_features_reply( transaction_id, features.datapath_id, features.n_buffers,
                                                  features.n_tables, features.auxiliary_id, features.capabilities );
  if ( switch_send_openflow_message( features_reply ) ) {
    protocol->ctrl.controller_connected = true;
    /*
     * save datapath's capabilities
     */
    protocol->ctrl.capabilities = features.capabilities;
  }
  free_buffer( features_reply );
}
Ejemplo n.º 3
0
static VALUE
features_reply_alloc( VALUE klass ) {
  buffer *features_reply = create_features_reply( 0, 0, 0, 0, 0, 0, NULL );
  return Data_Wrap_Struct( klass, NULL, free_buffer, features_reply );
}