mirror of
https://github.com/irssi/irssi.git
synced 2026-08-20 09:02:13 +02: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:
parent
0ef53540c0
commit
babf7c77ac
2 changed files with 12 additions and 0 deletions
|
|
@ -515,6 +515,15 @@ int net_hosterror_notfound(int error)
|
||||||
#endif
|
#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)
|
int is_ipv4_address(const char *host)
|
||||||
{
|
{
|
||||||
while (*host != '\0') {
|
while (*host != '\0') {
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,9 @@ int net_host2ip(const char *host, IPADDR *ip);
|
||||||
/* Get socket error */
|
/* Get socket error */
|
||||||
int net_geterror(GIOChannel *handle);
|
int net_geterror(GIOChannel *handle);
|
||||||
|
|
||||||
|
/* Get name of TCP service */
|
||||||
|
char *net_getservbyport(int port);
|
||||||
|
|
||||||
int is_ipv4_address(const char *host);
|
int is_ipv4_address(const char *host);
|
||||||
int is_ipv6_address(const char *host);
|
int is_ipv6_address(const char *host);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue