|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T a
Length: 3573 (0xdf5)
Types: TextFile
Names: »aetdbm.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
└─⟦eba4602b1⟧ »./isode-5.0.tar.Z«
└─⟦d3ac74d73⟧
└─⟦this⟧ »isode-5.0/acsap/aetdbm.c«
/* aetdbm.c - application entity titles -- dbm lookup */
#ifndef lint
static char *rcsid = "$Header: /f/osi/acsap/RCS/aetdbm.c,v 6.0 89/03/18 23:24:35 mrose Rel $";
#endif
/*
* $Header: /f/osi/acsap/RCS/aetdbm.c,v 6.0 89/03/18 23:24:35 mrose Rel $
*
*
* $Log: aetdbm.c,v $
* Revision 6.0 89/03/18 23:24:35 mrose
* Release 5.0
*
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
/* LINTLIBRARY */
#include <stdio.h>
#include "psap.h"
#include "isoaddrs.h"
#include "tailor.h"
#ifdef AETDBM
#undef NULL
#include <dbm.h>
/* \f
DATA */
struct dbm_entry {
struct isoentity dbm_entity;
unsigned int dbm_elements[NELEM + 1];
};
static char *isoentities = "isoentities";
static int inited = 0;
static unsigned int elements[NELEM + 1];
static char objent[BUFSIZ];
/* \f
*/
int str2aet_dbm (designator, qualifier, iep)
char *designator,
*qualifier;
struct isoentity *iep;
{
char *cp,
defent[BUFSIZ];
register struct isoentity *ie;
struct isoentity ids,
ies;
register struct dbm_entry *entry;
datum key,
value;
if (inited == 0) {
if (dbminit (cp = isodefile (isoentities)) < 0) {
SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
("unable to initialize %s", cp));
return str2aet_seq (designator, qualifier, iep);
}
inited = 1;
}
(void) sprintf (objent, "%s-%s", designator, qualifier);
ie = &ies;
key.dsize = strlen (key.dptr = objent) + 1;
value = fetch (key);
if (entry = (struct dbm_entry *) value.dptr) {
if (value.dsize != sizeof *entry) {
SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
("isoentities dbm corrupt!"));
return str2aet_seq (designator, qualifier, iep);
}
*ie = entry -> dbm_entity; /* struct copy */
bcopy ((char *) entry -> dbm_elements, (char *) elements,
sizeof elements);
ie -> ie_identifier.oid_elements = elements;
ie -> ie_descriptor = objent;
}
else {
(void) sprintf (defent, "%s-%s", "default", qualifier);
key.dsize = strlen (key.dptr = defent) + 1;
value = fetch (key);
if (entry = (struct dbm_entry *) value.dptr) {
if (value.dsize != sizeof *entry) {
SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
("isoentities dbm corrupt!"));
return str2aet_seq (designator, qualifier, iep);
}
*ie = entry -> dbm_entity; /* struct copy */
bcopy ((char *) entry -> dbm_elements, (char *) elements,
sizeof elements);
ie -> ie_identifier.oid_elements = elements;
ie -> ie_descriptor = objent;
}
else
return NOTOK;
(void) sprintf (defent, "%s-%s", designator, "default");
key.dsize = strlen (key.dptr = defent) + 1;
value = fetch (key);
if (entry = (struct dbm_entry *) value.dptr) {
if (value.dsize != sizeof *entry) {
SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
("isoentities dbm corrupt!"));
return str2aet_seq (designator, qualifier, iep);
}
ids = entry -> dbm_entity; /* struct copy */
ids.ie_identifier.oid_elements = entry -> dbm_elements;
ids.ie_descriptor = objent;
bcopy ((char *) ids.ie_addr.pa_addr.sa_addr.ta_addrs,
(char *) ie -> ie_addr.pa_addr.sa_addr.ta_addrs,
sizeof ie -> ie_addr.pa_addr.sa_addr.ta_addrs);
ie -> ie_addr.pa_addr.sa_addr.ta_naddr =
ids.ie_addr.pa_addr.sa_addr.ta_naddr;
}
}
*iep = *ie; /* struct copy */
return OK;
}
#endif