Annotation of 43BSDReno/contrib/isode-beta/quipu/net_init.c, revision 1.1.1.1

1.1       root        1: /* net_init.c - Init network section of DSA process */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/quipu/RCS/net_init.c,v 7.2 90/07/09 14:46:19 mrose Exp $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/quipu/RCS/net_init.c,v 7.2 90/07/09 14:46:19 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       net_init.c,v $
                     12:  * Revision 7.2  90/07/09  14:46:19  mrose
                     13:  * sync
                     14:  * 
                     15:  * Revision 7.1  89/12/19  16:20:38  mrose
                     16:  * sync
                     17:  * 
                     18:  * Revision 7.0  89/11/23  22:17:46  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 "rosap.h"
                     37: #include "tsap.h"
                     38: #include "quipu/util.h"
                     39: #include "quipu/connection.h"
                     40: #include "quipu/oid.h"
                     41: 
                     42: extern LLog    * log_dsap;
                     43: extern char    * mydsaname;
                     44: 
                     45: extern OID     acse_pci;
                     46: extern OID     x500_da_ac;
                     47: extern OID     x500_ds_ac;
                     48: extern OID     quipu_ds_ac;
                     49: extern OID     x500_da_as;
                     50: extern OID     x500_ds_as;
                     51: extern OID     quipu_ds_as;
                     52: extern struct PSAPctxlist      * x500_da_pcdl;
                     53: extern struct PSAPctxlist      * x500_ds_pcdl;
                     54: extern struct PSAPctxlist      * quipu_ds_pcdl;
                     55: 
                     56: extern DN                        mydsadn;
                     57: extern  struct PSAPaddr                * mydsaaddr;
                     58: 
                     59: extern struct PSAPaddr         * psap_cpy();
                     60: 
                     61: static int  TMagic (vecp, vec, td)
                     62: int     *vecp;
                     63: char   **vec;
                     64: struct TSAPdisconnect *td;
                     65: {
                     66:     int            sd;
                     67:     struct TSAPstart tss;
                     68:     register struct TSAPstart  *ts = &tss;
                     69: 
                     70:     if (TInit (*vecp, vec, ts, td) == NOTOK)
                     71:        return NOTOK;
                     72:     sd = ts -> ts_sd;
                     73: 
                     74:     if (TConnResponse (sd, &ts -> ts_called, ts -> ts_expedited, NULLCP, 0,
                     75:            NULLQOS, td) == NOTOK)
                     76:        return NOTOK;
                     77: 
                     78:     if (TSaveState (sd, vec + 1, td) == NOTOK)
                     79:        return NOTOK;
                     80:     vec[*vecp = 2] = NULL;
                     81: 
                     82:     return OK;
                     83: }
                     84: 
                     85: net_init()
                     86: {
                     87:     int            ntries,
                     88:            ontty;
                     89:     struct TSAPdisconnect        td_s;
                     90:     struct TSAPdisconnect      * td = &(td_s);
                     91:     Entry                        my_entry;
                     92: 
                     93:     DLOG(log_dsap, LLOG_TRACE, ("Net Starting"));
                     94:     isodetailor("server", 0);
                     95: 
                     96:     /*
                     97:     *  ds_init should have been called already to cover the possibility of
                     98:     *  the entry for this dsa being held remotely.
                     99:     */
                    100:     if((my_entry = local_find_entry(mydsadn, TRUE)) == NULLENTRY)
                    101:     {
                    102:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("net_init - can't find own entry"));
                    103:        return(NOTOK);
                    104:     }
                    105: 
                    106:     /*
                    107:     *  Duplication of effort with the address for this dsa is going on
                    108:     */
                    109:     mydsaaddr = psap_cpy(my_entry->e_dsainfo->dsa_addr);
                    110: 
                    111:     if((acse_pci = oid_cpy(DIR_ACSE)) == NULLOID)
                    112:     {
                    113:        LLOG(log_dsap, LLOG_EXCEPTIONS, ("acse pci version 1 OID not found"));
                    114:        return NOTOK;
                    115:     }
                    116: 
                    117:     x500_da_ac = oid_cpy (DIR_ACCESS_AC);
                    118:     x500_ds_ac = oid_cpy (DIR_SYSTEM_AC);
                    119:     quipu_ds_ac = oid_cpy (DIR_QUIPU_AC);
                    120:     x500_da_as = oid_cpy (DIR_ACCESS_AS);
                    121:     x500_ds_as = oid_cpy (DIR_SYSTEM_AS);
                    122:     quipu_ds_as = oid_cpy (DIR_QUIPU_AS);
                    123: 
                    124:     x500_da_pcdl->pc_nctx = 2;
                    125:     x500_da_pcdl->pc_ctx[0].pc_id = DIR_ACCESS_PC_ID;
                    126:     x500_da_pcdl->pc_ctx[0].pc_asn = oid_cpy(x500_da_as);
                    127:     x500_da_pcdl->pc_ctx[0].pc_atn = NULLOID;
                    128:     x500_da_pcdl->pc_ctx[1].pc_id = DIR_ACSE_PC_ID;
                    129:     x500_da_pcdl->pc_ctx[1].pc_asn = oid_cpy(acse_pci);
                    130:     x500_da_pcdl->pc_ctx[1].pc_atn = NULLOID;
                    131: 
                    132:     x500_ds_pcdl->pc_nctx = 2;
                    133:     x500_ds_pcdl->pc_ctx[0].pc_id = DIR_SYSTEM_PC_ID;
                    134:     x500_ds_pcdl->pc_ctx[0].pc_asn = oid_cpy(x500_ds_as);
                    135:     x500_ds_pcdl->pc_ctx[0].pc_atn = NULLOID;
                    136:     x500_ds_pcdl->pc_ctx[1].pc_id = DIR_ACSE_PC_ID;
                    137:     x500_ds_pcdl->pc_ctx[1].pc_asn = oid_cpy(acse_pci);
                    138:     x500_ds_pcdl->pc_ctx[1].pc_atn = NULLOID;
                    139: 
                    140:     quipu_ds_pcdl->pc_nctx = 2;
                    141:     quipu_ds_pcdl->pc_ctx[0].pc_id = DIR_QUIPU_PC_ID;
                    142:     quipu_ds_pcdl->pc_ctx[0].pc_asn = oid_cpy(quipu_ds_as);
                    143:     quipu_ds_pcdl->pc_ctx[0].pc_atn = NULLOID;
                    144:     quipu_ds_pcdl->pc_ctx[1].pc_id = DIR_ACSE_PC_ID;
                    145:     quipu_ds_pcdl->pc_ctx[1].pc_asn = oid_cpy(acse_pci);
                    146:     quipu_ds_pcdl->pc_ctx[1].pc_atn = NULLOID;
                    147: 
                    148:     ntries = 6, ontty = isatty (2);
                    149:     while  (TNetListenAux (&mydsaaddr -> pa_addr.sa_addr, TMagic, td)
                    150:                == NOTOK) {
                    151:        LLOG (log_dsap, LLOG_EXCEPTIONS,
                    152:              ("TNetListen failed on address %s",
                    153:               paddr2str (mydsaaddr, NULLNA)));
                    154:        if (td -> td_cc > 0) {
                    155:            if (ontty)
                    156:                (void) fprintf (stderr,
                    157:                                "TNetListen: [%s] %*.*s\nAddress: %s\n",
                    158:                                TErrString (td -> td_reason), td -> td_cc,
                    159:                                td -> td_cc, td -> td_data,
                    160:                                paddr2str (mydsaaddr, NULLNA));
                    161:            LLOG (log_dsap, LLOG_FATAL,
                    162:                  ("TNetListen: [%s] %*.*s", TErrString (td -> td_reason),
                    163:                   td -> td_cc, td -> td_cc, td -> td_data));
                    164:        }
                    165:        else {
                    166:            if (ontty)
                    167:                (void) fprintf (stderr, "TNetListen: [%s]\nAddress: %s\n",
                    168:                                TErrString (td -> td_reason),
                    169:                                paddr2str (mydsaaddr, NULLNA));
                    170:            LLOG (log_dsap, LLOG_FATAL,
                    171:                  ("TNetListen: [%s]", TErrString (td -> td_reason)));
                    172:        }
                    173: 
                    174:        if (ontty || td -> td_reason != DR_CONGEST || --ntries < 1)
                    175:            return NOTOK;
                    176: 
                    177:        LLOG (log_dsap, LLOG_FATAL,
                    178:              ("sleeping for 5 minutes, will continue retrying %d more time%s",
                    179:               ntries, ntries != 1 ? "s" : ""));
                    180:        sleep ((unsigned) 300);
                    181:     }
                    182: 
                    183:     return OK;
                    184: }

unix.superglobalmegacorp.com

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