2.12 Customizing a Buffer

You may find that the buffer types supplied by the Oracle Tuxedo system do not meet your needs. For example, perhaps your application uses a data structure that is not flat, but has pointers to other data structures, such as a parse tree for an SQL database query. To accommodate unique application requirements, the Oracle Tuxedo system supports customized buffers.

To customize a buffer, you need to identify the following characteristics shown in the following table.

Table 2-11 Custom Buffer Type Characteristics

Characteristic Description
Buffer type Name of the buffer type, specified by a string of up to eight characters.
Buffer subtype Name of the buffer subtype, specified by a string of up to 16 characters. The system uses a subtype to identify different processing requirements for buffers of a given type. When the wildcard character (*) is specified as the subtype value, all buffers of a given type can be processed using the same generic routine. Any buffers for which a subtype is defined must appear before the wildcard in the list, in order to be processed correctly.
Default size Minimum size of the associated buffer type that can be allocated or reallocated. For buffer types that have a value greater than zero and that are sized appropriately, you can specify a buffer size of zero when allocating or reallocating a buffer to use this default size.

The following table defines the list of routines that you may need to specify for each buffer type. If a particular routine is not applicable, you can simply provide a NULL pointer; the Oracle Tuxedo system uses default processing, as necessary.

Table 2-12 Custom Buffer Type Routines

Routine Description
Buffer initialization Initializes a newly allocated typed buffer.
Buffer reinitialization Reinitializes a typed buffer. This routine is called after a buffer has been reallocated (that is, assigned a new size).
Buffer uninitialization Uninitializes a typed buffer. This routine is called just before a typed buffer is freed.
Buffer presend Prepares the typed buffer for sending. This routine is called before a typed buffer is sent as a message to another client or server. It returns the length of the data to be transmitted.
Buffer postsend Returns the typed buffer to its original state. This routine is called after the message is sent.
Buffer postreceive Prepares the typed buffer once it has been received by the application. It returns the length of the application data.
Encode/decode Performs all the encoding and decoding necessary for the buffer type. A request to encode or decode is passed to the routine, along with input and output buffers and lengths. The format used for encoding is determined by the application and, as with the other routines, it may be dependent on the buffer type.
Routing Specifies the routing information. This routine is called with a typed buffer, the length of the data for that buffer, a logical routing name configured by an administrator, and a target service. Based on this information, the application must select the server group to which the message should be sent or indicate that the message is not needed.
Filter Specifies filter information. This routine is called to evaluate an expression against a typed buffer and to return a match if it finds one. If the typed buffer is VIEW or FML, the FML Boolean expressions are used. This routine is used by the EventBroker to evaluate matches for events.
Format Specifies a printable string for a typed buffer.