RTEMS now provides the getprotobyXXX routines.
This commit is contained in:
@@ -43,40 +43,3 @@ int connectWithTimeout (int sfd,
|
||||
setsockopt (sfd, SOL_SOCKET, SO_RCVTIMEO, (char *)&sv, sizeof sv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* RTEMS does not have the getprotobyXXX routines.
|
||||
* Provide these simple-minded versions.
|
||||
*/
|
||||
static char *ip_alias[] = { "IP", NULL };
|
||||
static char *icmp_alias[] = { "ICMP", NULL };
|
||||
static char *tcp_alias[] = { "TCP", NULL };
|
||||
static char *udp_alias[] = { "UDP", NULL };
|
||||
static struct protoent prototab[] = {
|
||||
{ "IP", ip_alias, IPPROTO_IP },
|
||||
{ "ICMP", icmp_alias, IPPROTO_ICMP },
|
||||
{ "TCP", tcp_alias, IPPROTO_TCP },
|
||||
{ "UDP", udp_alias, IPPROTO_UDP },
|
||||
};
|
||||
struct protoent *
|
||||
getprotobyname (const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < (sizeof prototab / sizeof prototab[0]) ; i++) {
|
||||
if (strcasecmp (name, prototab[i].p_name) == 0)
|
||||
return (struct protoent *) &prototab[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
struct protoent *
|
||||
getprotobynumber (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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user