/***************************************************************************
                            kde_KSocket.cpp -  description
                             -------------------
    begin                : Tue Mar 19 20:11:49 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Tue Mar 19 20:11:49 2002, using kalyptus 0.9.
 ***************************************************************************/

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

extern "C" {
#include "kde_KSocket.h"
}

#include <ksock.h>

class KSocketBridge : public KSocket
{
public:
	KSocketBridge(int _sock) : KSocket(_sock) {}
	KSocketBridge(const char* _host, unsigned short int _port, int timeOut) : KSocket(_host, _port, timeOut) {}
	KSocketBridge(const char* _path) : KSocket(_path) {}
	~KSocketBridge() {}
	bool  protected_connect(const QString& _host, unsigned short int _port, int timeout) {
		return (bool ) KSocket::connect(_host, _port, timeout);
	}
	bool  protected_connect(const char* _path) {
		return (bool ) KSocket::connect(_path);
	}
	void childEvent(QChildEvent* arg1) {
		if (Qt_EventDelegate == 0L || !(*Qt_EventDelegate)(this, "childEvent", arg1, "QChildEvent")) {
			QObject::childEvent(arg1);
		}
		return;
	}
	void customEvent(QCustomEvent* arg1) {
		if (Qt_EventDelegate == 0L || !(*Qt_EventDelegate)(this, "customEvent", arg1, "QCustomEvent")) {
			QObject::customEvent(arg1);
		}
		return;
	}
	void timerEvent(QTimerEvent* arg1) {
		if (Qt_EventDelegate == 0L || !(*Qt_EventDelegate)(this, "timerEvent", arg1, "QTimerEvent")) {
			QObject::timerEvent(arg1);
		}
		return;
	}
};

kde_KSocket * kde_new_KSocket(int _sock){
	return (kde_KSocket *) new KSocketBridge((int)_sock);
}
kde_KSocket * kde_new_KSocket1(char* _host, unsigned short _port, int timeOut){
	return (kde_KSocket *) new KSocketBridge((char*)_host, (unsigned short int)_port, (int)timeOut);
}
kde_KSocket * kde_new_KSocket2(char* _path){
	return (kde_KSocket *) new KSocketBridge((char*)_path);
}
void kde_del_KSocket( kde_KSocket* p ){
	delete (KSocketBridge*) p;
}
int kde_KSocket_socket( kde_KSocket* instPointer){
	return (int) ((KSocketBridge*)instPointer)->socket();
}
void kde_KSocket_enableRead( kde_KSocket* instPointer,int arg1){
	((KSocketBridge*)instPointer)->enableRead((bool)arg1);
	return;
}
void kde_KSocket_enableWrite( kde_KSocket* instPointer,int arg1){
	((KSocketBridge*)instPointer)->enableWrite((bool)arg1);
	return;
}
//unsigned long kde_KSocket_ipv4_addr( kde_KSocket* instPointer){
//	return (unsigned long) ((KSocketBridge*)instPointer)->ipv4_addr();
//}
void kde_KSocket_slotWrite( kde_KSocket* instPointer,int arg1){
	((KSocketBridge*)instPointer)->slotWrite((int)arg1);
	return;
}
void kde_KSocket_slotRead( kde_KSocket* instPointer,int arg1){
	((KSocketBridge*)instPointer)->slotRead((int)arg1);
	return;
}
//int kde_KSocket_initSockaddr( void* server_name, char* hostname, unsigned short port, int domain){
//	return (int) KSocketBridge::initSockaddr((ksockaddr_in*)server_name, (char*)hostname, (unsigned short int)port, (int)domain);
//}
int kde_KSocket_connect( kde_KSocket* instPointer,qt_QString * _host, unsigned short _port, int timeout){
	return (int) ((KSocketBridge*)instPointer)->protected_connect((QString&)* (QString*)_host, (unsigned short int)_port, (int)timeout);
}
int kde_KSocket_connect1( kde_KSocket* instPointer,char* _path){
	return (int) ((KSocketBridge*)instPointer)->protected_connect((char*)_path);
}
