/*
 * Copyright (c) 2000, 2017 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0, which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the
 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
 * version 2 with the GNU Classpath Exception, which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 */

/*
 * @(#)mqcallback-types-priv.h	1.9 06/26/07
 */ 

#ifndef MQ_CALLBACK_TYPES_PRIV_H
#define MQ_CALLBACK_TYPES_PRIV_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "mqtypes.h"
#include "mqcallback-types.h"


/**
 * This callback is used to notify the user that a message has
 * arrived.
 *
 * @param sessionHandle the session containing the consumer that
 *        received a message
 * @param consumerHandle the consumer that received a message
 * @param callbackData whatever void* pointer that was passed to
 *        MQSetMessageArrivedFunc
 * @see MQSetMessageArrivedFunc. */
typedef void (*MQMessageArrivedFunc)(const MQSessionHandle  sessionHandle,
                                      const MQConsumerHandle consumerHandle,
                                            void *            callbackData );

/** The type of the entry point for the thread creating function */
typedef void (*MQThreadFunc)(void *arg);

/**
 * This callback allows the user to specify a callback function that
 * creates threads.
 *
 * @param startFunc the starting function for the thread
 * @param arg the argument to pass to 
 * @param callbackData whatever void* pointer that was passed to
 *        MQSetCreateThreadFunc
 * @param MQ_TRUE if the thread was successfully created and
 *        MQ_FALSE if the thread could not be created.
 * @see MQSetCreateThreadFunc. */
typedef MQBool (*MQCreateThreadFunc)(MQThreadFunc startFunc,
                                       void * arg,     
                                       void * callbackData);

/* The relative logging severity. */
typedef enum _MQLoggingLevel {MQ_LOG_OFF  = -1,
                              MQ_LOG_SEVERE  = 0, 
                              MQ_LOG_WARNING = 1,
                              MQ_LOG_INFO    = 2, 
                              MQ_LOG_CONFIG  = 3, 
                              MQ_LOG_FINE    = 4,
                              MQ_LOG_FINER   = 5,
                              MQ_LOG_FINEST  = 6 } MQLoggingLevel;
/**
 * This is the type of the user installed callback function that can be
 * used to log information generated by the MQ library.
 *
 * @param severity the severity of the logging message
 * @param logCode the error code associated with the error.  This
 *        is only guaranteed to be valid if severity is MQSevereLevel.
 * @param logMessage the message to log
 * @param timeOfMessage the time of the log message represented as the number
 *        of microseconds since the, midnight (00:00:00) 1 January 1970 UTC. 
 * @param connectionID the id of the connection that generated this logging
 *        message.  This will be 0 if no connection can be associated with
 *        the log message.
 * @param filename the name of the source file where the log message originated
 * @param fileLineNumber the line number in the source file where the log
 *        message originated
 * @param callbackData the void* pointer that was passed to MQSetLoggingFunc
 * @see MQSetLoggingFunc
 */
typedef void (*MQLoggingFunc)(const MQLoggingLevel  severity,
                               const MQInt32         logCode,
                               ConstMQString         logMessage,
                               const MQInt64         timeOfMessage,
                               const MQInt64         connectionID,
                               ConstMQString         filename,
                               const MQInt32         fileLineNumber,
                                     void*            callbackData);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* MQ_CALLBACK_TYPES_PRIV_H */
