DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T n

⟦9734af7bf⟧ TextFile

    Length: 4704 (0x1260)
    Types: TextFile
    Names: »ns_ac_in_rsp.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/dsap/net/ns_ac_in_rsp.c« 

TextFile

/* ns_ac_in_resp.c - send A-ASSOCIATE.RESPONSE */

#ifndef lint
static char *rcsid = "$Header: /f/osi/dsap/net/RCS/ns_ac_in_rsp.c,v 6.0 89/03/18 23:28:43 mrose Rel $";
#endif

/*
 * $Header: /f/osi/dsap/net/RCS/ns_ac_in_rsp.c,v 6.0 89/03/18 23:28:43 mrose Rel $
 *
 * $Log:	ns_ac_in_rsp.c,v $
 * Revision 6.0  89/03/18  23:28:43  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 "acsap.h"
#include "rosap.h"
#include "quipu/util.h"
#include "quipu/connection.h"

extern LLog * log_dsap;

Conn    conn_alloc();
void    conn_free();
void    acs_log ();

/*
* Respond to a request for association/bind/connection.
*/
net_send_init_response(conn)
register        struct connection       * conn;
{
    DSAinfo                     this = &(id_st.info);
    struct AcSAPindication      aci_s;
    struct AcSAPindication      *aci = &aci_s;
    struct AcSAPabort           *aca = &aci->aci_abort;
    PE                          data;
    PE                          ro_data;
    PE				*ro_datap = &(ro_data);
    int                         ndata;
    struct init_activity        * ia = &(conn->cn_init_act);
    struct AcSAPstart           * acs = ia->ia_acs;
    struct PSAPstart            * ps = &(acs->acs_start);

    DLOG(log_dsap,LLOG_TRACE, ("net_send_init_response()"));

    *ro_datap = NULLPE;
    if(ia->ia_status == ACS_ACCEPT)
    {
	if(ia->ia_resp.init_ret_type == RET_TYPE_RES)
	{
	    if(encode_DAS_DirectoryBindResult(&data, 1,
		NULLIP, NULLCP, &(ia->ia_resp.init_resp_res)) == OK)
	    {
		DLOG(log_dsap,LLOG_TRACE, ("Encoded DirectoryBindResult"));
		if (build_Remote__Operations__Notation_BindResultValue (ro_datap, 1, NULL, NULLCP, data) == OK)
		{
		    DLOG(log_dsap,LLOG_TRACE, ("Built BindResultValue"));
		    ndata = 1;
		}
		else
		{
		    LLOG (log_dsap, LLOG_EXCEPTIONS, ("build_Remote__Operations__Notation_BindResultValue failed"));
		    ia->ia_status = ACS_TRANSIENT;
		    ia->ia_reason = ACS_USER_NOREASON;
		    ndata = 0;
		}
		pe_free(data);
	    }
	    else
	    {
		LLOG(log_dsap,LLOG_EXCEPTIONS, ("Failed to encode DirectoryBindResult"));
		ia->ia_status = ACS_TRANSIENT;
		ia->ia_reason = ACS_USER_NOREASON;
		ndata = 0;
	    }
	}
	else
	{
	    if(encode_DAS_DirectoryBindError(&data, 1,
		NULLIP, NULLCP, &(ia->ia_resp.init_resp_err)) == OK)
	    {
		DLOG(log_dsap,LLOG_TRACE, ("Encoded DirectoryBindError"));
		if (build_Remote__Operations__Notation_BindErrorValue (ro_datap, 1, NULL, NULLCP, data) == OK)
		{
		    DLOG(log_dsap,LLOG_TRACE, ("Built BindErrorValue"));
		    ia->ia_status = ACS_PERMANENT;
		    ia->ia_reason = ACS_USER_NOREASON;
		    ndata = 1;
		}
		else
		{
		    LLOG (log_dsap, LLOG_EXCEPTIONS, ("build_Remote__Operations__Notation_BindErrorValue failed"));
		    ia->ia_status = ACS_TRANSIENT;
		    ia->ia_reason = ACS_USER_NOREASON;
		    ndata = 0;
		}
		pe_free(data);
	    }
	    else
	    {
		LLOG(log_dsap,LLOG_EXCEPTIONS, ("Failed to encode DirectoryBindError"));
		ia->ia_status = ACS_TRANSIENT;
		ia->ia_reason = ACS_USER_NOREASON;
		ndata = 0;
	    }
	}
    }
    else
    {
	ndata = 0;
    }

    if(ndata != 0)
    {
	/* Should get the context id from ps->ps_ctxlist */
	(*ro_datap) -> pe_context = conn->cn_context_id = 3;
    }

    LLOG(log_dsap,LLOG_NOTICE, ("A-ASSOCIATE.RESPONSE: %s%s%s", 
		AcErrString (ia->ia_status),
	        ((ia->ia_status == ACS_ACCEPT) ? "" : ", "),
	        ((ia->ia_status == ACS_ACCEPT) ? "" : AcErrString (ia -> ia_reason))));

#ifdef DEBUG
    {
	int	  i;

	for(i=0; i<ps->ps_ctxlist.pc_nctx; i++)
	{
	    LLOG(log_dsap, LLOG_DEBUG, ("ctx[%d] id = %d, res = %d.", i,
		ps->ps_ctxlist.pc_ctx[i].pc_id,
		ps->ps_ctxlist.pc_ctx[i].pc_result));
	}
    }
#endif

    if(AcAssocResponse(conn->cn_ad, ia->ia_status, ia->ia_reason,
      acs->acs_context, this->aei, this->addr, &(ps->ps_ctxlist),
      ps->ps_defctxresult, this->p_req, this->s_req, this->isn,
      ps->ps_settings, &(ps->ps_connect), ro_datap, ndata, aci) == OK)
    {
	DLOG(log_dsap,LLOG_TRACE, ("AcAssocResponse OK"));
	if(ia->ia_status == ACS_ACCEPT)
	{
	    conn->cn_state = CN_STATE_OPEN;
	}
	else
	{
	    DLOG(log_dsap,LLOG_TRACE, ("status != ACS_ACCEPT"));
	    conn->cn_state = CN_STATE_FAIL;
	    conn->cn_ad = 0;
	}
    }
    else
    {
	acs_log(aca, "A-ASSOCIATE.RESPONSE");
	ACAFREE(aca);
	conn->cn_state = CN_STATE_FAIL;
    }

    if (ro_data != NULLPE)
	pe_free (ro_data);

    ACSFREE(acs);
    free ((char*)acs);
}