/usr/include/dclib-0.3/dclib/core/casyncdns.h is in libdc-dev 0.3.24~svn3121-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | /***************************************************************************
casyncdns.h - description
-------------------
begin : Mon Jun 10 2002
copyright : (C) 2002-2004 by Mathias Küster
email : mathen@users.berlios.de
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef CASYNCDNS_H
#define CASYNCDNS_H
/**
*@author Mathias Küster
*
* This is a thread that is permanently running to do DNS
* lookups so that they do not block the other dclib thread (CManager).
*
* The CNetAddr lookup function is supposed to be re-entrant since it
* uses getaddrinfo(), so more than one lookup could be done
* simultaneously, but this class does not do that.
*/
#include <time.h>
#ifndef WIN32
#include <netinet/in.h>
#endif
#include <dclib/dcos.h>
#include <dclib/core/cstring.h>
#include <dclib/core/cthread.h>
#include <dclib/core/csingleton.h>
#include <dclib/core/cstringlist.h>
/** */
enum eAsyncDns {
eadSUCCESS,
eadERROR,
eadAGAIN
};
class CAsyncDnsEntry {
public:
/** */
CAsyncDnsEntry() {};
/** */
~CAsyncDnsEntry() {};
/** */
CString m_sHost;
/** */
bool m_bError;
/** socket error message */
CString m_sErrMsg;
/** query timeout */
time_t m_tTimeout;
/** */
struct sockaddr_in m_sin;
};
class CAsyncDns : public CSingleton<CAsyncDns>, public CThread {
public:
/** */
CAsyncDns();
/** */
virtual ~CAsyncDns();
/** */
eAsyncDns GetHostI4( CString stringHost, struct sockaddr_in * sin, CString * errmsg = 0 );
/** */
virtual void Thread();
private:
/** */
void UpdateEntry( CString stringHost );
/** */
CStringList<CAsyncDnsEntry> * m_pHostCache;
/** */
CStringList<CAsyncDnsEntry> * m_pHostList;
};
#endif
|