Compaq ACMS for OpenVMS
Remote Systems Management Guide


Previous Contents Index

7.7 ACMS$MGMT_GET_CREDS

Clients that support explicit authentication call this procedure to obtain a client ID. A client ID is issued for the client process when the client process logs in to the ACMS Remote Manager using the ACMSMGR LOGIN command. Once obtained by this procedure, the client ID is used on subsequent RPC calls.


Format

int acms$mgmt_get_creds(char *server_node,char *user_name, int *client)


Parameters

server_node

Type: String
Access: Read  
Mechanism: By reference  
Usage: Name of the node the server that issued the client ID was running on; the node that will be accessed. Client_id is valid only for the server that issued it.

user_name

Type: String
Access: Read  
Mechanism: By reference  
Usage: Name of the user the client ID was issued to, and on whose behalf the client ID is used. The name may the same as or different than the account name of the client process.

client

Type: Integer
Access: Write  
Mechanism: By reference  
Usage: The client ID to be used for the target user on the target server node. The client ID is valid only for the client process that created it.

Return Value

Type: Integer
Access: Write  
Mechanism: By value  
Usage: The completion status of the call. The following are possible return values:
  Value Description
  MGMT_SUCCESS Client ID was fetched; credentials verified.
  MGMT_NO_NODELOGICAL Can't translate UCX$INET_HOST logical name to get local node name.
  MGMT_NO_CREDS_FILE Credentials file was not found.
  MGMT_CREDS_DATA_ERR Credentials file is corrupt.
  MGMT_WRONG_PID PID in credentials file doesn't match client process's PID.
  MGMT_WRONG_NODE Node name in credentials file doesn't match server_node argument.

Description

Clients call this procedure to fetch a previously created client ID from an encrypted credentials file. Credentials files can be created only by the ACMSMGR LOGIN command. They are stored in the directory pointed to by the logical name ACMS$MGMT_CREDS_DIR (or SYS$LOGIN if ACMS$MGMT_CREDS_DIR is not defined). Credentials files are named using the following format:

user-name_pid_target-node_current-node.dat

In this format:

user-name must match the user_name argument string.
pid must match the PID of the client process.
target-node must match the server_node argument string.
current-node must be the local node name (as determined by the logical name UCX$INET_HOST).

Note

For credentials information to be created, the client process must first execute the login command of the ACMSMGR utility. The only way to create credentials files is by using the ACMSMGR utility.

If the credentials file cannot be located, opened, and read, an error is returned. Once opened and read, the credentials in the file are verified. If the credentials are acceptable, the client_id field is populated and the procedure returns a status that indicates success.

This procedure is statically linked and locally executed.


Example


#include <rpc/rpc.h> 
#include string 
#include "acmsmgmt_rpc.h" 
 
CLIENT *cl; 
char sname[] = "sparks"; 
char *username_p, username[13] = ""; 
int client_id; 
int status; 
 
int acms$mgmt_get_creds(); 
 
int main () 
{ 
 
    /* if the logical is defined, credential information will be used */ 
    username_p = getenv("ACMS$MGMT_USER"); 
    if (username_p) 
          strcpy(username,username_p); 
 
    /* establish an rpc connection to the server */ 
    cl = clnt_create(sname, ACMSMGMT_RPC, ACMSMGMT_VERSION, "tcp"); 
 
    /* if the connection was established */ 
    if (cl != NULL) { 
 
        /* create a security context */ 
        cl->cl_auth = authunix_create_default(); 
        client_id = 0; 
 
        /* optionally, get credentials for this user & server */ 
        if (strlen(username)) 
           status = acms$mgmt_get_creds(sname,username,&client_id); 
 
      } 
 
return(1); 
} 
      

The preceding example is a program that performs initialization for an ACMS Remote Manager client. The program calls the acms$mgmt_get_creds procedure to obtain the client ID for the user whose name is defined by the logical name ACMS$MGMT_USER on the node SPARKS.

7.8 ACMSMGMT_GET_MGR_STATUS_1

ACMS Remote Manager clients call this procedure to obtain run-time status information about a Remote Manager on a particular node.

Format

mgr_status_rec_out *acmsmgmt_get_mgr_status_1(sub_id_struct *sub_id_rec, CLIENT *cl)


Parameters

sub_id_rec

Type: Sub_id_struct *
Access: Read  
Mechanism: By reference  
Usage: Structure that contains the following client authorization information.
     
  client_id
  Type: Integer
  Access: Read
  Mechanism: By value
  Usage: If explicit authentication is being used, a valid client ID must be provided. If the value for client_id is 0, proxy access is used. Client_id is obtained by calling the acms$mgmt_get_creds procedure.

cl

Type: CLIENT *
Access: Read  
Mechanism: By value  
Usage: Pointer to an RPC client handle previously obtained by calling the RPC routine CLNT_CREATE.

Return Value

mgr_status_rec_out

