//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.QMetaObject;
import org.kde.qt.QtSupport;
import org.kde.qt.QObject;
import org.kde.qt.QObject;

/**

 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.
     		@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);}
	public native QMetaObject metaObject();
	public native String className();
	/**	
		 Creates a new connection.
				@short    Creates a new connection.
		@see #init
	*/
	public Connection() {
		super((Class) null);
		newConnection();
	}
	private native void newConnection();
	/**	
		 Initialize this connection to use the given socket.
			@param sock the socket to use
				@short    Initialize this connection to use the given socket.
		@see #inited
	*/
	// void init(KSocket* arg1); >>>> NOT CONVERTED
	/**	
		 Initialize the connection to use the given file
		 descriptors.
			@param fd_in the input file descriptor to use
			@param fd_out the output file descriptor to use
				@short    Initialize the connection to use the given file  descriptors.
		@see #inited
	*/
	public native void init(int fd_in, int fd_out);
	public native void connect(QObject receiver, String member);
	public native void connect(QObject receiver);
	public native void connect();
	public native void close();
	/**	
		 Returns the input file descriptor.
				@return the input file descriptor
	 
		@short    Returns the input file descriptor.
	*/
	public native int fd_from();
	/**	
		 Returns the output file descriptor.
				@return the output file descriptor
	 
		@short    Returns the output file descriptor.
	*/
	public native int fd_to();
	/**	
		 Checks whether the connection has been initialized.
				@return true if the initialized

		@short    Checks whether the connection has been initialized.
		@see #init
	*/
	public native boolean inited();
	/**	 
		 Sends/queues the given command to be sent.
			@param cmd the command to set
			@param arr the bytes to send
			 		@short     Sends/queues the given command to be sent.
	*/
	public native void send(int cmd, byte[] arr);
	public native void send(int cmd);
	/**	 
		 Sends the given command immediately.
			@param _cmd the command to set
			@param data the bytes to send
				@return true if successful, false otherwise
	 
		@short     Sends the given command immediately.
	*/
	public native boolean sendnow(int _cmd, byte[] data);
	/**	
		 Receive data.
			@param _cmd the received command will be written here
			@param data the received data will be written here
				@return >=0 indicates the received data size upon success
         -1  indicates error
	 
		@short    Receive data.
	*/
	public native int read(int[] _cmd, byte[] data);
	/**	
		 Don't handle incoming data until resumed.
		         		@short    Don't handle incoming data until resumed.
	*/
	public native void suspend();
	/**	
		 Resume handling of incoming data.
		         		@short    Resume handling of incoming data.
	*/
	public native void resume();
	/**	
		 Returns status of connection.
				@return true if suspended, false otherwise
         
		@short    Returns status of connection.
	*/
	public native boolean suspended();
	protected native void dequeue();
}
