#ifndef __MDF_JAVA_H
#define __MDF_JAVA_H
#include <jni.h>
#include <stdlib.h>
#include <mdf/mdf.h>

/*
 * Struct that holds the cached information needed by the callback functions so
 * it can call into the Java code from the native side.
 */
struct callback_data {
	JNIEnv *env;
	jobject obj;
	jobject obj2; /* used to store the Mdf class for the consumeData callback */
	jmethodID mid;
};

/* varios cached data that we fetch when the Mdf and/or Message class is loaded
 * safe to cache because their values are static throught the lifetime of the class 
*/

extern jfieldID handle_fid;  /* cached FieldID of "handle" member of Mdf class */
extern jfieldID message_fid; /* cached FieldID of "handle" member of Message class */

extern jmethodID al_init_mid; /* cached MethodID of ArrayList constructor */
extern jmethodID al_add_mid; /* cached MethodID of ArrayList add(Object) method */
extern jmethodID mh_init_mid; /* cached MethodID for the MesssageHeader constructor */
extern jmethodID mh_init2_mid; /* cached MethodID for the MesssageHeader constructor with fields ArrayList */
extern jmethodID mf_init_mid; /* cached MethodID for the MesssageField constructor */

#endif