Type: Mgr_status_rec union
Access: Write
Mechanism: By reference
Usage: Pointer to a union. The union contains either a failure code or a pointer to a structure of type mgr_status_rec, which contains the status data. The following are the contents of this union:
     
  rc
  Type: Integer
  Access: Write
  Mechanism: By value
  Usage: Failure return code.
     
  data
  Type: Mgr_status_rec
  Access: Write
  Mechanism: By reference
  Usage: Remote Manager status data record. Contains the fields from the Manager Status table (see Section 8.7).

Description

This procedure gets run-time information about a Remote Manager on a particular node. The return pointer points to a record of type mgr_status_rec_out, which is a union containing either a status code, or a pointer to a manager status record. See Section 8.7 for a description of the fields in the manager status record.

This procedure does not require the ACMS run-time system in order to execute.


Example


int get_mgr_data(int client_id,CLIENT *cl) 
 { 
 
   mgr_status_rec   *mgrs; 
   mgr_status_rec_out  *mgr_data; 
   static struct sub_id_struct sub_rec; 
   
   sub_rec.client_id = client_id; 
 
   mgr_data = acmsmgmt_get_mgr_status_1(&sub_rec,cl); 
 
   if (!mgr_data) { 
 printf("\n RPC Call to get RM data failed"); 
        return(MGMT_FAIL); 
   } 
 
   if (mgr_data->status != MGMT_SUCCESS) { 
 printf("\n Call to get RM data failed, returning status code 
%d",mgr_data->status); 
        return(mgr_data->status); 
   } 
   
   mgrs = &mgr_data->mgr_status_rec_out_u.data; 
   printf("\n RPC UDP state is %d",mgrs->rpc_udp_state); 
 
   return(0); 
} 
      

In the preceding example, the acmsmgmt_get_mgr_status_1 procedure is called to fetch the contents of the Manager Status table. If the call succeeds, the current state of the TCP/UDP protocol in the RPC interface is printed from the retrieved record. Otherwise, an error message is displayed. The example in Section 5.3.1 shows how to declare and initialize the input arguments to this procedure.

7.9 ACMSMGMT_GET_PARAM_1

ACMS Remote Manager clients call this procedure to obtain configuration information about a Remote Manager on a particular node.

Format

param_rec_out = acmsmgmt_get_param_1(sub_id_struct *sub_id_rec, CLIENT *cl)


Parameters

sub_id_rec

Type: Sub_id_struct *
Access: Read  
Mechanism: By reference  
Usage: Structure that contains the following client authorization information.
     
  client_id
  Type: Integer
  Access: Read
  Mechanism: By value
  Usage: If explicit authentication is being used, a valid client ID must be provided. If the value for client_id is 0, proxy access is used. Client_id is obtained by calling the acms$mgmt_get_creds procedure.

cl

Type: CLIENT *
Access: Read  
Mechanism: By value  
Usage: Pointer to an RPC client handle previously obtained by calling the RPC routine CLNT_CREATE.

Return Value

param_rec_out

Type: Param_rec union
Access: Write
Mechanism: By reference
Usage: Pointer to record returned. If NULL, the RPC has failed. If not null, the record contains either an error code in the status field (the RPC succeeded, but the call failed for another reason), or the data requested.

Description

This procedure gets configuration information about a Remote Manager on a particular node. The return pointer points to a record of type param_rec_out, which is a union containing either a status code or a pointer to a PARAM record. See Section 8.8 for a description of the fields in the PARAM record.

This procedure does not require the ACMS run-time system in order to execute.


Example


int get_param_data(int client_id,CLIENT *cl) 
 { 
   int x = 0; 
   int y = 0; 
 
   param_rec      *params; 
   param_rec_out  *param_rec; 
   static struct sub_id_struct sub_rec; 
   
   sub_rec.client_id = client_id; 
 
   param_rec = acmsmgmt_get_param_1(&sub_rec,cl); 
 
   if (!param_rec) 
        return(MGMT_FAIL); 
 
   if (param_rec->status != MGMT_SUCCESS) 
        return(param_rec->status); 
   
   params = &param_rec->param_rec_out_u.data; 
   printf("\n Maximum logins allowed is 
%d",param_rec->param_rec_out_u.data.max_logins); 
 
   return(0); 
} 
      

In the preceding example, the acmsmgmt_get_param_1 procedure is called to fetch the contents of the Parameter table. If the call succeeds, the maximum number of logins is printed from the retrieved record. Otherwise, an error message is displayed. The example in Section 5.3.1 shows how to declare and initialize the input arguments to this procedure.

7.10 ACMSMGMT_GET_QTI_1

ACMS Remote Manager clients call this procedure to obtain class information about a Queued Task Initiator (QTI) on a local or remote node.

Format

qti_rec_out *acmsmgmt_get_qti_1(sub_id_struct *sub_id_rec, CLIENT *cl)


Parameters

sub_id_rec

Type: Sub_id_struct *
Access: Read  
Mechanism: By reference  
Usage: Structure that contains the following client authorization information.
     
  client_id
  Type: Integer
  Access: Read
  Mechanism: By value
  Usage: If explicit authentication is being used, a valid client ID must be provided. If the value for client_id is 0, proxy access is used. Client_id is obtained by calling the acms$mgmt_get_creds procedure.

cl

Type: CLIENT *
Access: Read  
Mechanism: By value  
Usage: Pointer to an RPC client handle previously obtained by calling the RPC routine CLNT_CREATE.

Return Value

qti_rec_out

Type: Qti_rec union
Access: Write
Mechanism: By reference
Usage: Pointer to record returned. If NULL, the RPC has failed. If not null, the record contains either an error code in the status field (the RPC succeeded, but the call failed for another reason) or the data requested.

Description

This procedure obtains class information about a QTI on a local or remote node. The return pointer points to a record of type qti_rec_out, which is a union containing either a status code, or a pointer to a QTI record. See Section 8.9 for a description of the fields in the QTI record.

If the ACMS run-time system is not running when this call is issued, the Remote Manager returns the MGMT_NOT_MAPPED error code.


Example


int get_qti_data(int client_id,CLIENT *cl) 
 { 
 
   qti_rec_r      *qtis; 
   qti_rec_out    *qti_rec; 
   static struct sub_id_struct sub_rec; 
   
   sub_rec.client_id = client_id; 
 
   qti_rec = acmsmgmt_get_qti_1(&sub_rec,cl); 
 
   if (!qti_rec) { 
 printf("\n RPC Call to get qti data failed"); 
        return(MGMT_FAIL); 
   } 
 
   if (qti_rec->status != MGMT_SUCCESS) { 
 printf("\n Call to get qti data failed, returning status code 
%d",qti_rec->status); 
        return(qti_rec->status); 
   } 
   
   qtis = &qti_rec->qti_rec_out_u.qti_rec; 
   printf("\n QTI process name is %s",qtis->process_name); 
 
   return(0); 
} 
      

In the preceding example, the acmsmgmt_get_qti_1 procedure is called to fetch QTI management information. If the call succeeds, the QTI's process name is printed from the retrieved record. Otherwise, an error message is displayed. The example in Section 5.3.1 shows how to declare and initialize the input arguments to this procedure.

7.11 ACMSMGMT_GET_TSC_1

ACMS Remote Manager clients call this procedure to obtain class information about a Terminal Subsystem Controller (TSC) on a local or remote node.

Format

tsc_rec_out *acmsmgmt_get_tsc_1(sub_id_struct *sub_id_rec, CLIENT *cl)


Parameters

sub_id_rec

Type: Sub_id_struct *
Access: Read  
Mechanism: By reference  
Usage: Structure that contains the following client authorization information.
     
  client_id
  Type: Integer
  Access: Read
  Mechanism: By value
  Usage: If explicit authentication is being used, a valid client ID must be provided. If the value for client_id is 0, proxy access is used. Client_id is obtained by calling the acms$mgmt_get_creds procedure.

cl

Type: CLIENT *
Access: Read  
Mechanism: By value  
Usage: Pointer to an RPC client handle previously obtained by calling the RPC routine CLNT_CREATE.

Return Value

tsc_rec_out

Type: Tsc_rec union
Access: Write
Mechanism: By reference
Usage: Pointer to record returned. If NULL, the RPC has failed. If not null, the record contains either an error code in the status field (the RPC succeeded, but the call failed for another reason) or the data requested.

Description

The return pointer points to a record of type tsc_rec_out, which is a union containing either a status code or a pointer to a TSC record. See Section 8.13 for a description of the fields in the record.

If the ACMS run-time system is not running when this call is issued, the Remote Manager returns the MGMT_NOT_MAPPED error code.


Example


int get_tsc_data(int client_id,CLIENT *cl) 
 { 
 
   tsc_rec_r      *tscs; 
   tsc_rec_out    *tsc_rec; 
   static struct sub_id_struct sub_rec; 
   
   sub_rec.client_id = client_id; 
 
   tsc_rec = acmsmgmt_get_tsc_1(&sub_rec,cl); 
 
   if (!tsc_rec) { 
 printf("\n RPC Call to get tsc data failed"); 
        return(MGMT_FAIL); 
   } 
 
   if (tsc_rec->status != MGMT_SUCCESS) { 
 printf("\n Call to get tsc data failed, returning status code 
%d",tsc_rec->status); 
        return(tsc_rec->status); 
   } 
   
   tscs = &tsc_rec->tsc_rec_out_u.tsc_rec; 
   printf("\n TSC process name is %s",tscs->process_name); 
 
   return(0); 
} 
      

In the preceding example, the acmsmgmt_get_tsc_1 procedure is called to fetch TSC management information. If the call succeeds, the TSC's process name is printed from the retrieved record. Otherwise, an error message is displayed. The example in Section 5.3.1 shows how to declare and initialize the input arguments to this procedure.


Previous Next Contents Index