/***************************************************************************
                            KProtocolManager.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;

/**

 Provides information about I/O (Internet, etc.) settings chosen/set
 by the end user.

 KProtocolManager has a heap of static functions that allows only read
 access to KDE's IO related settings. These include proxy, cache, file
 transfer resumption, timeout and user-agent related settings.

 The information provided by this class is generic enough to be applicable
 to any application that makes use of KDE's IO sub-system.  Note that this
 mean the proxy, timeout etc. settings are saved in a separate user-specific
 config file and not in the config file of the application.

 <code>Original</code> author:

 <code>Revised</code> by:

 @author Dawit Alemayehu <adawit@kde.org>
 
 @short 
 Provides information about I/O (Internet, etc.
*/
public class  KProtocolManager implements QtSupport {
	private long _qt;
	private boolean _allocatedInJavaWorld = true;

	protected KProtocolManager(Class dummy){}


/** 
 Returns the default user-agent string.

 This function returns the default user-agent string

   
*/
	public static native String defaultUserAgent();

/** 
 Returns the default user-agent value.

 This function returns the default user-agent value
 taking into account 'keys'

 Keys can be any of the folliwing:
 'o'	Show OS
 'v'	Show OS Version
 'p'	Show platform
 'm'	Show machine architecture
 'l'	Show language

   
*/
	public static native String defaultUserAgent( String keys);

/** 
 Returns the userAgent string configured for the
 specified host.

 If hostname is not found or is empty (i.e. "" or
 String.null) this function will return the default
 user agent.

*/
	public static native String userAgentForHost( String arg1);

/** 
 Returns the preferred timeout value for reading from
 remote connections in seconds.

*/
	public static native int readTimeout();

/** 
 Returns the preferred timeout value for remote connections
 in seconds.

*/
	public static native int connectTimeout();

/** 
 Returns the preferred timeout value for proxy connections
 in seconds.

*/
	public static native int proxyConnectTimeout();

/** 
 Returns the preferred response timeout value for
 remote connecting in seconds.

*/
	public static native int responseTimeout();

/** 
 Returns the set default timeout value for connecting
 to remote machines.

*/
	public static native int defaultConnectTimeout();

/** 
 Returns whether or not the user specified the
 use of proxy server to make connections.
   
*/
	public static native boolean useProxy();

/** 
 Returns whether or not the the proxy server
 lookup should be reversed or not.
   
*/
	public static native boolean useReverseProxy();

/** 
 Returns the type of proxy configuration that is used.
   
*/
	public static native int proxyType();

/** 
 Returns the way proxy authorization should be handled.

*/
	public static native int proxyAuthMode();

/** 
 Returns the strings for hosts that should contacted
 DIRECT bypassing any proxy settings.
   
*/
	public static native String noProxyFor();
	public static native String proxyFor( String arg1);

/** 
 Returns the Proxy server address for a given URL
 If automatic proxy configuration is configured, {@link KPAC}
 is used to determine the proxy server, otherwise the return
 value of {@link #proxyFor} for the URL's protocol is used.
 If an empty string is returned, the request is to be aborted,
 a return value of "DIRECT" requests a direct connection.

*/
	public static native String proxyForURL( KURL arg1);

/** 
 Marks this proxy as bad (down). It will not be used for the
 next 30 minutes. (The script may supply an alternate proxy)
   
*/
	public static native void badProxy( String arg1);

/** 

*/
	public static native String proxyConfigScript();

/** 
 Returns true/false to indicate whether a cache
 should be used

*/
	public static native boolean useCache();

/** 
 Returns the maximum age in seconds cached files should be
 kept before they are deleted as necessary.

*/
	public static native int maxCacheAge();

/** 
 Returns the maximum size that can be used for caching.

 By default this function returns the DEFAULT_MAX_CACHE_SIZE
 value as defined in http_slave_defaults.h.  Not that the
 value returned is in bytes, hence a value of 5120 would mean
 5 Kb.

*/
	public static native int maxCacheSize();

/** 
 The directory which contains the cache files
   
*/
	public static native String cacheDir();

/** 
 Returns the Cache control directive to be used.
   
*/
	public static native int cacheControl();

/** 
 Returns true if partial downloads should be
 automatically resumed.
   
*/
	public static native boolean autoResume();

/** 
 Returns true if partial downloads should be marked
 with a ".part" extension.
   
*/
	public static native boolean markPartial();

/** 
 Returns the minimum file size for keeping aborted
 downloads.

 Any data downloaded that does not meet this minimum
 requirement will simply be discarded. The default size
 is 5 KB.

 @ return the minimum keep size for aborted downloads in bytes.
   
*/
	public static native int minimumKeepSize();

/** 
 Returns true if connections should be persistent
   
*/
	public static native boolean persistentConnections();

/** 
 Force a reload of the general config file of
 io-slaves ( kioslaverc).
   
*/
	public static native void reparseConfiguration();

/** 
 Return the protocol to use in order to handle the given <code>url</code>
 It's usually the same, except that FTP, when handled by a proxy,
 needs an HTTP ioslave.

 When a proxy is to be used, proxy contains the URL for the proxy.
   
*/
	public static native String slaveProtocol( KURL url, String proxy);

/** 

 (Shared with SlaveConfig)
   
*/
	public static native KConfig config();
	public static final int NoProxy = 0;
	public static final int ManualProxy = 1;
	public static final int PACProxy = 2;
	public static final int WPADProxy = 3;
	public static final int EnvVarProxy = 4;
	public static final int Prompt = 0;
	public static final int Automatic = 1;
}
