T.R | Title | User | Personal Name | Date | Lines |
---|
3576.1 | Look again. It's in there.... | TOOK::MCPHERSON | Life is hard. Play short. | Mon Aug 17 1992 11:56 | 27 |
| >
> Using DECmcc API, what is the best way to determine if
> an entity class instance exists ?
>
> I had a look on MCC_DNS... routines, but id did not
> find such a facility.
To determine if the *class* is known to the DECmcc system, see the
mcc_dict(mumble) routines in the SRM (you could use
mcc_dict_get_name_code() to see if the class for the object is even in the
dictionary.)
To see if an *instance* of a class exists, do you want to see:
1) if the entity has been *registered* or
2) if the entity exists and you can 'touch it ?
If (1) then you could need to use the mcc_dns_get_identifiers() routine to
do an instance lookup in your registration repository. See if you get a
legitimate entity spec returned or a MCC_S_NOENTITY. If the latter, then
the object hasn't been registered.
If (2) then you can just try to use the appropriate AM to issue a command
(e.g. a 'ping' or a 'show all char' to the entity *without* looking up any
other information (assuming that your program uses an entity specifier
that the AM can understand).
/doug
|
3576.2 | Re-.1 | NSDC::CAILLE | | Tue Aug 18 1992 03:52 | 11 |
| > To see if an *instance* of a class exists, do you want to see:
> 1) if the entity has been *registered* or
> 2) if the entity exists and you can 'touch it ?
Actualy, I would like to know if a DOMAIN class instance has already been
created. The only data I've got is the primary identifier.(no alternate
identifier available for that entity class)
Can I call mcc_get_identifiers() giving a primary identifier ?
Jean-Mary.
|
3576.3 | must build up an AES | TOOK::MCPHERSON | Life is hard. Play short. | Tue Aug 18 1992 14:57 | 51 |
| > Actualy, I would like to know if a DOMAIN class instance has already been
> created. The only data I've got is the primary identifier.(no alternate
> identifier available for that entity class)
>
> Can I call mcc_get_identifiers() giving a primary identifier ?
Assuming that you have the following information:
Class = DOMAIN
Instance = .Foo
Now you want to be able to (programatically within DECmcc) determine if
the object (Domain .Foo) currently exists (In the case of "Domain",
they exist *only* if they have been registered...)
Use the mcc_dns_get_identifiers() routine. You'll need to build up an
AES (absract entity specifier) for the C-I pair you're looking for and
pass it into the routine ( along with the usual housekeeping...).
And I quote from the description of the mcc_dns_get_identifiers()
routine in the SRM:
Description:
Searches the namespace for the entity. Retrieves the instance
hierarchy. If the lowest level entity is wildcarded, this routine
returns all entities (one at a time) whose parent instance hierarchy
and class code match the input entity.
One instance is returned percall. The identifiers for each instance
are returned in an ILV-encoded list. The caller terminates the
request by calling the AHS routine to cancel the handle and calls
back with the cancelled handle.
If this routine cannot return all the requested data (for example,
of multiple instances are found) in a single response, it will
create a context block, keep the relevant information for the next
call in the context block, and returns a condition value indicating
more data and an output handle that points to the context block. The
subsequent calls to this routine must provide an input handle that
points to the correct copntext block, so the routine can pick up
where it left off from the previous call.
If you're serious about doing this, you would be well-abvised to pick
up a copy of the latest SRM and the Developer's Toolkit docs.
|
3576.4 | Re-.3 | NSDC::CAILLE | | Wed Aug 19 1992 06:08 | 37 |
| > Assuming that you have the following information:
> Class = DOMAIN
> Instance = .Foo
>
> Now you want to be able to (programatically within DECmcc) determine if
> the object (Domain .Foo) currently exists (In the case of "Domain",
> they exist *only* if they have been registered...)
>
> Use the mcc_dns_get_identifiers() routine. You'll need to build up an
> AES (absract entity specifier) for the C-I pair you're looking for and
> pass it into the routine ( along with the usual housekeeping...).
I've built up the following AES,
entity [0] wild = NOT_WILD class = 8 id = 1 type = 5
instance = LOCAL_NS:.foo
and passed it to the mcc_dns_get_identifiers() routine.
Although, the domain was created previously (is registered),
MCC> create domain foo
Domain LOCAL_NS:.foo
AT 1992-08-19-10:27:45.461
Create Successful
the status returned by mcc_dns_get_identifier is the following:
> MCC_S_NOENTITY
Is something wrong in the abstract entity specification ?
Jean-Mary.
|
3576.5 | looks close... | TOOK::MCPHERSON | Life is hard. Play short. | Wed Aug 19 1992 10:49 | 12 |
| >I've built up the following AES,
>
> entity [0] wild = NOT_WILD class = 8 id = 1 type = 5
> instance = LOCAL_NS:.foo
>
Is that the output from an mcc_aes_dump() ? Is it a dump of out_e or
in_e?
How did you construct the aes?
/doug
|
3576.6 | Re-0.5 | NSDC::CAILLE | | Wed Aug 19 1992 12:21 | 28 |
| > Is that the output from an mcc_aes_dump() ? Is it a dump of out_e or
> in_e?
>
> How did you construct the aes?
>
> /doug
Yes, it is.
see below, the AES construction...
instance.mcc_w_maxstrlen = sizeof(MCC_T_FullName);
instance.mcc_b_dtype = DSC_K_DTYPE_T;
instance.mcc_b_class = DSC_K_CLASS_S;
instance.mcc_w_curlen = 13;
instance.mcc_b_flags = 0;
instance.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
instance.mcc_l_id = MCC_K_DOMAIN_NAME;
instance.mcc_l_dt = MCC_K_DT_FULL_NAME;
instance.mcc_a_pointer = (unsigned char *) "LOCAL_NS:.foo";
instance.mcc_a_link = MCC_K_NULL_PTR;
class = MCC_K_CLASS_DOMAIN;
status = mcc_aes_create (&aes_entity, &class, &instance, &type);
mcc_aes_dump(aes_entity);
Jean-Mary
|
3576.7 | need to use mcc_dns_opaque_fullname() | TOOK::MCPHERSON | pre-retinal integration | Thu Dec 17 1992 09:39 | 50 |
| Well it's been a while, but here's some follow-up (thanks for the mail
reminder Jean-Mary...)
I have consulted with my local DNS/Registration expert and have now
another piece of the puzzle for you:
> instance.mcc_w_maxstrlen = sizeof(MCC_T_FullName);
> instance.mcc_b_dtype = DSC_K_DTYPE_T;
> instance.mcc_b_class = DSC_K_CLASS_S;
> instance.mcc_w_curlen = 13;
> instance.mcc_b_flags = 0;
> instance.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
> instance.mcc_l_id = MCC_K_DOMAIN_NAME;
> instance.mcc_l_dt = MCC_K_DT_FULL_NAME;
> instance.mcc_a_pointer = (unsigned char *) "LOCAL_NS:.foo";
> instance.mcc_a_link = MCC_K_NULL_PTR;
>
Here's the crux of the problem: You need to pass the identifier as a
true Fullname. You can't just stick it in as a string.
Even though to you and I they *look* just like strings with leading ":"
and "."s in them, that is only the 'external' representation of a
fullname. DNS fullnames are really represented differently
*internally* to DECmcc (the internal format is called the 'opaque'
representation of the fullname).
Having said all that, mcc_w_curlen and mcc_a_pointer are all wrong.
The mcc_w_curlen value of 13 is too small for a fullname. There's
actually a lot of extra information associated with a fullname
(internally) that is 'opaque' to you and I. I.e. there's more to it
than the sum of the characters in the string "LOCAL_NS:.foo" (there's
UID, etc).
Try this approach: take the string "LOCAL_NS:.foo" and then call
mcc_dns_opaque_fullname() to translate it into the appropriate opaque
format that DECmcc uses internally.
Next, use the resulting opaque fullname (from 'opaque_string') and
fullname length (from 'opaque_string_len') resulting from the
mcc_dns_opaque_fullname() call in a subsequent call to
mcc_dns_get_identifiers().
In summary: Your approach is correct, you just need to manufacture a
fullname from the input string and then use the appropriate values for
mcc_w_curlen and mcc_a_pointer in your construction.
/doug
|
3576.8 | is_registered.c | MCDOUG::MCPHERSON | pre-retinal integration | Tue Dec 22 1992 09:49 | 155 |
| Attached is a *sample* piece of code (no warranties; it works for me...) that
uses 'callable mcc' to check if a an instance of class DOMAIN exists. It needs
to be invoked as a foreign command on vms so that you can pass it the command
line argument. If you want to use it as a starting point I advise you to
clean up some of my sloppy code... ;^)
<sample output>
$ isr :==$sys$login:is_registered.exe
$ isr .test
Domain .test is registered
$ isr LOCAL_NS:.test
Domain local_ns:.test is registered
$ isr test
Domain test is registered
$ isr not_there
Domain not_there is NOT registered
********************************************************************************
regards,
/doug
<source code below FF>
#include <mcc_msg.h>
#include <mcc_descrip.h>
#include <mcc_fm_domain_svc_if.h>
#include <mcc_interface_def.h>
#include <mcc_vea_def.h>
/* dummy routine required for callable mcc */
mcc_xmm_log(fake_param)
int fake_param;
{
return (0);
}
main(int argc, char* argv[])
{
MCC_T_CVR status,
dns_status;
MCC_T_Descriptor instance,
response_dsc;
MCC_T_FullName opaque_string;
MCC_T_Unsigned16 in_string_len,
opaque_string_len;
MCC_T_UNSLONG wild_type,
class;
MCC_A_AES entity_aes,
match_entity_aes;
MCC_A_HANDLE handle;
char *in_string,
dns_response_buff[4000];
mcc_fw_init();
in_string = argv[1]; /* input string */
in_string_len = strlen(in_string);
/*
* Convert the input string to a true DNS fullname for the instance
*
*/
status = mcc_dns_opaque_fullname(in_string,
&in_string_len,
opaque_string,
&opaque_string_len,
&dns_status);
/*
* Now create an AES using the C-I pair.
* Class is hardcoded as "DOMAIN" (8)
*
*/
class = MCC_K_CLASS_DOMAIN;
entity_aes = MCC_K_NULL_PTR; /* Null because creating a new one */
wild_type = MCC_K_AES_NOT_WILD;
/* Fill out the input instance descriptor for the AES create*/
instance.mcc_b_class = DSC_K_CLASS_S;
instance.mcc_b_dtype = DSC_K_DTYPE_T;
instance.mcc_b_flags = 0;
instance.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
instance.mcc_l_id = MCC_K_DOMAIN_NAME;
instance.mcc_l_dt = MCC_K_DT_FULL_NAME;
instance.mcc_a_link = MCC_K_NULL_PTR;
instance.mcc_w_maxstrlen = sizeof(opaque_string);
instance.mcc_w_curlen = opaque_string_len;
instance.mcc_a_pointer = opaque_string;
status = mcc_aes_create(&entity_aes, &class, &instance, &wild_type);
#ifdef debug
mcc_aes_dump(entity_aes);
#endif
handle = MCC_K_NULL_PTR;
status = mcc_ahs_create(&handle);
/* Initialize the response buffer for mcc_dns_get_ident */
response_dsc.mcc_b_class = DSC_K_CLASS_S;
response_dsc.mcc_b_dtype = DSC_K_DTYPE_T;
response_dsc.mcc_b_flags = 0;
response_dsc.mcc_b_ver = MCC_K_VER_DESCRIPTOR;
response_dsc.mcc_l_id = MCC_K_NULL_PTR;
response_dsc.mcc_l_dt = MCC_K_DT_ILV;
response_dsc.mcc_a_link = MCC_K_NULL_PTR;
response_dsc.mcc_w_maxstrlen = 4000;
response_dsc.mcc_w_curlen = MCC_K_NULL_PTR;
response_dsc.mcc_a_pointer = (MCC_T_UNSBYTE *) &dns_response_buff[0];
status = mcc_dns_get_identifiers(entity_aes,
handle,
&match_entity_aes,
&response_dsc,
&dns_status);
switch (status) {
case MCC_S_NORMAL:
printf("\nDomain %s is registered\n",in_string);
break;
case MCC_S_NOENTITY:
printf("\nDomain %s is NOT registered\n",in_string);
break;
default:
printf("\nSomething unusual happened.\n");
exit(status);
break;
};
}
|
3576.9 | mcc_xmm_log? | TOOK::GUERTIN | MCC Managing everything for everyone everywhere | Tue Dec 22 1992 11:16 | 4 |
| What is this mcc_xmm_log() fake routine required for callable mcc to
work???
-Matt.
|
3576.10 | Just doing what we tell our customers to do... | TOOK::MCPHERSON | pre-retinal integration | Tue Dec 22 1992 12:47 | 11 |
| >
> What is this mcc_xmm_log() fake routine required for callable mcc to
> work???
>
It's taken verbatim from the example in the "DECmcc Guide to MM Development"
about 'using callable MCC'.
QAR the toolkit.
/doug
|
3576.11 | mcc_xmm_log | TOOK::SWIST | Jim Swist LKG2-2/T2 DTN 226-7102 | Tue Dec 22 1992 14:55 | 5 |
| This is an Ultrix-only weirdness (mcc_xmm_log). It is because the code which
processes the Management Module LOG entry point is part of a common kernel
module which is linked into all MCC process, not just MMs. The dummy
mcc_xmm_log is only to prevent an unresolved linker reference. It never
actually gets called.
|