home *** CD-ROM | disk | FTP | other *** search
/ Enter 1999 October / ENTER10_2.bin / prog_7 / mim / install.dir / mimo324 / ubk / urlblock.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-03  |  2.8 KB  |  89 lines

  1. //
  2. // Copyright (c) 1997 Content Technologies Limited. All rights reserved.
  3. //
  4. // HEADER
  5. //
  6. //        urlblock.hpp
  7. //
  8. // PACKAGE
  9. //
  10. //        UBK - URL Blocker
  11. //
  12. // DESCRIPTION
  13. //
  14. //        Use this class to derive your own URL blocker class. This class provides two methods for
  15. //        accessing the section of the configuration file that relates to this URL blocker. String
  16. //        values that need to be returned to the user make use of the BDS_Buffer class to save
  17. //        your class from having to perform the memory management that would be necessarry,
  18. //        otherwise.
  19. //
  20. //
  21. // REFERENCES
  22. //
  23. //        None.
  24. //
  25. // HISTORY
  26. //
  27. //        AUTHOR                DATE                CHANGES
  28. //
  29. //        Dominic Chambers    12-December-1997    Initial Version
  30. //        Dominic Chamber        13-January-1998        Host IP address is now a parameter
  31. //                                                of url block queries.
  32. //        Dominic Chambers    16-January-1998        Corrected error in comments
  33. //
  34.  
  35. #ifndef _URLBLOCK_HPP
  36. #define _URLBLOCK_HPP
  37.  
  38. #include "urlblock.h"
  39. #include "bds\bds_buff.hpp"
  40.  
  41. // base class
  42. class Url_blocker
  43. {
  44.     public:
  45.         Url_blocker();
  46.             // constructor
  47.         
  48.         virtual ~Url_blocker();
  49.             // destructor
  50.         
  51.         virtual BOOL block_query(char* url, long host_ip_addr, BDS_Buffer& reason_text)=0;
  52.             // must be overridden to block urls. return TRUE if url is should be blocked or
  53.             // return FALSE and provide a reason in reason_text, otherwise. The host_ip_addr
  54.             // parameter can be used to identify the computer the request originated from.
  55.             // N.B. The reason text may be plain text or html, in which case it will be
  56.             // placed inside a standard WEBsweeper notice page, or it can be a full HTTP
  57.             // response, in which case it will be returned to the client browser without
  58.             // modification.
  59.  
  60.         virtual BOOL thread_safe() {return TRUE;};
  61.             // override if your block_query method is not thread safe.
  62.  
  63.         virtual BOOL initialise() {return TRUE;};
  64.             // override so that you can check the configuration file is valid, and any other
  65.             // custom requirements you may have.
  66.  
  67.         virtual void terminate() {};
  68.             // do any cleaning up you may need to do here.
  69.  
  70.         friend BOOL _declspec(dllexport) url_block_init(char* config_file_name, char* config_section);
  71.         friend BOOL _declspec(dllexport) url_block_query(char* url, long host_ip_addr, char* reason_text, int buff_size);
  72.         friend void _declspec(dllexport) url_block_terminate(void);
  73.  
  74.     protected:
  75.         BOOL get_first_config_entry(BDS_Buffer& key, BDS_Buffer& value) const;
  76.             // provides access to the first configuration line. method will return FALSE
  77.             // if this line does not exist.
  78.  
  79.         BOOL get_next_config_entry(BDS_Buffer& key, BDS_Buffer& value) const;
  80.             // provides access to the next configuration line. method will return FALSE
  81.             // if this line does not exist.
  82.  
  83.     private:
  84.         BOOL m_initialised;
  85.         void* m_configuration;
  86.         void* m_mutex;
  87. };
  88.  
  89. #endif