GreenJab ILE Functions

 ****************************************************************
 * Exported GreenJab Prototypes
 ****************************************************************
 *//////////////////////////////////////////////////////////////*
 * #gj_init - Initialize the server                             *
 *                                                              *
 *  Required for Server                                         *
 *                                                              *
 *  Returns - <1 for error, 0 for no error                      *
 *//////////////////////////////////////////////////////////////*
D #gj_init        PR            10i 0
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_startJob - Starts the listener job                       *
 *                                                              *
 *  Required for Server                                         *
 *                                                              *
 *  Returns - <1 for error, >=0 for no error                    *
 *//////////////////////////////////////////////////////////////*
D #gj_startJob    PR            10i 0
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_close - End the server job and perform cleanup           *
 *                                                              *
 *  Required for Server                                         *
 *                                                              *
 *  Returns - <1 for error, >=0 for no error                    *
 *//////////////////////////////////////////////////////////////*
D #gj_close       PR            10i 0
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_getChatID - get the Chat ID                              *
 *                                                              *
 *  Returns - Chat ID                                           *
 *//////////////////////////////////////////////////////////////*
D #gj_getChatID   PR           256
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_getJID - get the JID                                     *
 *                                                              *
 *  Returns - JID                                               *
 *//////////////////////////////////////////////////////////////*
D #gj_getJID      PR           256
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_getBareJID - get the "bare" JID                          *
 *                                                              *
 *  Returns - bare JID                                          *
 *//////////////////////////////////////////////////////////////*
D #gj_getBareJID  PR           256
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_getUserStatus - get status for a user                    *
 *                                                              *
 *  User ID (Input) - The ID to use check status for.  The      *
 *                     userid must be in the "friend" list      *
 *                     for the account for the From ID          *
 *                                                              *
 *  Returns - -2=Error                                          *
 *            -1=unavailable                                    *
 *             0=available but away                             *
 *             1=available                                      *
 *//////////////////////////////////////////////////////////////*
D #gj_getUserStatus...
D                 PR            10i 0
D   PR_user                    256    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setServer - set Server Name                              *
 *                                                              *
 *  Required for Server                                         *
 *                                                              *
 *  Server (Input) - The name of the server                     *
 *//////////////////////////////////////////////////////////////*
D #gj_setServer   PR
D   PR_server                  256    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setPort - set Port Number                                *
 *                                                              *
 *  Required for Server                                         *
 *                                                              *
 *  Port (Input) - The port to connect to on the server         *
 *//////////////////////////////////////////////////////////////*
D #gj_setPort     PR
D   PR_port                     10i 0 Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setFromID - set the From ID                              *
 *                                                              *
 *  Required for Server and Client                              *
 *                                                              *
 *  From ID (Input) - The ID to use when connecting to the      *
 *                     server                                   *
 *//////////////////////////////////////////////////////////////*
D #gj_setFromID   PR
D   PR_fromID                  256    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setKey - set the Key                                     *
 *                                                              *
 *  Optional for Server and Client                              *
 *  Must be called after #gj_setFromID                          *
 *                                                              *
 *  Key (input) - The key to use for communications.  The       *
 *                 default is the From ID.                      *
 *//////////////////////////////////////////////////////////////*
D #gj_setKey      PR
D   PR_key                     256    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setPassword - set the Password                           *
 *                                                              *
 *  Required for Server                                         *
 *                                                              *
 *  Password (Input) - The password associated with the fromID  *
 *//////////////////////////////////////////////////////////////*
D #gj_setPassword...
D                 PR
D   PR_password                256    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setTimeout - set Timeout value                           *
 *                                                              *
 *  Specify time in seconds, default is 30                      *
 *                                                              *
 *  Time (Input) - the time in seconds to use for socket        *
 *                  timeout                                     *
 *//////////////////////////////////////////////////////////////*
D #gj_setTimeout  PR
D   PR_time                     10i 0 Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setJobTimeout - set Job Timeout Value                    *
 *                                                              *
 *  Specify time in seconds that the job should run without     *
 *   getting any input or output from the user.  The default    *
 *   is 0, which means to never end automatically.              *
 *                                                              *
 *  Time (Input) - the time in seconds to use for the job       *
 *                  timeout                                     *
 *//////////////////////////////////////////////////////////////*
D #gj_setJobTimeout...
D                 PR
D   PR_time                     10i 0 Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setStatus - set the Status that will appear              *
 *                                                              *
 *  Default is "Available on GreenJab!"                         *
 *                                                              *
 *  Status (Input) - the status to use when logged on           *
 *//////////////////////////////////////////////////////////////*
D #gj_setStatus   PR
D   PR_status                  128    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setResource - set The resource value                     *
 *                                                              *
 *  This is rareley used, but works well to clean up any        *
 *   orphaned resources that may be out there in jabber land    *
 *                                                              *
 *  Resource (Input) - The Resource to use when logged on       *
 *//////////////////////////////////////////////////////////////*
D #gj_setResource...
D                 PR
D   PR_resource                256    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setStmfCP - set the Stream File Code Page                *
 *                                                              *
 *  Default is 819                                              *
 *                                                              *
 *  Code Page (Input) - The Stream File Code page to use        *
 *//////////////////////////////////////////////////////////////*
D #gj_setStmfCP   PR
D   PR_stmfCP                   10i 0 Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setCCSID - set the CCSID for EBCDIC --> ASCII            *
 *                                                              *
 *  Default is 819                                              *
 *                                                              *
 *  CCSID (Input) - The CCSID to use for conversions            *
 *//////////////////////////////////////////////////////////////*
D #gj_setCCSID    PR
D   PR_CCSID                    10i 0 Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setDebug - Turn on or off debug                          *
 *                                                              *
 *  Default is *OFF                                             *
 *                                                              *
 *  Debug (Input) - Turn Debug on or off                        *
 *//////////////////////////////////////////////////////////////*
D #gj_setDebug    PR
D   PR_debug                      N   Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setDebugFile - Specify the debug file (fully qualified)  *
 *                                                              *
 *  Default is /tmp/<fromid>greenjabdebug.txt                   *
 *                                                              *
 *  Debug File (Input) - The fully qualified path and file to   *
 *                        use for debugging                     *
 *//////////////////////////////////////////////////////////////*
D #gj_setDebugFile...
D                 PR
D   PR_debugFile               256    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setGCP - Set Google Cloud Print value (experimental)     *
 *                                                              *
 *  Default is *OFF                                             *
 *                                                              *
 *  GCP - *ON to turn on GCP, *OFF to leave it off              *
 *//////////////////////////////////////////////////////////////*
D #gj_setGCP      PR
D   PR_GCP                        N   Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setLocalIP - Set the local IP to bind to                 *
 *                                                              *
 *  Default is none                                             *
 *                                                              *
 *  IP (Input) - The local IP, if required, to bind             *
 *                communications to                             *
 *//////////////////////////////////////////////////////////////*
D #gj_setLocalIP  PR
D   PR_localIP                  64    Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_setLocalIP - Set the local port to bind to               *
 *                                                              *
 *  Default is none                                             *
 *                                                              *
 *  Port (Input) - The port to use for local binding            *
 *//////////////////////////////////////////////////////////////*
D #gj_setLocalPort...
D                 PR
D   PR_port                     10i 0 Value
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_isActive - check if jog is active.                       *
 *                                                              *
 *  The from ID must be set before calling                      *
 *                                                              *
 *  Returns - 1=Active, 0=Not Active, <1=Error                  *
 *//////////////////////////////////////////////////////////////*
D #gj_isActive    PR            10i 0
 *
 *//////////////////////////////////////////////////////////////*
 * #gj_enqMsg - Send a message to the from ID the listener      *
 *  job is running for                                          *
 *                                                              *
 *  Address (Input) - The address you're sending the message to *
 *  Message (Input) - The message.  If the message              *
 *   starts with < and ends in > it will be treated as "raw"    *
 *  Key (Input - optional) - if for some reason you want to     *
 *   override the from address                                  *
 *  Returns -1 for error, otherwise number of bytes sent        *
 *//////////////////////////////////////////////////////////////*
D #gj_enqMsg      PR            10i 0
D   PR_address                 256    Value
D   PR_message               65535    Value
D   PR_key                     256    Value Options(*NOPASS)
 *//////////////////////////////////////////////////////////////*
 * #gj_deqMsg - Retrieve a message from the listener job        *
 *                                                              *
 *  Address (Output) - The address the message is from          *
 *  Message (Output) - The message                              *
 *  Address format (Input) - 0 = JID, 1 = email address         *
 *  Wait Time (Input) - The time to wait for a message          *
 *  Key (Input optional) - if for some reason you want to       *
 *   override the from address                                  *
 *  Returns -1 for error, otherwise number of bytes in message  *
 *//////////////////////////////////////////////////////////////*
D #gj_deqMsg      PR            10i 0
D   PR_address                 256
D   PR_message               65535
D   PR_addFmt                   10i 0 Value Options(*NOPASS)
D   PR_waitTime                 10i 0 Value Options(*NOPASS)
D   PR_key                     256    Value Options(*NOPASS)
 ****************************************************************
 * Constants, Variables, etc
 ****************************************************************
D gj_messageDS    DS                  Qualified
D  address                     256                                         Address
D  message                   32510                                         Message