home *** CD-ROM | disk | FTP | other *** search
- /* History:
- 5/1/91 DJB baseline public domain
- */
-
- /*
-
- char *printprotoinet(proto) int proto; returns a string representation
- of the given Internet protocol, or 0 if the protocol is unrecognized.
- The string returned might not be malloced but will not be overwritten on
- separate calls.
-
- */
-
- #include "structsockaddrin.h"
- #include "printprotoinet.h"
-
- char *printprotoinet(proto)
- int proto;
- {
- switch(proto)
- {
- #ifdef IPPROTO_TCP
- case IPPROTO_TCP: return "tcp";
- #endif
- #ifdef IPPROTO_UDP
- case IPPROTO_UDP: return "udp";
- #endif
- #ifdef IPPROTO_IP
- case IPPROTO_IP: return "ip";
- #endif
- #ifdef IPPROTO_ICMP
- case IPPROTO_ICMP: return "icmp";
- #endif
- #ifdef IPPROTO_IGMP
- case IPPROTO_IGMP: return "igmp";
- #endif
- #ifdef IPPROTO_GGP
- case IPPROTO_GGP: return "ggp";
- #endif
- #ifdef IPPROTO_EGP
- case IPPROTO_EGP: return "egp";
- #endif
- #ifdef IPPROTO_PUP
- case IPPROTO_PUP: return "pup";
- #endif
- #ifdef IPPROTO_IDP
- case IPPROTO_IDP: return "idp";
- #endif
- #ifdef IPPROTO_ND
- case IPPROTO_ND: return "nd";
- #endif
- #ifdef IPPROTO_RAW
- case IPPROTO_RAW: return "raw";
- #endif
- default: return 0;
- }
- }
-