[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference azur::mcc

Title:DECmcc user notes file. Does not replace IPMT.
Notice:Use IPMT for problems. Newsletter location in note 6187
Moderator:TAEC::BEROUD
Created:Mon Aug 21 1989
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:6497
Total number of notes:27359

1173.0. "Example using callable MCC to read Phase V attribute" by MARVIN::COBB (Graham R. Cobb (Wide Area Comms.), REO2-G/H9, 830-3917) Thu Jun 20 1991 16:45

The first  reply  to  this  note  is  the  C source for a program which uses
callable  MCC  to  get  the  "Changes of Address" attribute for a particular
Phase  V  node.  If you use it as it stands you will be accessing one of our
Phase V microservers (an area router in area 1).

Acknowledgements and  thanks  are  due  to  Pierre  Lavillat  who's Phase IV
example (in note 1015.8) provided the basis for this.  I have extended it to
specify  the  Phase  V  class  and  supply  a DNS fullname and to pick out a
particular attribute value from the response.

A few questions for the developers:

i) Will  the  callable MCC interface be present (unchanged?) on ULTRIX? I.e.
can the program in .1 easily be made portable?

ii) Is  callable  MCC  supported?  I.e.  when the Phase V AM ships, will the
program in .1 be supported, as far as MCC is concerned?

iii) If the answer to ii) is Yes, do you have any plans to do anything about
the  fact  that accessing Phase V nodes requires using DNS but the DNS group
are not supporting their portable programming interface? In particular, they
no  longer  ship  the header files that the program in .1 uses! For example,
you  could  consider providing an MCC call which converted a DNS fullname in
external  form  into  internal  form  (and  vice-versa).   That  would allow
programs like this to be fully supported.

Graham
T.RTitleUserPersonal
Name
DateLines
1173.1The code...MARVIN::COBBGraham R. Cobb (Wide Area Comms.), REO2-G/H9, 830-3917Thu Jun 20 1991 16:46304
#module GET_COUNTER "V02.0.0"

/*
 * Example of use of callable MCC.
 *
 * Derived from an example by Pierre Lavillat posted as note 1015.8 (et seq)
 * in the TOOK::MCC conference.
 *
 * Modifed by Graham Cobb to show information about Phase V nodes
 *
 */

	/* C library include files */
#include <stdio>
#include <ssdef>
#include <stsdef>
#include <mcc_descrip>

	/* MCC include files */
#include <mcc_interface_def.h>
#include <mcc_vea_def.h>
#include <mcc_msg.h>
#include <mcc_common_definitions>
#include <mcc_dna5am_node>

    /* DNS include files */
#include "dnsclerk.h"
#include "dnsmessage.h"

void dump_mcc_call_result ( MCC_A_AES p_in_entity, unsigned long int stat,
    MCC_A_AES p_out_entity, MCC_T_Descriptor *p_time_stamp,
    MCC_T_Descriptor *p_dsc_out_p);
unsigned long int prepare_mcc_call (
	MCC_A_AES               *pp_in_entity,                  
        MCC_A_TIMEFRAME         *pp_time_spec,
        MCC_T_Descriptor        **pp_dsc_in_q,                                  
        MCC_T_Descriptor        **pp_dsc_in_p,                                  
        MCC_A_HANDLE            *pp_handle,                                  
        MCC_A_AES               *pp_out_entity,
        MCC_T_Descriptor        **pp_time_stamp,                                
        MCC_T_Descriptor        **pp_dsc_out_p,                                 
        MCC_T_Descriptor        **pp_dsc_out_q,
	char			*dsc_out_p_buff,
	int			dsc_out_p_buff_len );
unsigned long int get_attribute_value (
        MCC_T_Descriptor        *p_dsc_out_p,
	unsigned long int	attr_code,
	unsigned long int	data_type,
	char			*p_attr_value,
	unsigned long int	data_size );

