|
|
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 d
Length: 6046 (0x179e)
Types: TextFile
Names: »ds_bind.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
└─⟦eba4602b1⟧ »./isode-5.0.tar.Z«
└─⟦d3ac74d73⟧
└─⟦this⟧ »isode-5.0/dsap/net/ds_bind.c«
/* ds_bind.c - Establish directory association */
#ifndef lint
static char *rcsid = "$Header: /f/osi/dsap/net/RCS/ds_bind.c,v 6.0 89/03/18 23:28:16 mrose Rel $";
#endif
/*
* $Header: /f/osi/dsap/net/RCS/ds_bind.c,v 6.0 89/03/18 23:28:16 mrose Rel $
*
*
* $Log: ds_bind.c,v $
* Revision 6.0 89/03/18 23:28:16 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 "rosap.h"
#include "quipu/util.h"
#include "quipu/connection.h"
#include "quipu/oid.h"
extern LLog * log_dsap;
extern int dsap_ad; /* Association descriptor */
extern int dsap_id; /* Last id sent */
extern char * dsa_address; /* address of default dsa */
void acs_log ();
void ros_log ();
ds_bind (arg, error, result)
struct ds_bind_arg *arg;
struct ds_bind_arg *result;
struct ds_bind_error *error;
{
struct PSAPaddr *addr;
if ((addr = str2paddr (dsa_address)) == NULLPA)
{
LLOG(log_dsap, LLOG_EXCEPTIONS, ("invalid name %s",dsa_address));
return (DS_ERROR_LOCAL);
}
return(dap_bind(&(dsap_ad), arg, error, result, addr));
}
dap_bind (ad, arg, error, result, addr)
int * ad;
struct ds_bind_arg *arg;
struct ds_bind_arg *result;
struct ds_bind_error *error;
struct PSAPaddr *addr;
{
PE dba_pe;
PE *dba_pep = &(dba_pe);
struct AcSAPconnect acc_s;
struct AcSAPconnect *acc = &acc_s;
struct AcSAPindication aci_s;
struct AcSAPindication *aci = &aci_s;
struct AcSAPabort *aca = &(aci->aci_abort);
struct PSAPctxlist pcs;
struct PSAPctxlist *pc = &pcs;
struct RoSAPindication roi_s;
struct RoSAPindication *roi = &roi_s;
struct RoSAPpreject *rop = &(roi->roi_preject);
OID a_ctx;
OID p_ctx;
OID acse_pci;
LLOG(log_dsap, LLOG_DEBUG, ("dap_bind: Address: %s", paddr2str(addr,NULLNA)));
if((acse_pci = oid_cpy(ode2oid("acse pci version 1"))) == NULLOID)
{
LLOG(log_dsap, LLOG_EXCEPTIONS, ("acse pci version 1 OID not found"));
return NOTOK;
}
a_ctx = DIR_ACCESS_AC;
p_ctx = DIR_ACCESS_AS;
pc->pc_nctx = 2;
pc->pc_ctx[0].pc_id = 1;
pc->pc_ctx[0].pc_asn = oid_cpy(p_ctx);
pc->pc_ctx[0].pc_atn = NULLOID;
pc->pc_ctx[1].pc_id = 3;
pc->pc_ctx[1].pc_asn = acse_pci;
pc->pc_ctx[1].pc_atn = NULLOID;
if(encode_DAS_DirectoryBindArgument(dba_pep, 0, 0, NULLCP, arg) != OK)
{
LLOG(log_dsap, LLOG_EXCEPTIONS, ("Couldn't encode DBA"));
oid_free (a_ctx);
oid_free (p_ctx);
oid_free (pc->pc_ctx[0].pc_asn);
oid_free (pc->pc_ctx[1].pc_asn);
return(DS_ERROR_LOCAL);
}
(*dba_pep) -> pe_context = 3;
#ifdef PDU_DUMP
pdu_dump (*dba_pep,"arg",100);
#endif
#ifdef DEBUG
if (*dba_pep != NULLPE)
PLOG (log_dsap, print_DAS_DirectoryBindArgument, *dba_pep, "Bind Argument", 0);
#endif
LLOG (log_dsap, LLOG_NOTICE, ("RY-BIND.REQUEST: <%s, %s, %d, %s>", oid2ode(a_ctx),
paddr2str(addr, NULLNA), pc->pc_nctx, oid2ode(p_ctx)));
if (RyBind(a_ctx, addr, pc, p_ctx, *dba_pep, 2, acc, aci) != OK) {
acs_log(aca, "A-ASSOCIATE.REQUEST");
return (DS_ERROR_CONNECT);
}
LLOG (log_dsap, LLOG_NOTICE, ("A-ASSOCIATE.CONFIRMATION: <%d, %s%s%s>",
acc->acc_sd,
AcErrString (acc -> acc_result),
((acc->acc_result == ACS_ACCEPT) ? "" : ", "),
((acc->acc_result == ACS_ACCEPT) ? "" : AcErrString (acc -> acc_diagnostic))));
pe_free (*dba_pep);
if (acc -> acc_result != ACS_ACCEPT) {
if(acc->acc_ninfo != 0) {
PLOG (log_dsap, print_DAS_DirectoryBindError, acc->acc_info[0], "Bind Error",1);
if (decode_DAS_DirectoryBindError(acc->acc_info[0],
1, NULLIP, NULLVP, error) == OK) {
#ifdef PDU_DUMP
pdu_dump (acc->acc_info[0],"err",100);
#endif
return(DS_ERROR_REMOTE);
} else {
LLOG (log_dsap, LLOG_EXCEPTIONS, ("Malformed DirectoryBindError"));
}
}
return(DS_ERROR_CONNECT);
}
if (acc -> acc_ninfo != 0) {
PLOG (log_dsap, print_DAS_DirectoryBindResult, acc->acc_info[0], "Bind Result",1);
if(decode_DAS_DirectoryBindResult(acc->acc_info[0],
1, NULLIP, NULLVP, result) != OK) {
LLOG (log_dsap, LLOG_EXCEPTIONS, ("Malformed DirectoryBindResult"));
return(DS_ERROR_CONNECT);
}
#ifdef PDU_DUMP
else
pdu_dump (acc->acc_info[0],"res",100);
#endif
}
(*ad) = acc->acc_sd;
ACCFREE(acc);
if(RoSetService((*ad), RoPService, roi) == NOTOK)
{
ros_log(rop, "RoSetService");
return(DS_ERROR_LOCAL);
}
return(DS_OK);
}
/*
Seems that this should be a #define
*/
ds_unbind ()
{
return(dap_unbind(dsap_ad));
}
dap_unbind (ad)
int ad;
{
struct AcSAPrelease acr_s;
struct AcSAPrelease *acr = &acr_s;
struct AcSAPindication aci_s;
struct AcSAPindication *aci = &aci_s;
struct AcSAPabort *aca = &(aci->aci_abort);
LLOG(log_dsap, LLOG_NOTICE, ("RY-UNBIND: <%d, normal, nullpe>",
ad));
if (RyUnBind (ad, ACF_NORMAL, NULLPE, acr, aci) != OK) {
acs_log(aca, "A-RELEASE.REQUEST");
return(DS_ERROR_LOCAL);
}
if (!acr->acr_affirmative) {
LLOG(log_dsap, LLOG_EXCEPTIONS, ("RY-UNBIND failed: %s",
AcErrString(acr->acr_reason)));
LLOG(log_dsap, LLOG_NOTICE, ("A-ABORT.REQUEST: <%d, nullpe>", ad));
if (AcUAbortRequest(ad, NULLPEP, 0, aci) != OK)
LLOG(log_dsap, LLOG_EXCEPTIONS, ("A-ABORT.REQUEST failed: <%d, %s>",
aca->aca_source, AcErrString(aca->aca_reason)));
ACRFREE(acr);
return(DS_ERROR_PROVIDER);
}
ACRFREE(acr);
return(DS_OK);
}