/*  File:         broker.h
 *  Created:      20-10-95
 *  Updated:      30-10-95
 *  Version:      1.0
 *  Project:      Clicker
 *  Owner:        Jeroen Vermeulen
 *  Requirements: KickStart V39+
 *  Legal:        PD
 *  Status:       Release
 */


/* MakeBroker():
 * Creates and initializes a NewBroker structure, including its MsgPort.
 * Call KillBroker() to get rid of it later. If allocation fails for
 * some reason, NULL is returned and the pointer indicated by errptr is
 * redirected to an error string.
 */
struct NewBroker *MakeBroker(STRPTR *const errptr, const BYTE cx_pri);


/* SetupBroker():
 * Sets up the commodities broker network for Clicker (created with
 * MakeBroker()) in an inactive state.  Activate or deactivate it with
 * ActivateCxObj().
 * If successful, a pointer to the root CxObj is returned, so it can later be
 * deallocated with DeleteCxObjAll().  If an error occurs, NULL is returned and
 * the STRPTR pointed to by errptr will point to an error message.
 */
CxObj *SetupBroker(STRPTR *const errptr, struct NewBroker *const mybroker);


/* KillBroker():
 * Delete a NewBroker structure (and its MsgPort) that was allocated
 * through MakeBroker(). Calling this for an unitialized or NULL broker
 * is safe, as long as initialization was done by MakeBroker().
 */
void KillBroker(struct NewBroker *const brokerobj);
