Annotation of 43BSDReno/contrib/isode-beta/acsap/acsapaddr.c, revision 1.1.1.1

1.1       root        1: /* acsapaddr.c - application entity information -- lookup */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapaddr.c,v 7.2 90/07/27 08:41:46 mrose Exp $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/acsap/RCS/acsapaddr.c,v 7.2 90/07/27 08:41:46 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       acsapaddr.c,v $
                     12:  * Revision 7.2  90/07/27  08:41:46  mrose
                     13:  * update
                     14:  * 
                     15:  * Revision 7.1  90/07/09  14:30:27  mrose
                     16:  * sync
                     17:  * 
                     18:  * Revision 7.0  89/11/23  21:21:45  mrose
                     19:  * Release 6.0
                     20:  * 
                     21:  */
                     22: 
                     23: /*
                     24:  *                               NOTICE
                     25:  *
                     26:  *    Acquisition, use, and distribution of this module and related
                     27:  *    materials are subject to the restrictions of a license agreement.
                     28:  *    Consult the Preface in the User's Manual for the full terms of
                     29:  *    this agreement.
                     30:  *
                     31:  */
                     32: 
                     33: 
                     34: /* LINTLIBRARY */
                     35: 
                     36: #include <stdio.h>
                     37: #include "psap.h"
                     38: #include "isoaddrs.h"
                     39: #include "tailor.h"
                     40: 
                     41: 
                     42: #ifndef        NOSTUB
                     43: AEI    str2aei_stub ();
                     44: struct PSAPaddr *aei2addr_stub ();
                     45: #endif
                     46: 
                     47: AEI    str2aei_dse ();
                     48: struct PSAPaddr *aei2addr_dse ();
                     49: 
                     50: /*    DATA */
                     51: 
                     52: #ifndef        NOSTUB
                     53: static char fallback1[BUFSIZ],
                     54:            fallback2[BUFSIZ],
                     55:            fallback3[BUFSIZ];
                     56: #endif
                     57: 
                     58: static struct PSAPaddr *(*lookup) () = NULL;
                     59: 
                     60: /*  */
                     61: 
                     62: /* backwards compatibility... */
                     63: 
                     64: static struct mapping {
                     65:     char   *m_key;
                     66:     char   *m_value;
                     67: }      sac2cn[] = {
                     68:     "iso ftam",        "filestore",
                     69:     "iso vt",          "terminal",
                     70:     "iso cmip",                "mib",
                     71:     "isode passwd lookup demo",
                     72:                        "passwdstore",
                     73:     "isode shell",     "shell",
                     74:     "IRP Z39.50",      "Z39.50",
                     75:     "pp qmgr interface","pp qmgr",
                     76: 
                     77:     NULL
                     78: };
                     79: 
                     80: /*  */
                     81: 
                     82: AEI    _str2aei (designator, qualifier, context, interactive)
                     83: char   *designator,
                     84:        *qualifier,
                     85:        *context;
                     86: int    interactive;
                     87: {
                     88:     AEI            aei;
                     89:     register struct mapping *m;
                     90: 
                     91:     if (qualifier == NULLCP) {
                     92:        if (context)
                     93:            for (m = sac2cn; m -> m_key; m++)
                     94:                if (strcmp (m -> m_key, context) == 0) {
                     95:                    qualifier = m -> m_value;
                     96:                    break;
                     97:                }
                     98: 
                     99:        if (qualifier == NULLCP)
                    100:            qualifier = context ? context: "default";
                    101:     }
                    102: 
                    103:     if (context == NULLCP) {
                    104:        for (m = sac2cn; m -> m_key; m++)
                    105:            if (strcmp (m -> m_value, qualifier) == 0) {
                    106:                context = m -> m_key;
                    107:                break;
                    108:            }
                    109: 
                    110:        if (context == NULLCP)
                    111:            context = qualifier;
                    112:     }
                    113: 
                    114:     isodetailor (NULLCP, 0);
                    115:     LLOG (addr_log, LLOG_TRACE,
                    116:          ("str2aei \"%s\" \"%s\" \"%s\" %d",
                    117:           designator, qualifier, context, interactive));
                    118: 
                    119:     aei = NULL, lookup = NULL;
                    120:     PY_pepy[0] = NULL;
                    121: 
                    122:     if (ns_enabled) {
                    123:        if (aei = str2aei_dse (designator, qualifier, context, interactive)) {
                    124:            lookup = aei2addr_dse;
                    125: #ifndef        NOSTUB
                    126:            (void) strcpy (fallback1, designator);
                    127:            (void) strcpy (fallback2, context);
                    128:            (void) strcpy (fallback3, qualifier);
                    129:            goto out;
                    130: #endif
                    131:        }
                    132:        else
                    133:            SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
                    134:                  ("DSE lookup of service \"%s\" \"%s\" \"%s\" failed",
                    135:                   designator, context, qualifier));
                    136:     }
                    137: 
                    138: #ifndef        NOSTUB
                    139:     if (aei = str2aei_stub (designator, qualifier))
                    140:        lookup = aei2addr_stub;
                    141:     else
                    142:        SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
                    143:              ("stub DSE lookup of service \"%s\" \"%s\" \"%s\" failed",
                    144:               designator, context, qualifier));
                    145: #endif
                    146: 
                    147: #ifndef        NOSTUB
                    148: out: ;
                    149: #endif
                    150:     SLOG (addr_log, LLOG_TRACE, NULLCP,
                    151:          ("str2aei returns %s", aei ? sprintaei (aei) : "NULLAEI"));
                    152: 
                    153:     return aei;
                    154: }
                    155: 
                    156: /*  */
                    157: 
                    158: struct PSAPaddr *aei2addr (aei)
                    159: AEI    aei;
                    160: {
                    161:     struct PSAPaddr *pa;
                    162: 
                    163:     isodetailor (NULLCP, 0);
                    164:     SLOG (addr_log, LLOG_TRACE, NULLCP, ("aei2addr %s", sprintaei (aei)));
                    165: 
                    166:     PY_pepy[0] = NULL;
                    167: 
                    168:     if (lookup) {
                    169:        pa = (*lookup) (aei);
                    170: #ifndef        NOSTUB
                    171:        if (pa == NULLPA
                    172:                && lookup == aei2addr_dse
                    173:                && (aei = str2aei_stub (fallback1, fallback2, fallback3, 0))
                    174:                && (pa = aei2addr_stub (aei))) {
                    175:            SLOG (addr_log, LLOG_NOTICE, NULLCP, 
                    176:                   ("fallback use of stub DSE succeeded"));
                    177:        }
                    178: #endif
                    179: 
                    180:        lookup = NULL;
                    181:     }
                    182:     else
                    183:        pa = NULLPA;
                    184: 
                    185:     SLOG (addr_log, LLOG_TRACE, NULLCP,
                    186:          ("aei2addr returns %s", paddr2str (pa, NULLNA)));
                    187: 
                    188:     return pa;
                    189: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.