Back to index

glibc  2.9
Typedefs | Functions | Variables
nis_file.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rpcsvc/nis.h>
#include "nis_xdr.h"

Go to the source code of this file.

Typedefs

typedef bool_t(* iofct_t )(XDR *, void *)
typedef void(* freefct_t )(void *)

Functions

static void * read_nis_obj (const char *name, iofct_t readfct, freefct_t freefct, size_t objsize)
static bool_t write_nis_obj (const char *name, const void *obj, iofct_t writefct)
directory_obj * readColdStartFile (void)
 libnsl_hidden_def (readColdStartFile)
nis_object * nis_read_obj (const char *name)
bool_t nis_write_obj (const char *name, const nis_object *obj)

Variables

static const char cold_start_file [] = "/var/nis/NIS_COLD_START"

Typedef Documentation

typedef void(* freefct_t)(void *)

Definition at line 27 of file nis_file.c.

typedef bool_t(* iofct_t)(XDR *, void *)

Definition at line 26 of file nis_file.c.


Function Documentation

Definition at line 84 of file nis_file.c.

Here is the call graph for this function:

nis_object* nis_read_obj ( const char *  name)

Definition at line 93 of file nis_file.c.

{
  return read_nis_obj (name, (iofct_t) _xdr_nis_object,
                     (freefct_t) nis_free_object, sizeof (nis_object));
}

Here is the call graph for this function:

bool_t nis_write_obj ( const char *  name,
const nis_object *  obj 
)

Definition at line 100 of file nis_file.c.

Here is the call graph for this function:

static void* read_nis_obj ( const char *  name,
iofct_t  readfct,
freefct_t  freefct,
size_t  objsize 
) [static]

Definition at line 31 of file nis_file.c.

{
  FILE *in = fopen (name, "rc");
  if (in == NULL)
    return NULL;

  void *obj = calloc (1, objsize);

  if (obj != NULL)
    {
      XDR xdrs;
      xdrstdio_create (&xdrs, in, XDR_DECODE);
      bool_t status = readfct (&xdrs, obj);
      xdr_destroy (&xdrs);

      if (!status)
       {
         freefct (obj);
         obj = NULL;
       }
    }

  fclose (in);

  return obj;
}

Here is the call graph for this function:

Here is the caller graph for this function:

directory_obj* readColdStartFile ( void  )

Definition at line 79 of file nis_file.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static bool_t write_nis_obj ( const char *  name,
const void *  obj,
iofct_t  writefct 
) [static]

Definition at line 60 of file nis_file.c.

{
  FILE *out = fopen (name, "w");
  if (out == NULL)
    return FALSE;

  XDR xdrs;
  xdrstdio_create (&xdrs, out, XDR_ENCODE);
  bool_t status = writefct (&xdrs, (void *) obj);
  xdr_destroy (&xdrs);
  fclose (out);

  return status;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char cold_start_file[] = "/var/nis/NIS_COLD_START" [static]

Definition at line 76 of file nis_file.c.