Back to index

glibc  2.9
Classes | Defines | Typedefs | Functions | Variables
nis_intern.h File Reference
#include <features.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nis_cb

Defines

#define __NIS_PING_RETRY   2
#define __NIS_PING_TIMEOUT_START   3
#define __NIS_PING_TIMEOUT_INCREMENT   3

Typedefs

typedef struct nis_cb

Functions

unsigned long int inetstr2int (const char *str)
long int __nis_findfastest (dir_binding *bind)
nis_error __do_niscall2 (const nis_server *serv, u_int serv_len, u_long prog, xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp, unsigned int flags, nis_cb *cb)
nis_error __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp, unsigned int flags, nis_cb *cb)
nis_error __do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp, unsigned int flags, nis_cb *cb)
 libnsl_hidden_proto (__do_niscall3) extern u_short __pmap_getnisport(struct sockaddr_in *address
nis_error __nis_do_callback (struct dir_binding *bptr, netobj *cookie, struct nis_cb *cb)
struct nis_cb__nis_create_callback (int(*callback)(const_nis_name, const nis_object *, const void *), const void *userdata, unsigned int flags)
nis_error __nis_destroy_callback (struct nis_cb *cb)

Variables

u_long program
u_long u_long version
u_long u_long u_int protocol

Define Documentation

#define __NIS_PING_RETRY   2

Definition at line 29 of file nis_intern.h.

Definition at line 37 of file nis_intern.h.

#define __NIS_PING_TIMEOUT_START   3

Definition at line 33 of file nis_intern.h.


Typedef Documentation

typedef struct nis_cb

Definition at line 53 of file nis_intern.h.


Function Documentation

nis_error __do_niscall ( const_nis_name  name,
u_long  prog,
xdrproc_t  xargs,
caddr_t  req,
xdrproc_t  xres,
caddr_t  resp,
unsigned int  flags,
nis_cb cb 
)

Here is the caller graph for this function:

nis_error __do_niscall2 ( const nis_server *  serv,
u_int  serv_len,
u_long  prog,
xdrproc_t  xargs,
caddr_t  req,
xdrproc_t  xres,
caddr_t  resp,
unsigned int  flags,
nis_cb cb 
)

Here is the caller graph for this function:

nis_error __do_niscall3 ( dir_binding *  dbp,
u_long  prog,
xdrproc_t  xargs,
caddr_t  req,
xdrproc_t  xres,
caddr_t  resp,
unsigned int  flags,
nis_cb cb 
)

Here is the caller graph for this function:

struct nis_cb* __nis_create_callback ( int(*)(const_nis_name, const nis_object *, const void *)  callback,
const void *  userdata,
unsigned int  flags 
) [read]

Definition at line 262 of file nis_callback.c.

{
  struct nis_cb *cb;
  int sock = RPC_ANYSOCK;
  struct sockaddr_in sin;
  socklen_t len = sizeof (struct sockaddr_in);
  unsigned short port;
  int nomsg = 0;

  cb = (struct nis_cb *) calloc (1,
                             sizeof (struct nis_cb) + sizeof (nis_server));
  if (__builtin_expect (cb == NULL, 0))
    goto failed;
  cb->serv = (nis_server *) (cb + 1);
  cb->serv->name = strdup (nis_local_principal ());
  if (__builtin_expect (cb->serv->name == NULL, 0))
    goto failed;
  cb->serv->ep.ep_val = (endpoint *) calloc (2, sizeof (endpoint));
  if (__builtin_expect (cb->serv->ep.ep_val == NULL, 0))
    goto failed;
  cb->serv->ep.ep_len = 1;
  cb->serv->ep.ep_val[0].family = strdup ("inet");
  if (__builtin_expect (cb->serv->ep.ep_val[0].family == NULL, 0))
    goto failed;
  cb->callback = callback;
  cb->userdata = userdata;

  if ((flags & NO_AUTHINFO) || !key_secretkey_is_set ())
    {
      cb->serv->key_type = NIS_PK_NONE;
      cb->serv->pkey.n_bytes = NULL;
      cb->serv->pkey.n_len = 0;
    }
  else
    {
#if 0
      if ((cb->serv->pkey.n_bytes = __nis_getpkey (cb->serv->name)) == NULL)
       {
         cb->serv->pkey.n_len = 0;
         cb->serv->key_type = NIS_PK_NONE;
       }
      else
       {
         cb->serv->key_type = NIS_PK_DH;
         cb->serv->pkey.n_len = strlen(cb->serv->pkey.n_bytes);
       }
#else
      cb->serv->pkey.n_len =0;
      cb->serv->pkey.n_bytes = NULL;
      cb->serv->key_type = NIS_PK_NONE;
#endif
    }

  cb->serv->ep.ep_val[0].proto = strdup ((flags & USE_DGRAM) ? "udp" : "tcp");
  if (__builtin_expect (cb->serv->ep.ep_val[0].proto == NULL, 0))
    goto failed;
  cb->xprt = ((flags & USE_DGRAM)
             ? svcudp_bufcreate (sock, 100, 8192)
             : svctcp_create (sock, 100, 8192));
  if (cb->xprt == NULL)
    {
      nomsg = 1;
      goto failed;
    }
  cb->sock = cb->xprt->xp_sock;
  if (!svc_register (cb->xprt, CB_PROG, CB_VERS, cb_prog_1, 0))
    {
      xprt_unregister (cb->xprt);
      svc_destroy (cb->xprt);
      xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
      free (cb);
      syslog (LOG_ERR, "NIS+: failed to register callback dispatcher");
      return NULL;
    }

  if (getsockname (cb->sock, (struct sockaddr *) &sin, &len) == -1)
    {
      xprt_unregister (cb->xprt);
      svc_destroy (cb->xprt);
      xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
      free (cb);
      syslog (LOG_ERR, "NIS+: failed to read local socket info");
      return NULL;
    }
  port = ntohs (sin.sin_port);
  get_myaddress (&sin);

  if (asprintf (&cb->serv->ep.ep_val[0].uaddr, "%s.%d.%d",
              inet_ntoa (sin.sin_addr), (port & 0xFF00) >> 8, port & 0x00FF)
      < 0)
    goto failed;

  return cb;

 failed:
  if (cb)
    {
      if (cb->xprt)
       svc_destroy (cb->xprt);
      xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
      free (cb);
    }
  if (!nomsg)
    syslog (LOG_ERR, "NIS+: out of memory allocating callback");
  return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nis_error __nis_destroy_callback ( struct nis_cb cb)

Definition at line 372 of file nis_callback.c.

{
  xprt_unregister (cb->xprt);
  svc_destroy (cb->xprt);
  close (cb->sock);
  xdr_free ((xdrproc_t) _xdr_nis_server, (char *) cb->serv);
  free (cb);

  return NIS_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nis_error __nis_do_callback ( struct dir_binding *  bptr,
netobj cookie,
struct nis_cb cb 
)

Definition at line 247 of file nis_callback.c.

{
  nis_error result;

  __libc_lock_lock (callback);

  result = internal_nis_do_callback (bptr, cookie, cb);

  __libc_lock_unlock (callback);

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

long int __nis_findfastest ( dir_binding *  bind)

Definition at line 243 of file nis_findserv.c.

{
  struct timeval timeout = { __NIS_PING_TIMEOUT_START, 0 };
  long int found = -1;
  long int retry = __NIS_PING_RETRY + 1;

  while (retry--)
    {
      found = __nis_findfastest_with_timeout (bind, &timeout);
      if (found != -1)
       break;
      timeout.tv_sec += __NIS_PING_TIMEOUT_INCREMENT;
    }

  return found;
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned long int inetstr2int ( const char *  str)

Definition at line 46 of file nis_call.c.

{
  size_t j = 0;
  for (size_t i = 0; str[i] != '\0'; ++i)
    if (str[i] == '.' && __builtin_expect (++j == 4, 0))
      {
       char buffer[i + 1];
       buffer[i] = '\0';
       return inet_addr (memcpy (buffer, str, i));
      }

  return inet_addr (str);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 71 of file nis_intern.h.

Definition at line 71 of file nis_intern.h.

Definition at line 71 of file nis_intern.h.