Scoreboard with multiple analysis connections to a single monitor class

I have a single monitor class that I use for multiple agents. Some agents are for my UDP_in_x, TCP_in_x, UDP_out_x, TCP_out_x. This monitor class has a uvm_analysis_port and connects to a scoreboard with many analysis_imps. The issue I am having is that the in’s and out’s are an array of agents. So I named them udp_in_0, … udp_in_n. Same for the rest. When writing to the scoreboard, I use a write(item) function and then based on the name I pass to the monitor, I write to a function in the scoreboard for that interface, so write_udp_in(item), write_tcp_in(item), write_tcp_out(item), etc. The issue is that I need to know if its udp_in_0, or 1 or 2 etc. to determine which queue to put the item in when I write the item in the scoreboard. Essentially what Id like to do is turn the monitor as generic as possible. and I can’t find the best way to do this with a single monitor class. The best approach I have to do this is below.

      		  if (contains(my_name,"udp_out")) begin     		     
		     item.inf_type = "udp_out";
                     if(contains(my_name,"_0"))	item.inf_id = 0;
                     if(contains(my_name,"_1"))	item.inf_id = 1;
                     if(contains(my_name,"_2")) item.inf_id = 2;                      
                     if(contains(my_name,"_3")) item.inf_id = 3; 
                     if(contains(my_name,"_4"))	item.inf_id = 4;
                     if(contains(my_name,"_5"))	item.inf_id = 5;
                     if(contains(my_name,"_6")) item.inf_id = 6;                      
                     if(contains(my_name,"_7")) item.inf_id = 7; 

The inf_type is to determine in scoreboard what type of interface is writing to the scoreboard.

However this is very much not UVM like. And redundant for other interfaces. Additionally I have to add more name checking for when the inf_id exceeds 7.

Here is a portion of what my scoreboard imps look like,

uvm_analysis_imp #(Item_Mon_to_Scrb, my_scoreboard)                                            m_analysis_imp0                     [UDP_COUNT-1:0];  // udp_in
   uvm_analysis_imp #(Item_Mon_to_Scrb, my_scoreboard)                                            m_analysis_imp9                     [UDP_COUNT-1:0];  // udp_out      

Maybe I am thinking of this totally wrong, but it would be best if there is a way for the scoreboard to see which analysis_port is writing to it, and then can get its name and number from the connection to the monitor.