main()
{

unsigned long int stat = MCC_S_NORMAL;

MCC_A_AES               p_in_entity = MCC_K_NULL_PTR;
MCC_A_TIMEFRAME         p_time_spec;
MCC_T_Descriptor        *p_dsc_in_q;
MCC_T_Descriptor        *p_dsc_in_p;
MCC_A_HANDLE            p_handle;   
MCC_A_AES               p_out_entity = MCC_K_NULL_PTR;
MCC_T_Descriptor        *p_time_stamp;                                
MCC_T_Descriptor        dsc_out_p;                                 
MCC_T_Descriptor        *p_dsc_out_p = &dsc_out_p;
MCC_T_Descriptor        *p_dsc_out_q;
MCC_T_Descriptor        instance_descriptor;
char			buff[1024];
int			buff_len = 1024;
unsigned long int	verb = MCC_K_VERB_SHOW,
			partition = MCC_K_ATTR_PRT_COUNTERS,
			handle_state = MCC_K_HANDLE_FIRST;
char			*node_name = "dec:.reo.msrv26";
char			name_buf[400];
int			name_buf_len = 400;
unsigned char		*End;
unsigned long int	changes_of_addr = 0;
char			counter_buff[8];


    /* Convert nodename to internal form */
    if ($VMS_STATUS_SUCCESS (stat))  
	stat = dnsCvtStrFullToOpq ( node_name, 0, name_buf, &name_buf_len, &End);

    /* Create input entity name */
    instance_descriptor.mcc_b_dtype = DSC_K_DTYPE_Z;
    instance_descriptor.mcc_b_class = DSC_K_CLASS_S;
    instance_descriptor.mcc_a_pointer = name_buf;
    instance_descriptor.mcc_w_maxstrlen = name_buf_len;
    instance_descriptor.mcc_w_curlen = name_buf_len;
    instance_descriptor.mcc_l_id = 1;
    instance_descriptor.mcc_l_dt = MCC_K_DT_FULL_NAME;
    instance_descriptor.mcc_b_flags = 0;
    instance_descriptor.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
    instance_descriptor.mcc_a_link = MCC_K_NULL_PTR;

    if ($VMS_STATUS_SUCCESS (stat))  
      stat = mcc_aes_create (
		&p_in_entity,
		 &MCC_K_CLASS_DNA5_NODE,  /* Node */
		 &instance_descriptor,
		&MCC_K_AES_NOT_WILD);

    /* Set up all the other arcane stuff MCC needs before you can call it */
    if ($VMS_STATUS_SUCCESS (stat))
      stat = prepare_mcc_call (
		    &p_in_entity,
		    &p_time_spec,
		    &p_dsc_in_q,
		    &p_dsc_in_p,
		    &p_handle,
		    &p_out_entity,
		    &p_time_stamp,
		    &p_dsc_out_p,
		    &p_dsc_out_q,
		    buff,
		    buff_len );

    /* Call the MCC function we want */
    if ($VMS_STATUS_SUCCESS (stat))
	stat = mcc_call_function (
		&verb,
		p_in_entity,
		&partition,
		p_time_spec,
		p_dsc_in_q,
		p_dsc_in_p,
		p_handle,
		p_out_entity,
		p_time_stamp,
		p_dsc_out_p,
		p_dsc_out_q );

    /* dump out results */
#ifdef DUMP_RESULT
    dump_mcc_call_result( p_in_entity, stat, p_out_entity, p_time_stamp, p_dsc_out_p);
#endif

    /* Find the Changes of Address attribute */
    if ($VMS_STATUS_SUCCESS (stat))
	stat = get_attribute_value(
		    p_dsc_out_p, 
		    MCC_K_DN5_NCT_ADDR_CHNGS,
		    MCC_K_DT_COUNTER64,
		    counter_buff,
		    sizeof(counter_buff)
		    );

    memcpy(&changes_of_addr, counter_buff, sizeof(changes_of_addr));

    if ($VMS_STATUS_SUCCESS (stat))
	printf("Changes of Address = %d\n", changes_of_addr);

    return(stat);
}

static unsigned long int prepare_mcc_call (

 /* Arguments */
	MCC_A_AES               *pp_in_entity,                  
        MCC_A_TIMEFRAME         *pp_time_spec,
        MCC_T_Descriptor        **pp_dsc_in_q,                                  
        MCC_T_Descriptor        **pp_dsc_in_p,                                  
        MCC_A_HANDLE            *pp_handle,                                  
        MCC_A_AES               *pp_out_entity,
        MCC_T_Descriptor        **pp_time_stamp,                                
        MCC_T_Descriptor        **pp_dsc_out_p,                                 
        MCC_T_Descriptor        **pp_dsc_out_q,
	char			*dsc_out_p_buff,
	int			dsc_out_p_buff_len )  

