Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where are the IP protocol #'s (ip.h:ip->ip_p) defined?

328 views
Skip to first unread message

Alex Withers

unread,
Jul 11, 2002, 3:23:21 PM7/11/02
to
Does anyone know is what *.h file the protocol numbers are defined for the
ip header struct in netinet/ip.h (the values stored in ip_p)? I know what
the numbers are (they're listed in RFC 790,768,791,etc.) but I need to
know where (and possibly *if*) they are defined in the *.h files.

Thanks

--


Alex

Barry Margolin

unread,
Jul 11, 2002, 4:14:04 PM7/11/02
to
In article <slrnairmp9....@barney.gonzaga.edu>,

You can get them dynamically using getprotobyname(3), which looks in
/etc/protocols. However, some of them are hard-coded in the header file
netinet/in.h:

/*
* Protocols
*/
#define IPPROTO_IP 0 /* dummy for IP */
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_IGMP 2 /* group control protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
#define IPPROTO_ENCAP 4 /* IP in IP encapsulation */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#define IPPROTO_PUP 12 /* pup */
#define IPPROTO_UDP 17 /* user datagram protocol */
#define IPPROTO_IDP 22 /* xns idp */
#define IPPROTO_RSVP 46 /* rsvp */
#define IPPROTO_HELLO 63 /* "hello" routing protocol */
#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */
#define IPPROTO_EON 80 /* ISO clnp */

#define IPPROTO_RAW 255 /* raw IP packet */
#define IPPROTO_MAX 256

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

Message has been deleted
0 new messages