Files

58 lines
1.7 KiB
C
Raw Permalink Normal View History

2013-08-02 13:12:24 -07:00
// Matt Wells, copyright Nov 2004
/* When adding links/urls to spiderdb, Msg10.cpp, should lookup their IP
address if not already provided using a new Msg class. This is done by MsgC.
Msg class consults the local cache (g_dnsLocal) in Dns.cpp for the IP
address first, if not found it should then consult S_localDnsCache. If it
is not found there, then send the dns lookup request to a host in
the cluster based on the hash of the hostname DIV'd with the number of hosts in
the cluster, g_hostdb.m_numHosts. The request should be looked up in
g_dnsDistributed, not Dns.cpp's local cache, and delivered to
the responsible host. If not there, then the request should be sent to the
appropriate dns server. It is like an L1a/L1b/L2/L3 architecture, where L1
is local, L2 is on a host in the network and L3 is on the dns server. The
returned result (the IP address) should be stored in all 4 caches.*/
2016-03-08 22:14:30 +01:00
#ifndef GB_MSGC_H
#define GB_MSGC_H
2013-08-02 13:12:24 -07:00
#include "Multicast.h"
2016-11-12 19:37:58 +01:00
#include "Url.h"
2013-08-02 13:12:24 -07:00
class Msge1;
2013-08-02 13:12:24 -07:00
class MsgC {
public:
MsgC();
~MsgC();
// Don't bother about dnsState, only Msg14 used to use it, and now
// since we are not using getIp in Msg16 anymore, it is useless.
// returns false if blocked, true otherwise
bool getIp(const char *hostname , int32_t hostnameLen ,
2014-11-10 14:45:11 -08:00
int32_t *ip ,
2013-08-02 13:12:24 -07:00
void *state ,
2014-11-10 14:45:11 -08:00
void (* callback) ( void *state , int32_t ip ),
2016-08-03 12:30:47 +02:00
int32_t niceness = 2);
2013-08-02 13:12:24 -07:00
// register our request handle with g_udp server
static bool registerHandler();
2013-08-02 13:12:24 -07:00
2014-11-10 14:45:11 -08:00
int32_t gotReply();
2013-08-02 13:12:24 -07:00
2014-11-10 14:45:11 -08:00
void (*m_callback) (void *state ,int32_t ip);
2013-08-02 13:12:24 -07:00
// used by Msge1 to store a pointer to itself
Msge1 *m_msge1;
int32_t m_msge1State;
2013-08-02 13:12:24 -07:00
// private:
Multicast m_mcast;
Url m_u;
char m_request[MAX_URL_LEN];
2014-11-10 14:45:11 -08:00
int32_t *m_ipPtr;
2013-08-02 13:12:24 -07:00
};
2016-03-08 22:14:30 +01:00
#endif // GB_MSGC_H