MCPcopy Create free account
hub / github.com/M66B/NetGuard / getProtocolName

Method getProtocolName

app/src/main/java/eu/faircode/netguard/Util.java:561–595  ·  view source on GitHub ↗
(int protocol, int version, boolean brief)

Source from the content-addressed store, hash-verified

559 }
560
561 public static String getProtocolName(int protocol, int version, boolean brief) {
562 // https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers
563 String p = null;
564 String b = null;
565 switch (protocol) {
566 case 0:
567 p = "HOPO";
568 b = "H";
569 break;
570 case 2:
571 p = "IGMP";
572 b = "G";
573 break;
574 case 1:
575 case 58:
576 p = "ICMP";
577 b = "I";
578 break;
579 case 6:
580 p = "TCP";
581 b = "T";
582 break;
583 case 17:
584 p = "UDP";
585 b = "U";
586 break;
587 case 50:
588 p = "ESP";
589 b = "E";
590 break;
591 }
592 if (p == null)
593 return Integer.toString(protocol) + "/" + version;
594 return ((brief ? b : p) + (version > 0 ? version : ""));
595 }
596
597 public interface DoubtListener {
598 void onSure();

Callers 7

bindViewMethod · 0.95
bindViewMethod · 0.95
onPostExecuteMethod · 0.95
bindViewMethod · 0.95
onItemClickMethod · 0.95
onItemClickMethod · 0.95
onItemClickMethod · 0.95

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected