~ubuntu-branches/debian/sid/libdc0/sid

« back to all changes in this revision

Viewing changes to dclib/core/casyncdns.h

  • Committer: Bazaar Package Importer
  • Author(s): Pasi Savilaakso
  • Date: 2004-06-05 23:01:37 UTC
  • Revision ID: james.westby@ubuntu.com-20040605230137-2ty5g6rcfyguk4et
Tags: upstream-0.3.2
Import upstream version 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                           casyncdns.h  -  description
 
3
                             -------------------
 
4
    begin                : Mon Jun 10 2002
 
5
    copyright            : (C) 2002-2004 by Mathias K�ster
 
6
    email                : mathen@users.berlios.de
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#ifndef CASYNCDNS_H
 
19
#define CASYNCDNS_H
 
20
 
 
21
/**
 
22
  *@author Mathias K�ster
 
23
  */
 
24
 
 
25
#include <time.h>
 
26
 
 
27
#ifndef WIN32
 
28
#include <netinet/in.h>
 
29
#endif
 
30
 
 
31
#include <dclib/dcos.h>
 
32
#include <dclib/core/cstring.h>
 
33
#include <dclib/core/cobject.h>
 
34
#include <dclib/core/cthread.h>
 
35
#include <dclib/core/csingleton.h>
 
36
 
 
37
/** */
 
38
typedef enum eAsyncDns {
 
39
        eadSUCCESS,
 
40
        eadERROR,
 
41
        eadAGAIN
 
42
} eAsyncDns;
 
43
 
 
44
class DLL_EXPORT CAsyncDnsEntry : public CObject {
 
45
public:
 
46
        /** */
 
47
        CAsyncDnsEntry() {};
 
48
        /** */
 
49
        virtual ~CAsyncDnsEntry() {};
 
50
 
 
51
        /** */
 
52
        CString m_sHost;
 
53
        /** */
 
54
        bool m_bError;
 
55
        /** socket error code */
 
56
        int m_nError;
 
57
        /** query timeout */
 
58
        time_t m_tTimeout;
 
59
        /** */
 
60
        struct sockaddr_in m_sin;
 
61
};
 
62
 
 
63
class CStringList;
 
64
class CAsyncDns;
 
65
 
 
66
#ifdef WIN32
 
67
template class DLL_EXPORT CSingleton<CAsyncDns>;
 
68
#endif
 
69
 
 
70
class DLL_EXPORT CAsyncDns : public CSingleton<CAsyncDns>, public CThread {
 
71
 
 
72
public:
 
73
        /** */
 
74
        CAsyncDns();
 
75
        /** */
 
76
        virtual ~CAsyncDns();
 
77
 
 
78
        /** */
 
79
        eAsyncDns GetHostByName( CString stringHost, struct sockaddr_in * sin, int * numerr = 0 );
 
80
 
 
81
        /** */
 
82
        virtual void Thread( CObject * pObject );
 
83
 
 
84
private:
 
85
        /** */
 
86
        void UpdateEntry( CString stringHost );
 
87
        /** */
 
88
        CStringList * m_pHostCache;
 
89
        /** */
 
90
        CStringList * m_pHostList;
 
91
};
 
92
 
 
93
#endif