blob: b55652423357cd7fddbcc036ac908dbc374fe1de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
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.
*/
/*
Copyright (C) 2007 Shintaro Matsuoka <[email protected]>
*/
#ifndef DCCCOMMON_H
#define DCCCOMMON_H
#include <tqstring.h>
class TQObject;
namespace KNetwork
{
class KServerSocket;
}
class Server;
class DccCommon
{
public:
// converts an IP text like "127.0.0.1" to a number.
static TQString textIpToNumericalIp( const TQString& ipString );
// converts a numerical IP text like "12345678" to a normal IP text.
static TQString numericalIpToTextIp( const TQString& numericalIp );
// returns the self IP following the setting.
static TQString getOwnIp( Server* server = 0 );
// creates an instance of KNetwork::ServerSocket following the DCC settings
static KNetwork::KServerSocket* createServerSocketAndListen( TQObject* parent = 0, TQString* failedReason = 0, int minPort = 0, int maxPort = 0 );
// returns the port number from a server socket
static int getServerSocketPort( KNetwork::KServerSocket* serverSocket );
private:
DccCommon();
};
#endif // DCCCOMMON_H
|