{	/* Begin function PREPARE_MCC_CALL */

	/* Local variables */
	unsigned long int stat = MCC_S_NORMAL,	/* general returns sts */
			  cvr;
	
      *pp_out_entity = MCC_K_NULL_PTR;
      *pp_time_stamp = MCC_K_NULL_PTR;
      *pp_handle = MCC_K_NULL_PTR;
      *pp_dsc_in_q = *pp_dsc_in_p = MCC_K_NULL_PTR;

      if ($VMS_STATUS_SUCCESS (stat))  
        stat = mcc_aes_create (
		 pp_out_entity,
		 MCC_K_NULL_PTR,
		 MCC_K_NULL_PTR,
		&MCC_K_AES_CLASS_WILD);

      if ($VMS_STATUS_SUCCESS (stat))
	stat = mcc_ats_create_frame ( pp_time_spec );

      if ($VMS_STATUS_SUCCESS (stat))
	stat = mcc_ahs_create ( pp_handle );

      if ($VMS_STATUS_SUCCESS (stat))
	stat = mcc_time_create ( pp_time_stamp , 
				 &MCC_K_DT_BIN_ABS_TIM,
				 MCC_K_NULL_PTR,
				 MCC_K_NULL_PTR );

      if ($VMS_STATUS_SUCCESS (stat))
      {
	    (*pp_dsc_out_p)->mcc_b_dtype = DSC_K_DTYPE_Z;
	    (*pp_dsc_out_p)->mcc_b_class = DSC_K_CLASS_S;
	    (*pp_dsc_out_p)->mcc_a_pointer = dsc_out_p_buff;
	    (*pp_dsc_out_p)->mcc_w_maxstrlen = dsc_out_p_buff_len;
	    (*pp_dsc_out_p)->mcc_w_curlen = dsc_out_p_buff_len;
	    (*pp_dsc_out_p)->mcc_l_id = 0;
	    (*pp_dsc_out_p)->mcc_l_dt = MCC_K_DT_ILV;
	    (*pp_dsc_out_p)->mcc_b_flags = 0;
	    (*pp_dsc_out_p)->mcc_b_ver = MCC_K_VER_DESCRIPTOR;
	    (*pp_dsc_out_p)->mcc_a_link = MCC_K_NULL_PTR;
      }

      return stat;

}; /* End function PREPARE_MCC_CALL */

static unsigned long int get_attribute_value (

 /* Arguments */
        MCC_T_Descriptor        *p_dsc_out_p,
	unsigned long int	attr_code,
	unsigned long int	data_type,
	char			*p_attr_value,
	unsigned long int	data_size )

{	/* Begin function get_attribute_value */

    /* Local variables */
    unsigned long int		stat = MCC_S_NORMAL;
    struct MCC_R_ILV_CONTEXT	ILVctx;
    unsigned long		id_code;
    unsigned long		mode = MCC_K_ILV_LIST_VALUE; /* mode of operation */
    MCC_T_Descriptor		value_desc;
    unsigned long		reason_code;                 /* ilv reason code */

    /* Begin ILV get for getting info from out_p */
    if ($VMS_STATUS_SUCCESS(stat))
	stat = mcc_ilv_get_param_begin(&ILVctx, p_dsc_out_p);

    /* Get the id code of the first value, id code should be attribute list */
    if ($VMS_STATUS_SUCCESS(stat))
	stat = mcc_ilv_get_id(&ILVctx, &id_code);
    /* Id code not checked! */

    /* now look at attribute list of values */    
    if($VMS_STATUS_SUCCESS(stat))
        stat = mcc_ilv_get_cons_begin(&ILVctx, MCC_K_NULL_PTR, &mode);

    /* Find required attribute in list */
    if($VMS_STATUS_SUCCESS(stat))
	stat = mcc_ilv_fnd_id(&ILVctx, &attr_code);

    /* Create descriptor for value */
    value_desc.mcc_b_dtype = DSC_K_DTYPE_Z;
    value_desc.mcc_b_class = DSC_K_CLASS_S;
    value_desc.mcc_a_pointer = p_attr_value;
    value_desc.mcc_w_maxstrlen = data_size;
    value_desc.mcc_w_curlen = data_size;
    value_desc.mcc_l_id = attr_code;
    value_desc.mcc_l_dt = data_type;
    value_desc.mcc_b_flags = 0;
    value_desc.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
    value_desc.mcc_a_link = MCC_K_NULL_PTR;

    if($VMS_STATUS_SUCCESS(stat))
	stat = mcc_ilv_get(&ILVctx, &value_desc, &reason_code);

    return stat;

}; /* End function get_attribute_value */

