URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libnetworking/] [lib/] [getprotoby.c] - Rev 284
Go to most recent revision | Compare with Previous | Blame | View Log
/* * $Id: getprotoby.c,v 1.2 2001-09-27 12:01:52 chris Exp $ */ #include <netdb.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> static const struct protoent prototab[] = { { "ip", NULL, IPPROTO_IP }, { "icmp", NULL, IPPROTO_ICMP }, { "tcp", NULL, IPPROTO_TCP }, { "udp", NULL, IPPROTO_UDP }, }; /* * Dummy version of BSD getprotobyname() */ struct protoent * getprotobyname_static (const char *name) { int i; for (i = 0 ; i < (sizeof prototab / sizeof prototab[0]) ; i++) { if (strcmp (name, prototab[i].p_name) == 0) return (struct protoent *) &prototab[i]; } return NULL; } /* * Dummy version of BSD getprotobynumber() */ struct protoent * getprotobynumber_static (int proto) { int i; for (i = 0 ; i < (sizeof prototab / sizeof prototab[0]) ; i++) { if (proto == prototab[i].p_proto) return (struct protoent *) &prototab[i]; } return NULL; }
Go to most recent revision | Compare with Previous | Blame | View Log