title: Convert <netinet/in.h> protocols to names?
body: <p>There is a long list of protocols defined in &lt;netinet/in.h&gt;:</p>
  <pre><code>/*
   * Protocols (RFC 1700)
   */
  #define IPPROTO_IP              0               /* dummy for IP */
  #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  #define IPPROTO_HOPOPTS 0               /* IP6 hop-by-hop options */
  #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
  #define IPPROTO_ICMP            1               /* control message protocol */
  #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  #define IPPROTO_IGMP            2               /* group mgmt protocol */
  #define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
  #define IPPROTO_IPV4            4               /* IPv4 encapsulation */
  #define IPPROTO_IPIP            IPPROTO_IPV4    /* for compatibility */
  #endif  /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
  #define IPPROTO_TCP             6               /* tcp */
  #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  #define IPPROTO_ST              7               /* Stream protocol II */
  
  /* ... */
  </code></pre>
  <p>Is there a default function/call to translate protocols defined in &lt;netinet/in.h&gt; to names? Ideal to have chars[] in return:</p>
  <pre><code>ipproto2str(IPPROTO_ICMP): &quot;Control Message Protocol (ICMP)&quot;
  </code></pre>