Document revision date: 30 March 2001

## OpenVMS Utility Routines Manual

Previous | Contents | Index

## LGI$ICB_PWDEXPIRED

> The LGI$ICB_PWDEXPIRED callback routine checks for password expiration.

### Format

> LGI$ICB_PWDEXPIRED

### RETURNS

> No value. Does not return on failure.

### Arguments

> None.

### Description

> Use this callback routine to determine whether the account password has expired. If the password is expired, the callback routine:
> - Writes its standard error message to the user terminal, if there is a terminal
> - Does not return control to the caller

### Condition Values Returned

> None. |

## LGI$ICB_USERPARSE

> The LGI$ICB_USERPARSE callback routine parses the user name input.

### Format

> LGI$ICB_USERPARSE input_buffer

### RETURNS

> OpenVMS usage: | cond_value
> type: | longword (unsigned)
> access: | write only
> mechanism: | by value

> Condition value in R0.

### Argument

> #### input_buffer

> OpenVMS usage: | character string
> type: | string descriptor
> access: | read only
> mechanism: | by reference

> The input buffer must contain the characters LOGIN in the first five character locations, followed by an ASCII space character and then the user name and applicable site-specified qualifiers.

### Description

> The site can use this callback routine to parse input for interactive logins on character-cell and DECwindows terminals.

> Upon completion of this routine, the user name is accessible at the LGI$A_USERNAME entry in the standard arguments vector.

### Condition Values Returned

1

> True (1) if successful; otherwise, any condition code returned by CLI$PARSE.

## LGI$ICB_USERPROMPT

> The LGI$ICB_USERPROMPT callback routine prompts for the user name.

### Format

> LGI$ICB_USERPROMPT prompt

### RETURNS

> OpenVMS usage: | cond_value
> type: | longword (unsigned)
> access: | write only
> mechanism: | by value

> Condition value in R0.

### Argument

> #### prompt

> OpenVMS usage: | character string
> type: | string descriptor
> access: | read only
> mechanism: | by reference

> A string that must begin with "cr,lf". For example, to produce the standard user name prompt, use your language equivalent of the following BLISS value:

>      UPLIT(12,UPLIT BYTE(CR,LF,'Username: '))

> Declare the string in C using the following statement:

>     $DESCRIPTOR(<variable_name>, "lrlnUsername:")

> You then pass the descriptor using the variable name.

> This routine also produces the standard user name prompt if you pass the value 0 for this argument.

### Description

> Use this callback routine to interactively prompt for the user name on a character-cell terminal. The callback routine reads the response to the prompt and does standard DCL parsing for the user name and any qualifiers provided. Upon completion of this routine, the user name is accessible at the LGI$A_USERNAME entry in the standard arguments vector.

### Condition Values Returned

> SS$_NORMAL | Success.
> LGI$_NOTVALID | Retry count exceeded for user input.

## LGI$ICB_VALIDATE

> The LGI$ICB_VALIDATE callback routine validates the user name and passwords against the system authorization file.

### Format

> LGI$ICB_VALIDATE username ,pwd1 ,pwd2

### RETURNS

> OpenVMS usage: | cond_value
> type: | longword (unsigned)
> access: | write only
> mechanism: | by value

> Condition value in R0.

### Arguments

> #### username

> OpenVMS usage: | character string
> type: | string descriptor
> access: | read only
> mechanism: | by reference

> User name.

> #### pwd1

> OpenVMS usage: | character string
> type: | string descriptor
> access: | read only
> mechanism: | by reference

> Primary password.

> #### pwd2

> OpenVMS usage: | character string
> type: | string descriptor
> access: | read only
> mechanism: | by reference

> Secondary password.

### Description

> The site can use this callback routine to validate the user name and the user's primary and secondary passwords against the system authorization file (SYSUAF.DAT). The routine also:
> - Updates the user authorization (UAF) record with information about login failures
> - Performs security auditing
> - Performs break-in detection and intrusion evasion

### Condition Values Returned

1

> Success, or an error indicating the reason for the failure.

## Chapter 14
Mail Utility (MAIL) Routines

The callable interface of the Mail utility (MAIL) lets you send messages to users on your system or on any other computer connected to your system with DECnet. This chapter describes how application programs using callable MAIL routines can perform the following functions:

- Create and access mail files
- Access and manipulate a message or group of messages
- Create and send messages to a user or group of users
- Access and manipulate the user profile database

For information about the DCL interface to the Mail utility, see the OpenVMS User's Manual.

## 14.1 Messages

