|
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: 3635 (0xe33) Types: TextFile Names: »aetdbm.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« └─⟦de7628f85⟧ └─⟦this⟧ »isode-6.0/acsap/aetdbm.c«
/* aetdbm.c - application entity titles -- dbm lookup */ #ifndef lint static char *rcsid = "$Header: /f/osi/acsap/RCS/aetdbm.c,v 7.0 89/11/23 21:22:05 mrose Rel $"; #endif /* * $Header: /f/osi/acsap/RCS/aetdbm.c,v 7.0 89/11/23 21:22:05 mrose Rel $ * * * $Log: aetdbm.c,v $ * Revision 7.0 89/11/23 21:22:05 mrose * Release 6.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)) < 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); } bcopy ((char *) &entry -> dbm_entity, (char *) ie, sizeof *ie); 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); } bcopy ((char *) &entry -> dbm_entity, (char *) ie, sizeof *ie); 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); } bcopy ((char *) &entry -> dbm_entity, (char *) &ids, sizeof ids); 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