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

⟦c4e78848d⟧ TextFile

    Length: 5518 (0x158e)
    Types: TextFile
    Names: »ns_ac_in_req.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_req.c« 

TextFile

/* ns_ac_in_req.c - Perform DSP BIND */

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

/* 
 * $Header: /f/osi/dsap/net/RCS/ns_ac_in_req.c,v 6.0 89/03/18 23:28:42 mrose Rel $
 *
 *
 * $Log:	ns_ac_in_req.c,v $
 * Revision 6.0  89/03/18  23:28:42  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"

Conn    conn_alloc();
void    conn_free();

extern	LLog	* log_dsap;
extern  PS      opt;
extern	OID	x500_ds_ac;
extern	OID	x500_ds_as;
extern	struct PSAPctxlist	* x500_ds_pcdl;

net_send_init_request(conn)
register        struct connection       * conn;
{
    struct ds_bind_arg		*bind_arg;
    PE                          data;
    struct AcSAPconnect         acc_s;
    struct AcSAPconnect         *acc = &acc_s;
    struct AcSAPindication      aci_s;
    struct AcSAPindication      *aci = &aci_s;
    struct AcSAPabort           *aca = &aci->aci_abort;
/*
* Perhaps more parameters are needed to RyAsynBind ??
* But for now this information has no use.
*
    DSAinfo                     this = &(id_st.info);
*
*/
    struct PSAPctxlist		* pc;
    int				  inv_ret;


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

    if(!conn->cn_dsa)
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("Connecting to a DUA!"));

    /*
    * Build the BIND C-structure into a PE to send.
    */
    bind_arg = &(conn->cn_init_act.ia_req);
    if(encode_DAS_DirectoryBindArgument(&data, 0, 0, NULLCP, bind_arg) == OK)
    {
	DLOG(log_dsap, LLOG_TRACE, ("Calling another DSA!"));
        LLOG(log_dsap, LLOG_NOTICE, ("net_send_init_request: Calling: %s", paddr2str(&(conn->cn_addr),NULLNA)));

	/*
	*  Set up the context list each time there is a call.
	*/
	pc = (struct PSAPctxlist *) malloc(sizeof(struct PSAPctxlist));
	(*pc) = (*(x500_ds_pcdl));	/* structure assignment */

	data -> pe_context = conn->cn_context_id = 3;

	inv_ret = RyAsynBind(x500_ds_ac, &(conn->cn_addr), pc, x500_ds_as,
			data, 2, acc, aci);

	switch(inv_ret)
	{
	case NOTOK:
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("A-ASSOCIATE.REQUEST ASYNC NOTOK!"));
	    ACAFREE(aca);
	    conn->cn_state = CN_STATE_FAIL;
	    conn->cn_ad = 0;
	break;
	case DONE:
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("A-ASSOCIATE.REQUEST ASYNC DONE! (ad = %d)", acc->acc_sd));
	    conn->cn_ad = acc->acc_sd;
	    conn->cn_state = ((SetROPS(conn->cn_ad) == OK)
		  ? CN_STATE_OPEN : CN_STATE_FAIL);
	    net_this_ac_aux(conn, acc);
	break;
	case OK:
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("A-ASSOCIATE.REQUEST ASYNC OK! (ad = %d)", acc->acc_sd));
    	    conn->cn_init_act.ia_class = ACTIVITY_NET_WAIT;
	    conn->cn_ad = acc->acc_sd;
	    conn->cn_state = ((SetROPS(conn->cn_ad) == OK)
	      ? CN_STATE_INIT : CN_STATE_FAIL);
	break;
	default:
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("Unknown return from AcAsyn : %d", inv_ret));
	break;
	} /* switch inv_ret */

	ACCFREE(acc);
	pe_free(data);
    }
    else
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("Unable to encode DirectoryBindArgument"));
	conn->cn_state = CN_STATE_FAIL;
	conn->cn_ad = 0;
    }
}

net_this_ac_aux(conn, acc)
register        struct connection       * conn;
register        struct AcSAPconnect     * acc;
{
    struct ds_bind_arg  * bind_res;
    struct ds_bind_error        * bind_err;

    conn->cn_init_act.ia_type = ACT_TYPE_RESP;

    ParseRyBindResponse(acc);

    switch(acc->acc_result)
    {
	case ACS_ACCEPT:
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("A-ASSOCIATE.RETRY ASYNC ACCEPT"));
	    conn->cn_init_act.ia_resp.init_resp_type = RESP_TYPE_RET;
	    conn->cn_init_act.ia_resp.init_ret_type = RET_TYPE_RES;
	    bind_res = &(conn->cn_init_act.ia_resp.init_resp_res);
	    if(decode_DAS_DirectoryBindResult(acc->acc_info[0], 1, NULLIP, NULLVP, bind_res) == OK)
	    {
		conn->cn_state = ((SetROPS(conn->cn_ad) == OK)
			      ? CN_STATE_OPEN : CN_STATE_FAIL);
	    }
	    else
	    {
		LLOG (log_dsap,LLOG_EXCEPTIONS,( "Unable to parse DirectoryBindResult"));
		conn->cn_state = CN_STATE_FAIL;
	    }
	break;

	case ACS_PERMANENT:
	    /*
	    * Get the DirectoryBindError
	    */
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("A-ASSOCIATE.RETRY ASYNC PERMANENT"));
	    conn->cn_state = CN_STATE_FAIL;
	    conn->cn_ad = 0;
	    conn->cn_init_act.ia_resp.init_resp_type = RESP_TYPE_RET;
	    conn->cn_init_act.ia_resp.init_ret_type = RET_TYPE_ERR;
	    bind_err = &(conn->cn_init_act.ia_resp.init_resp_err);
	    if(acc->acc_info != 0)
	    {
		if(decode_DAS_DirectoryBindError(acc->acc_info[0], 1, NULLIP, NULLVP, bind_err) != OK)
		{
		    LLOG(log_dsap, LLOG_EXCEPTIONS, ("Unable to decode DirectoryBindError"));
		    conn->cn_init_act.ia_resp.init_resp_type = RESP_TYPE_REJ;
		}
	    }
	    else
	    {
		conn->cn_init_act.ia_resp.init_resp_type = RESP_TYPE_REJ;
	    }

	default:
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("A-ASSOCIATE.RETRY ASYNC OTHER"));
	    conn->cn_state = CN_STATE_FAIL;
	    conn->cn_ad = 0;
	    conn->cn_init_act.ia_resp.init_resp_type = RESP_TYPE_REJ;
	    conn->cn_init_act.ia_status = acc->acc_result;
	    LLOG (log_dsap,LLOG_EXCEPTIONS,( "Association rejected: [%s]",
	      AcErrString(acc->acc_result)));
	break;

    } /* switch acc->acc_result */
}