Messages are files that contain information you want to send to other users. Messages having one or two blocks are part of a mail file, while messages having more than two blocks are external sequential files.

External files reside in the same directory as the mail file that points to them.

Structure of a Message

A message consists of header information and the bodypart. The message bodypart consists of text records that contain information you want to send to another user.

Figure 14-1 illustrates the format of a mail message.

Figure 14-1 Standard Message Format

    From:   MYNODE::USER  "The Celestial Navigator"    (1)
    To:     NODE::J_DOE         (2)
    CC:     USER                (3)
    Subj:   Perseids ...        (4)

    Get ready. Tuesday of this week (August 12th), one    (5)
    of the most abundant meteor showers of the year will occur.
    The Perseids, also known as the St. Laurence's Tears, stream
    across earth's orbit at 319.3 degrees. Radiant 3h4m +58 degrees.
    Fine for photography with an average magnitude of 2.27.
    There will be some fireballs, fainter white or yellow
    meteors, and brighter  green or orange or red ones. About one
    third of the meteors, including all the  brightest, leave
    yellowish trains, which may be spectacular, up to 2
    degrees wide and lasting up to 100 seconds. Brighter
    meteors often end in flares or bursts.            (6)

The parts of a message are as follows:

- Header information
  1. From: field specifies the sender and an optional personal name string
  2. To: field specifies the direct addressee
  3. CC: field specifies the carbon copy addressee
  4. Subj: field specifies the topic of the message
- Bodypart
  1. First line of the bodypart
  2. Last line of the bodypart

External Message Identification Number

In addition, the file name of an external message uses the following format:

    MAIL$nnnnnnnnnnnnnnnn.MAI

where n...n is the external message identification number.

## 14.2 Folders

The Mail utility organizes messages by date and time received and, secondarily, by folder name. All messages are associated with a folder name---either default folders or user-specified folders. The Mail utility associates mail messages with one of three default mail folder names. Table 14-1 describes the three default mail folders.

Table 14-1 Default Mail Folders
Folder | Contents
--- | ---
NEWMAIL | Newly received, unread messages
MAIL | Messages that have been read and not deleted
WASTEBASKET | Messages designated for deletion

You can also place messages in any user-defined mail folder and file.

## 14.3 Mail Files

A mail file is an indexed file that contains the following types of data:

- Header information for all messages
- Text of short messages
- Pointers to long messages

In addition, you can select messages from mail files as well as copy or move messages to or from mail files.

Mail File Format

The indexed mail file format offers two advantages: use of folders and faster access time than sequential access. Indexed mail files use two keys to locate messages---a primary key denoting the date and time received and a secondary key using the folder name.

## 14.4 User Profile Database

The Mail utility maintains an indexed data file VMSMAIL_PROFILE.DATA that serves as a systemwide database of user profile entries. A user profile entry is a record that contains data describing a Mail user's default processing characteristics and whose primary key is the user name. Table 14-2 summarizes information contained in a user profile entry.

Table 14-2 User Profile Information
Field | Function
--- | ---
Directory | Default MAIL subdirectory
Form | Default print form
Forwarding address | Forwarding address
Personal name string | User-specified character string included in the message header
Queue name | Default print queue name
Flags Automatic purge CC: prompt Copy self forward Copy self reply Copy self send | Purging of the wastebasket folder on exiting Carbon copy prompt Copy to self when forwarding a message Copy to self when replying to a message Copy to self when sending a message
Signature file | Text file that is automatically appended to the end of the body of a mail message

Both the callable interface and the user interface access the user profile database to determine default processing characteristics.

## 14.5 Mail Utility Processing Contexts

The Mail utility defines four discrete levels of processing, or contexts for manipulating mail files, messages, folders, and the user profile database as shown in Table 14-3.

Table 14-3 Levels of Mail Utility Processing
Context | Entity
--- | ---
Mail file | Mail files and folders
Message | Mail files, folders, and messages
Send | Messages
User | User profile database

Within each context, your application processes specific entities in certain ways using callable MAIL routines as described in the sections that follow.

Initiating a MAIL Context

You must explicitly begin and end each MAIL context. Each group of routines contains a pair of context-initiating and terminating routines.

When you begin processing in any context, the Mail utility performs the following functions:

1. Allocates sufficient virtual memory to manage context information
2. Initializes context variables and internal structures

Terminating a MAIL Context

Terminating a MAIL processing context deallocates virtual memory. You must explicitly terminate processing in any context by calling a context-terminating routine.

### 14.5.1 Callable Mail Utility Routines

There are four types of callable Mail utility routines, each corresponding to the context within which they execute. A prefix identifies each functional group:

