NAME
set_msg - SET (Secure Electronic Transaction) message abstraction
SYNOPSIS
#include <set_msg.h>

typedef struct set_msg_ {
    asn1set__MessageWrapper    messageWrapper;
} *set_msg;

int create_set_msg(msg, app_ctx, heap)
    set_msg           *msg;             /* OUT */
    set_app_ctx        app_ctx;         /* IN */
    alloc_ctx          heap;            /* IN */

int delete_set_msg(msg)
    set_msg           *msg;             /* IN */

int make_set_msg(msg, app_ctx, msg_cache, msg_type)
    set_msg            msg;             /* IN */
    set_app_ctx        app_ctx;         /* IN */
    cache_ctx          msg_cache[];     /* IN */
    int                msg_type;        /* IN */

int send_set_msg(msg, app_ctx, msg_cache, outstream)
    set_msg            msg;             /* IN */
    set_app_ctx        app_ctx;         /* IN */
    cache_ctx          msg_cache[];     /* IN */
    io_ctx             outstream;       /* IN */
    
int receive_set_msg(msg, app_ctx, instream, msg_type)
    set_msg            msg;             /* IN */
    set_app_ctx        app_ctx;         /* IN */
    io_ctx             instream;        /* IN */
    int               *msg_type;        /* OUT */
    
int decode_set_msg(msg, app_ctx)
    set_msg            msg;             /* IN */
    set_app_ctx        app_ctx;         /* IN */

int verify_set_msg(msg, app_ctx, msg_cache)
    set_msg            msg;             /* IN */
    set_app_ctx        app_ctx;         /* IN */
    cache_ctx          msg_cache[];     /* IN */

/* returns 0 if the message doesn't yet have a type */
int get_set_msg_type(msg)
    set_msg            msg;             /* IN */

DESCRIPTION
set_msg is the parent class for all SET messages and provides access to the SET message wrapper associated with each SET message.

An instance of set_msg can only be associated with a single SET message. It cannot be reused. A set_msg instance can be cast to its specific subtype. A newly-created set_msg does not yet have a subtype.

create_set_msg() creates and initializes an object of type set_msg and associates a memory-allocation heap with the message.

delete_set_msg() deletes the set_msg. Following a call to delete_set_msg(), the set_msg is no longer valid.

make_set_msg() constructs a set_msg of subtype msg_type. Using the provided cache_ctx, make_set_msg() inserts SET protocol-layer data. Applications should not change the contents of the fields filled-in by the protocol layer. See the documentation for each message type for a list of protocol-layer and application-layer data fields.

send_set_msg() encodes, transforms cryptographically, and then sends the message specified by msg to the output stream outstream. After encoding a message, send_set_msg() may cache protocol-layer data in msg_cache.

receive_set_msg() receives a message from the input stream instream and decodes its message wrapper. After a call to receive_set_msg() (and before a call to verify_set_msg()), the information contained in the messageWrapper data structure has not been verified and may be incorrect. Under no circumstances should this information be trusted -- this information should only be used to obtain a hint as to the possible contents of the message.

decode_set_msg() cryptographically decrypts and decodes the contents of the message.

verify_set_msg() verifies the contents of the message wrapper and the encapsulated message. After verifying the message, verify_set_msg() may cache protocol-layer data.

PARAMETERS
app_ctx must be created prior to use. See set_app_ctx for additional information.

msg represents the message wrapper attached to every SET message. It must be created prior to use.

heap must be created prior to use. Any memory allocated by make_set_msg(), send_set_msg(), receive_set_msg(), decode_set_msg(), or verify_set_msg() that is passed back via the msg parameter is allocated out of the alloc_ctx heap. See alloc_ctx for additional information.

The msg_cache parameter is an array of cache_ctx. For non-batch messages, this array should contain only a single element. For batch messages, this array can contain any number of elements, with the array element following the last cache_ctx zeroed. Each cache_ctx is associated with a particular transaction. The application is expected to supply one cache_ctx per transaction, in the order in which they are to be processed. Although the application supplies the cache_ctx, it is unwise for the application to alter the contents of the cache without explicit instructions to do so.

msg_type must be one of the choices defined in asn1set__Message. See the asn1set.h header file for the definition of asn1set__Message. The choices are the following:

    asn1set__Message__pInitReq
    asn1set__Message__pInitRes
    asn1set__Message__pReq
    asn1set__Message__pRes
    asn1set__Message__inqReq
    asn1set__Message__inqRes
    asn1set__Message__authReq
    asn1set__Message__authRes
    asn1set__Message__authRevReq
    asn1set__Message__authRevRes
    asn1set__Message__capReq
    asn1set__Message__capRes
    asn1set__Message__capRevReq
    asn1set__Message__capRevRes
    asn1set__Message__credReq
    asn1set__Message__credRes
    asn1set__Message__credRevReq
    asn1set__Message__credRevRes
    asn1set__Message__pCertReq
    asn1set__Message__pCertRes
    asn1set__Message__batchAdminReq
    asn1set__Message__batchAdminRes
    asn1set__Message__cardCInitReq
    asn1set__Message__cardCInitRes
    asn1set__Message__me_AqCInitReq
    asn1set__Message__me_AqCInitRes
    asn1set__Message__regFormReq
    asn1set__Message__regFormRes
    asn1set__Message__certReq
    asn1set__Message__certRes
    asn1set__Message__certInqReq
    asn1set__Message__certInqRes
    asn1set__Message__error
RETURN VALUES
On success, make_set_msg(), send_set_msg(), receive_set_msg(), and verify_set_msg() return NO_ERROR. On failure, they return [tbd].

get_set_msg_type() returns the message type on success, or 0 on failure. The message type is specified as with the msg_type parameter.

See Return Values for descriptions of individual error codes. For documentation on displaying or logging return values, see error_ctx.

SEE ALSO
AuthReq, AuthRes, CapReq, CapRes, PInitReq, PInitRes, PReq, PRes
NOTES
Objects of type set_msg can be cast to one of the SET message types using a safe_cast routine. See the documentation on each message type for additional information.
BUGS
This document describes a beta implementation. The information contained in this document may be incomplete and is subject to change.

Copyright © 1996, 1997, Visa International Service Association and MasterCard International Incorporated
All Rights Reserved.