static void dump_mcc_call_result
    (
    MCC_A_AES		    p_in_entity,
    unsigned long int	    stat,
    MCC_A_AES		    p_out_entity,
    MCC_T_Descriptor	    *p_time_stamp,
    MCC_T_Descriptor	    *p_dsc_out_p
    )
    {

    printf("Calling mcc_call_access\n");
    printf("In Entity : \n");

    mcc_aes_dump( p_in_entity );


    printf ( "Return status : %d \n",stat);
    printf ("Out Entity : \n");

    mcc_aes_dump ( p_out_entity );

    printf("Timestamp :\n ");
    mcc_time_dump ( p_time_stamp );

    printf("Out_p : \n");
    mcc_ilv_dump ( p_dsc_out_p );

    printf("\n");

    }
1173.2We manage distributed objects.TOOK::BURGESSTue Jul 09 1991 14:4947
> i) Will  the  callable MCC interface be present (unchanged?) on ULTRIX? I.e.
> can the program in .1 easily be made portable?

	As you have probably know "callable MCC interface" is just standard 
	VAX/VMS packaging of the DECmcc common routines into a shareable library 
	(sys$library:mcc_kernel_shr.exe) so that the DECmcc common routines 
	specified in the SRM can be easily shared by other executable images.  
	Even when you invoke MANAGE/ENTEPRISE the executable image, mcc_main.exe, 
	forces the image activation of mcc_kernel_shr.exe (ie "callable MCC")


	Ultrix V4.2 does not support shareable libraries (though
	OSF1/bl5 does today).  To build an executable image on Ultrix 4.2
	which uses the DECmcc common routines requires one to link
	the image including object modules from the kernel object
	archive (object library).  For VMS, the lib$initialize mechanism
	was used to transparently initialize the threading environment;
	for Ultrix, a "main module" is provided.

> ii) Is  callable  MCC  supported?  I.e.  when the Phase V AM ships, will the
> program in .1 be supported, as far as MCC is concerned?

	One goal for DECmcc v1.2 is to execute on both VAX/VMS and Ultrix
	platforms.
	
> iii) If the answer to ii) is Yes, do you have any plans to do anything about
> the  fact  that accessing Phase V nodes requires using DNS but the DNS group
> are not supporting their portable programming interface? In particular, they
> no  longer  ship  the header files that the program in .1 uses! For example,
> you  could  consider providing an MCC call which converted a DNS fullname in
> external  form  into  internal  form  (and  vice-versa).   That  would allow
> programs like this to be fully supported.

	Yes, DNS decommitted support for their portable interface
	on VAX/VMS but they still provide a VAX/VMS specific interface
	to DNS services.  We will use different DNS interfaces for the
	different platforms.  

	I'd rather see DIGITAL produce portable name services than
	see network management developers writing endless shell routines
	around lower level DIGITAL service routines.  

	(It is not a goal of DECmcc v1.2 to provide a portable interfaces
	to other DIGITAL's products, write Ultrix phase IV DNS clerks, etc.)


1173.3ShameMARVIN::COBBGraham R. Cobb (Wide Area Comms.), REO2-G/H9, 830-3917Thu Jul 11 1991 16:0716
I understand  the  reasons but I think it is a great shame that MCC will not
be  able  to  provide  a  supported, common programming interface to network
management  (particularly Phase V) for customer applications.  That has long
been a customer demand that MCC is in an excellent position to fill.  By the
way,  as  I  understand  it,  DNS  do not support a programming interface on
ULTRIX *at all*.

Of course, it may well be the case that it is not really worth promoting the
current  callable  MCC  interface because of the difficulty of using it.  In
fact,  I'm  not  sure  I  really  see  the point of *supporting* the current
interface  at  all: it is not portable for Phase V management and it is very
difficult  to  use.  If you are working on easier to use "RTL" routines then
maybe you should just support those (in order to qualify as easy to use they
must allow people to specify fullnames in external format!).

Graham