/***************************************************************************
                            Connection.java -  description
                             -------------------
    begin                : Sun Jan 27 16:22:17 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Jan 27 16:22:17 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
***************************************************************************/

package org.kde.koala;

import org.kde.qt.*;
import java.util.*;
import java.lang.Error;

/**

 This class provides a simple means for IPC between two applications
 via a pipe.
 It handles a queue of commands to be sent which makes it possible to
 queue data before an actual connection has been established.
     
 See {@link ConnectionSignals} for signals emitted by Connection.

 See {@link ConnectionEventHandling} for event handlers to override in subclasses of Connection.

 @short 
 This class provides a simple means for IPC between two applications
 via a pipe.
*/
public class Connection extends QObject  {
	protected Connection(Class dummy){super((Class) null);}

	private native void newConnection();
	public Connection() {
		super((Class) null);
		newConnection();
	}
	protected native void finalize() throws InternalError;
	public native void dispose();
	public native boolean isDisposed();
	public native void init( KSocket sock);
	public native void init( int fd_in, int fd_out);
	public native void connect( QObject receiver, String member);
	public native void connect();
	public native void close();
	public native int fd_from();
	public native int fd_to();
	public native boolean inited();
	public native void send( int cmd, byte[] arr);
	public native void send( int cmd);
	public native boolean sendnow( int _cmd, byte[] data);

/** 
 Receive data

*/
	public native int read( int[] _cmd, byte[] arg1);

/** 
 Don't handle incoming data until resumed
         
*/
	public native void suspend();

/** 
 Resume handling of incoming data
         
*/
	public native void resume();

/** 
 Returns status of connection
         
*/
	public native boolean suspended();
	protected native void dequeue();
}
