STOMPFRAME (RPGLE)

Stomp : Frame Module
Details ....

Copybooks  

de STOMPSRC,STOMPFRM_H
de STOMPSRC,UNICODE_H
de QLOG4RPG,PLOG4RPG
SrvPgm: LOG4RPG - Type Definitions public
QLOG4RPG,FDMSG
cpybk : Message
de '/usr/local/include/libc_h.rpgle'
de '/usr/local/include/libtree/libtree_h.rpgle'
de '/usr/local/include/message_h.rpgle'

Procedures  

isValidFrame
Validate frame
stomp_frame_containsHeaderexported
Check if frame contains header
stomp_frame_createexported
Create stomp frame
stomp_frame_dumpexported
Dump frame to job log
stomp_frame_finalizeexported
Finalize stomp frame
stomp_frame_getBodyexported
Return message body
stomp_frame_getCommandexported
Get command
stomp_frame_getHeaderValueexported
Get stomp frame header value
stomp_frame_headerExistexported
Check if header exist
stomp_frame_listHeadersexported
List stomp frame headers
stomp_frame_setBodyexported
Set body/content
stomp_frame_setCommandexported
Set command
stomp_frame_setHeaderexported
Set stomp frame header value
stomp_frame_toStringexported
String representation of a stomp frame

Detailed Description  

This module provides procedures for creating and querying a stomp frame.

Log entries will be written via the logger de.rpgng.stomp.frame.
Author:
Mihael Schmidt
Date:
15.04.2011

Procedure Documentation  

isValidFrame  

BooleanisValidFrame(Pointer)
Checks if this frame is a valid stomp frame.
Parameter:
Pointer   constFrame
Return value:
Boolean*on = valid stomp frame
*off = invalid stomp frame

stomp_frame_containsHeader  

Booleanstomp_frame_containsHeader(Pointer, stomp_frame_header)
Checks if the frame contains the header.
Parameter:
Pointer   constFrame
stomp_frame_header   constHeader
Return value:
Boolean*on = frame contains header otherwise *off
Exported.

stomp_frame_create  

voidstomp_frame_create(stomp_frame_command, Zeichen)
Creates a stomp frame and if the parameters are passed also initializes it.
Parameter:
stomp_frame_command   const   optionalStomp command (optional)
Zeichen (65335)   const   varying   optionalFrame body text (optional)
Exported.
Infos:
  The resources allocated with this frame must be released by the caller with the stomp_frame_finalize procedure.

stomp_frame_dump  

voidstomp_frame_dump(Pointer)
Outputs the passed frame as an INFO message to the job log.
Parameter:
Pointer   constFrame
Exported.

stomp_frame_finalize  

voidstomp_frame_finalize(Pointer)
Releases all resources allocated to the frame.
Parameter:
PointerFrame
Exported.

stomp_frame_getBody  

Pointerstomp_frame_getBody(Pointer)
Returns a pointer to the body text of this frame. The string is null-terminated.
Parameter:
Pointer   constFrame
Return value:
PointerPointer to message body (may be null if not set)
Exported.

stomp_frame_getCommand  

stomp_frame_commandstomp_frame_getCommand(Pointer)
Returns the command of this stomp frame.
Parameter:
Pointer   constFrame
Return value:
stomp_frame_commandCommand (is *blank if not set yet)
Exported.

stomp_frame_getHeaderValue  

Zeichenstomp_frame_getHeaderValue(Pointer, stomp_frame_header)
Returns the value from the passed header of the stomp frame.
Parameter:
Pointer   constFrame
stomp_frame_header   constStomp frame header (key)
Return value:
Zeichen (1024)Value
Exported.

stomp_frame_headerExist  

Booleanstomp_frame_headerExist(Pointer, stomp_frame_header)
Checks if this frame contains a header with the passed key.
Parameter:
Pointer   constFrame
stomp_frame_header   constHeader key
Return value:
Boolean*on = header exists
*off = header doesn't exist
Exported.

stomp_frame_listHeaders  

Pointerstomp_frame_listHeaders(Pointer)
Returns a map for stomp frame headers (key/value pairs).
Parameter:
Pointer   constFrame
Return value:
Pointers Map with headers
Exported.
Infos:
  The caller of this procedure must make sure to free the allocated resources of the returnen map with tree_rb_string_finalize(map).

stomp_frame_setBody  

voidstomp_frame_setBody(Pointer, Pointer)
Sets the body/content of this frame.
If this frame already contains a content the old content will be replaced by the new one.
Parameter:
Pointer   constFrame
Pointer   constContent (null-terminated)
Exported.

stomp_frame_setCommand  

voidstomp_frame_setCommand(Pointer, stomp_frame_command)
Sets the command in the stomp frame.
Parameter:
Pointer   constFrame
stomp_frame_command   constCommand
Exported.

stomp_frame_setHeader  

voidstomp_frame_setHeader(Pointer, stomp_frame_header, Zeichen)
Sets a header (key and value) on the passed stomp frame.
If this header already exists its value will be replaced with the one passed.
Parameter:
Pointer   constFrame
stomp_frame_header   constStomp frame header (key)
Zeichen (1024)   const   varyingValue
Exported.

stomp_frame_toString  

Pointerstomp_frame_toString(Pointer)
Returns a string representation of this stomp frame. The string is encoded in the CCSID of the current job.
Parameter:
Pointer   constFrame
Return value:
PointerPointer to the string (null-terminated) or null if the pointer to the frame is null.
Exported.
Infos:
  The caller must take of releasing the allocated memory of the returned string.