- MAIL$MAILFILE_
- MAIL$MESSAGE_
- MAIL$SEND_
- MAIL$USER_

Table 14-4 lists Mail utility routines according to context.

Table 14-4 Callable Mail Utility Routines
Context | Routine
--- | ---
Mail file | MAIL$MAILFILE_BEGIN MAIL$MAILFILE_CLOSE MAIL$MAILFILE_COMPRESS MAIL$MAILFILE_END MAIL$MAILFILE_INFO_FILE MAIL$MAILFILE_MODIFY MAIL$MAILFILE_OPEN MAIL$MAILFILE_PURGE_WASTE
Message | MAIL$MESSAGE_BEGIN MAIL$MESSAGE_COPY MAIL$MESSAGE_DELETE MAIL$MESSAGE_END MAIL$MESSAGE_GET MAIL$MESSAGE_INFO MAIL$MESSAGE_MODIFY MAIL$MESSAGE_SELECT
Send | MAIL$SEND_ABORT MAIL$SEND_ADD_ADDRESS MAIL$SEND_ADD_ATTRIBUTE MAIL$SEND_ADD_BODYPART MAIL$SEND_BEGIN MAIL$SEND_END MAIL$SEND_MESSAGE
User | MAIL$USER_BEGIN MAIL$USER_DELETE_INFO MAIL$USER_END MAIL$USER_GET_INFO MAIL$USER_SET_INFO

### 14.5.2 Single and Multiple Threads

Once you have successfully initiated MAIL processing in a context, you have created a thread. A thread is a series of calls to MAIL routines that uses the same context information. Applications can contain one or more threads.

Single Threads

For example, consider an application that begins mail file processing; opens, compresses, and closes a mail file; and ends mail file context processing. This application executes a single thread of procedures that reference the same context variable names and pass the same context information.

Multiple Threads

You can create up to 31 concurrent threads. Applications that contain more than one thread must maintain unique context variables for each thread in order to pass thread-specific context information.

The Mail utility returns the condition value MAIL$_NOMORECTX when your process attempts to exceed the maximum number of allowable threads.

## 14.6 Programming Considerations

The calling sequence for all MAIL routines consists of a status variable, an entry point name, and an argument list. All arguments within the argument list are required. All callable MAIL routines use the same arguments in their calling sequences as described in the following example:

    STATUS=MAIL$MAILFILE_BEGIN(CONTEXT, IN_ITEM_LIST, OUT_ITEM_LIST)

The variable status receives the condition value, and the argument context receives the context information. The arguments in_item_list and out_item_list are input and output item lists that contain one or more input or output item descriptors.

### 14.6.1 Condition Handling

At run time, a hardware- or software-related event can occur that determines whether or not the application executes successfully. The Mail utility processes such an event, or condition in the following ways:

- Signals the condition value
- Returns the error code

You can establish your own condition handler or allow the program to signal the default condition handler.

Returning Condition Values

You can disable signaling for any call by specifying the item code MAIL$_NOSIGNAL as an item in the input item list.

### 14.6.2 Item Lists and Item Descriptors

Your application passes data to callable MAIL routines and receives data from routines through data structures called item lists defined in your program.

#### 14.6.2.1 Structure of an Item Descriptor

An input or output item list is a data structure that consists of one or more input or output item descriptors.

The following table summarizes the characteristics of item lists:

Item Descriptor | Characteristics
--- | ---
Input | Each descriptor points to a buffer or file from which Mail reads data.
Output | Each descriptor points to a buffer or file to which Mail writes data.

An item descriptor is a data structure consisting of three longwords as described in Figure 14-2.

Figure 14-2 Item Descriptor

Item descriptor fields are described as follows:

Field | Function
--- | ---
Item code | Specifies an action the routine is to perform.
Buffer length | Specifies the length in bytes of an input or output buffer.
Buffer address | Specifies the address of the input or output buffer.
Return length address | Depends on the type of item code specified:
Item Code | Use
--- | ---
Input | Not used; specify 0.
Output | Address of a longword that receives the length of the result.

Note You can specify item descriptors in any order within an item list.

Item Codes

The item code defines an action that the routine is to perform. Input and output item codes are specified in input and output item descriptors, respectively.

Boolean input and output item codes request an operation but do not pass data to the called routine. For example, the item code MAIL$_USER_SET_CC_PROMPT sets the CC prompt flag enabling use of CC: field text.

For a complete list of input and output item codes, see Tables 14_10 and 14-11.

Previous | Next | Contents | Index

| privacy and legal statement |
4493PRO_035.HTML