Example #1
0
static void
dump_filter_strict( void ) {
  oxm_matches *match = create_oxm_matches();
  append_oxm_match_in_port( match, 1 );
  append_oxm_match_eth_type( match, 0x0800 );
  append_oxm_match_vlan_vid( match, 0, 0 );
  append_oxm_match_ipv4_src( match, 0x0a000001, 0 );
  append_oxm_match_ipv4_dst( match, 0x0a000002, 0 );
  append_oxm_match_ip_dscp( match, 0 );
  append_oxm_match_ip_ecn( match, 0 );
  append_oxm_match_ip_proto( match, 0x6 );
  append_oxm_match_tcp_src( match, 1024 );
  append_oxm_match_tcp_dst( match, 2048 );

  static handler_data data;
  data.match = match;
  snprintf( data.service_name, sizeof( data.service_name ), "dumper" );
  data.service_name[ sizeof( data.service_name ) - 1 ] = '\0';
  data.strict = true;

  bool ret = dump_packetin_filter( data.match, OFP_HIGH_PRIORITY, data.service_name, data.strict,
                                   dump_filters, &data );
  if ( ret == false ) {
    error( "Failed to dump packetin filters ( ret = %d ).", ret );
  }
  else {
    add_periodic_event_callback( 5, timeout, &data );
  }
}
Example #2
0
static VALUE
pack_ip_dscp( VALUE self, VALUE actions, VALUE options ) {
  VALUE r_ip_dscp = HASH_REF( options, ip_dscp );
  if ( rb_obj_is_kind_of( actions, basic_action_eval ) ) {
    append_action_set_field_ip_dscp( openflow_actions_ptr( actions ), ( const uint8_t ) NUM2UINT( r_ip_dscp ) );
  }
  else if ( rb_obj_is_kind_of( actions, flexible_action_eval ) ) {
    append_oxm_match_ip_dscp( oxm_match_ptr( actions ), ( uint8_t ) r_ip_dscp );
  }

  return self;
}