NAME

catnet_servbyname - network database function, retrieve service by name

SYNOPSIS

#include <cat/catutil.h>

catnet_serv *catnet_servbyname(const char *name, const char *proto);

DESCRIPTION

This is a thread-safe wrapper function used to retrieve the service via the service name and the protocol proto. The call returns a pointer to a catnet serv struct that looks as follows:

  typedef struct catnet_serv {
      char **names;               /* name, alias, ..., NULL */
      int port;                   /* port number */
  } catnet_serv;

The names parameter will contain any aliases for the service, and port will contain the port number for the service.

The returned pointer points to dynamically allocated memory that needs to be freed by the caller with a call to free().

NOTES

This function is thread-safe, but is otherwise a wrapper around the standard call getservbyname or getservbyname_r.

SEE ALSO

cat, catutil

catnet_servbyport