1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-23 06:35:36 +00:00

net_getservbyport() - Get name of TCP service

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1134 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-01-18 02:23:35 +00:00 committed by cras
parent 0ef53540c0
commit babf7c77ac
2 changed files with 12 additions and 0 deletions

View File

@ -515,6 +515,15 @@ int net_hosterror_notfound(int error)
#endif
}
/* Get name of TCP service */
char *net_getservbyport(int port)
{
struct servent *entry;
entry = getservbyport(htons((unsigned short) port), "tcp");
return entry == NULL ? NULL : entry->s_name;
}
int is_ipv4_address(const char *host)
{
while (*host != '\0') {

View File

@ -73,6 +73,9 @@ int net_host2ip(const char *host, IPADDR *ip);
/* Get socket error */
int net_geterror(GIOChannel *handle);
/* Get name of TCP service */
char *net_getservbyport(int port);
int is_ipv4_address(const char *host);
int is_ipv6_address(const char *host);