FreeBSD/contrib/ofed/libsdp/src/match.c
/* given a set of rules see if there is a global match for current program */
given a set of rules see if there is a global match for current program
given a set of rules see if there is a global match for current program
static use_family_t
match_by_all_rules_program(
	struct use_family_rule *rules )
{
	int any_sdp = 0;
	int any_tcp = 0;
	use_family_t target_family = USE_BOTH;
	struct use_family_rule *rule;
	for ( rule = rules; ( rule != NULL ) && ( target_family == USE_BOTH );
			rule = rule->next ) {
		if ( !match_program_name( rule ) )
			continue;
		if ( rule->match_by_addr || rule->match_by_port ) {
			if ( rule->target_family == USE_SDP )
				any_sdp++;
			else if ( rule->target_family == USE_TCP )
				any_tcp++;
		} else {
			if ( ( rule->target_family == USE_SDP ) && ( any_tcp == 0 ) )
				target_family = USE_SDP;
			else if ( ( rule->target_family == USE_TCP ) && ( any_sdp == 0 ) )
				target_family = USE_TCP;
		}
	}
	return ( target_family );
}
static use_family_t match_by_all_rules_program ( struct use_family_rule * rules ) { int any_sdp = 0 ; int any_tcp = 0 ; use_family_t target_family = USE_BOTH ; struct use_family_rule * rule ; for ( rule = rules ; ( rule != NULL ) && ( target_family == USE_BOTH ) ; rule = rule -> next ) { if ( ! match_program_name ( rule ) ) continue ; if ( rule -> match_by_addr || rule -> match_by_port ) { if ( rule -> target_family == USE_SDP ) any_sdp ++ ; else if ( rule -> target_family == USE_TCP ) any_tcp ++ ; } else { if ( ( rule -> target_family == USE_SDP ) && ( any_tcp == 0 ) ) target_family = USE_SDP ; else if ( ( rule -> target_family == USE_TCP ) && ( any_sdp == 0 ) ) target_family = USE_TCP ; } } return ( target_family ) ; }
given a set of rules see if there is a global match for current program
given a set of rules see if there is a global match for current program
/* skip if not our program */ /*
		 * to declare a dont care we either have a dont care address and port  
		 * or the previous non global rules use the same target family as the
		 * global rule
		 */ /* not a glocal match rule - just track the target family */ /* a global match so we can declare a match by program */