Files

77 lines
1.6 KiB
C
Raw Permalink Normal View History

2016-03-08 22:14:30 +01:00
#ifndef GB_SITEGETTER_H
#define GB_SITEGETTER_H
2013-08-02 13:12:24 -07:00
#include "gb-include.h"
#include "Msg0.h"
#include "Tagdb.h"
#define MAX_SITE_LEN 256
#define MAX_SCHEME_LEN 16
2013-08-02 13:12:24 -07:00
class SiteGetter {
public:
SiteGetter();
~SiteGetter();
// . returns false if blocked, true otherwise
// . sets g_errno on erorr
2016-11-16 14:51:50 +01:00
bool getSite ( const char *url, class TagRec *gr, int32_t timestamp, collnum_t collnum, int32_t niceness,
void *state = NULL, void (* callback)(void *) = NULL ) ;
2013-08-02 13:12:24 -07:00
2017-01-05 14:50:32 +01:00
const char *getSite() const { return m_site; }
int32_t getSiteLen() const { return m_siteLen; }
2013-08-02 13:12:24 -07:00
2017-01-05 15:28:59 +01:00
const char *getScheme() const { return m_scheme; }
int32_t getSchemeLen() const { return m_schemeLen; }
int32_t getErrno() const { return m_errno; }
bool allDone() const { return m_allDone; }
private:
bool setRecognizedSite();
bool getSiteList();
bool gotSiteList();
bool setSite();
static void gotSiteListWrapper(void *state);
2013-08-02 13:12:24 -07:00
2016-11-16 14:51:50 +01:00
const char *m_url;
collnum_t m_collnum;
2013-08-02 13:12:24 -07:00
void *m_state;
void (*m_callback) (void *state );
RdbList m_list;
2014-11-10 14:45:11 -08:00
int32_t m_sitePathDepth;
2013-08-02 13:12:24 -07:00
// use Msg0 for getting the no-split termlist that combines
// gbpathdepth: with the site hash in a single termid
Msg0 m_msg0;
2014-11-10 14:45:11 -08:00
int32_t m_pathDepth;
int32_t m_maxPathDepth;
int32_t m_niceness;
int32_t m_oldSitePathDepth;
bool m_allDone;
2014-11-10 14:45:11 -08:00
int32_t m_timestamp;
2013-08-02 13:12:24 -07:00
bool m_hasSubdomain;
// points into provided "u->m_url" buffer
char m_site[MAX_SITE_LEN+1];
2014-11-10 14:45:11 -08:00
int32_t m_siteLen;
2013-08-02 13:12:24 -07:00
char m_scheme[MAX_SCHEME_LEN+1];
int32_t m_schemeLen;
2013-08-02 13:12:24 -07:00
bool m_tryAgain;
2014-11-10 14:45:11 -08:00
int32_t m_errno;
2013-08-02 13:12:24 -07:00
// the tag rec we add
TagRec m_addedTag;
};
2016-03-08 22:14:30 +01:00
#endif // GB_SITEGETTER_H